feat: add slug validator for sub org creation

This commit is contained in:
=
2025-10-20 18:58:43 +05:30
parent 8824be431f
commit 2ec851fd34
4 changed files with 19 additions and 7 deletions
@@ -11,6 +11,7 @@ import { BadRequestError } from "@app/lib/errors";
import { ActorType, AuthMethod, AuthMode, AuthModeJwtTokenPayload, AuthTokenType } from "@app/services/auth/auth-type";
import { TIdentityAccessTokenJwtPayload } from "@app/services/identity-access-token/identity-access-token-types";
import { getServerCfg } from "@app/services/super-admin/super-admin-service";
import { GenericResourceNameSchema } from "@app/server/lib/schemas";
export type TAuthMode =
| {
@@ -147,6 +148,9 @@ export const injectIdentity = fp(
if (!authMode) return;
const subOrganizationSelector = req.headers?.["x-infisical-org"] as string | undefined;
if (subOrganizationSelector) {
await GenericResourceNameSchema.parseAsync(subOrganizationSelector);
}
switch (authMode) {
case AuthMode.JWT: {