summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-06-16 17:59:23 +0200
committerRory& <root@rory.gay>2026-06-16 17:59:23 +0200
commit9bb2c437cfc61d117373973045a03de66f8e5e49 (patch)
tree03474a2fb9c460955c5e984e4b0bc13c32094387
parentFix random string code (diff)
downloadserver-ts-9bb2c437cfc61d117373973045a03de66f8e5e49.tar.xz
Authentication: allow - in webhook token
-rw-r--r--src/api/middlewares/Authentication.ts2
-rw-r--r--src/api/util/index.ts1
-rw-r--r--src/extensions/Base64.ts (renamed from src/api/util/utility/Base64.ts)0
-rw-r--r--src/extensions/String.ts6
-rw-r--r--src/extensions/index.ts1
5 files changed, 5 insertions, 5 deletions
diff --git a/src/api/middlewares/Authentication.ts b/src/api/middlewares/Authentication.ts

index 9b14a4ae..a71dfdf1 100644 --- a/src/api/middlewares/Authentication.ts +++ b/src/api/middlewares/Authentication.ts
@@ -34,7 +34,7 @@ export const NO_AUTHORIZATION_ROUTES = [ "POST /auth/fingerprint", "GET /invites/", // Routes with a seperate auth system - /^(POST|HEAD|GET|PATCH|DELETE) \/webhooks\/\d+\/\w+\/?/, // no token requires auth + /^(POST|HEAD|GET|PATCH|DELETE) \/webhooks\/\d+\/[\w-]+\/?/, // no token requires auth /^POST \/interactions\/\d+\/[A-Za-z0-9_-]+\/callback/, // Public information endpoints "GET /ping", diff --git a/src/api/util/index.ts b/src/api/util/index.ts
index 1741179c..b04af8d1 100644 --- a/src/api/util/index.ts +++ b/src/api/util/index.ts
@@ -16,7 +16,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -export * from "./utility/Base64"; export * from "./utility/ipAddress"; export * from "./handlers/Message"; export * from "./utility/passwordStrength"; diff --git a/src/api/util/utility/Base64.ts b/src/extensions/Base64.ts
index 78a56f63..78a56f63 100644 --- a/src/api/util/utility/Base64.ts +++ b/src/extensions/Base64.ts
diff --git a/src/extensions/String.ts b/src/extensions/String.ts
index 5c623e30..fb34600f 100644 --- a/src/extensions/String.ts +++ b/src/extensions/String.ts
@@ -18,9 +18,8 @@ import { Request } from "express"; import { SPECIAL_CHAR } from "@spacebar/util/util/Regex"; -import { Random } from "@spacebar/extensions/Random"; -import { ntob } from "@spacebar/api"; -import { FieldErrors } from "@spacebar/util"; +import { Random, ntob } from "@spacebar/extensions"; +import { FieldErrors } from "@spacebar/util/util/FieldError"; export function trimSpecial(str?: string): string { if (!str) return ""; @@ -49,6 +48,7 @@ export function stringGlobToRegexp(str: string, flags?: string): RegExp { return new RegExp(escaped, flags); } +// TODO: use exception type export function stringCheckLength(str: string, min: number, max: number, key: string, req: Request) { if (str.length < min || str.length > max) { throw FieldErrors({ diff --git a/src/extensions/index.ts b/src/extensions/index.ts
index 15563724..f22d3d3b 100644 --- a/src/extensions/index.ts +++ b/src/extensions/index.ts
@@ -17,6 +17,7 @@ */ export * from "./Array"; +export * from "./Base64"; export * from "./DateBuilder"; export * from "./ElapsedTime"; export * from "./Math";