Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

Improve SAN API field

Carlos Monastyrski36388263ae91
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index fd6666b920..acc79e18a0 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -1899,7 +1899,7 @@ interface AddIdentityTlsCertAuthEvent {
metadata: {
identityId: string;
allowedCommonNames: string | null | undefined;
- allowedSubjectAltNames: string | null | undefined;
+ allowedSubjectAltNames: string[] | null | undefined;
accessTokenTTL: number;
accessTokenMaxTTL: number;
accessTokenNumUsesLimit: number;
@@ -1919,7 +1919,7 @@ interface UpdateIdentityTlsCertAuthEvent {
metadata: {
identityId: string;
allowedCommonNames: string | null | undefined;
- allowedSubjectAltNames: string | null | undefined;
+ allowedSubjectAltNames: string[] | null | undefined;
accessTokenTTL?: number;
accessTokenMaxTTL?: number;
accessTokenNumUsesLimit?: number;
diff --git a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
index 24a11670a9..dbde01e850 100644
--- a/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
+++ b/backend/src/server/routes/v1/identity-tls-cert-auth-router.ts
@@ -13,7 +13,10 @@ import { getTelemetryDistinctId } from "@app/server/lib/telemetry";
import { verifyAuth } from "@app/server/plugins/auth/verify-auth";
import { ActorType, AuthMode } from "@app/services/auth/auth-type";
import { TIdentityTrustedIp } from "@app/services/identity/identity-types";
-import { isValidAllowedSubjectAltNameEntry } from "@app/services/identity-tls-cert-auth/identity-tls-cert-auth-fns";
+import {
+ isValidAllowedSubjectAltNameEntry,
+ parseAllowedSubjectAltNames
+} from "@app/services/identity-tls-cert-auth/identity-tls-cert-auth-fns";
import { isSuperAdmin } from "@app/services/super-admin/super-admin-fns";
import { PostHogEventTypes } from "@app/services/telemetry/telemetry-types";
@@ -28,20 +31,15 @@ const validateCommonNames = z
.join(",")
);
+const MAX_ALLOWED_SUBJECT_ALT_NAMES_LENGTH = 4096;
+
const validateSubjectAltNames = z
.string()
- .min(1)
- .max(4096)
.trim()
- .transform((el) =>
- el
- .split(",")
- .map((i) => i.trim())
- .filter(Boolean)
- .join(",")
- )
- .superRefine((val, ctx) => {
- const invalidEntries = val.split(",").filter((entry) => !isValidAllowedSubjectAltNameEntry(entry));
+ .min(1, "Subject alternative name entries cannot be empty")
+ .array()
+ .superRefine((entries, ctx) => {
+ const invalidEntries = entries.filter((entry) => !isValidAllowedSubjectAltNameEntry(entry));
if (invalidEntries.length) {
ctx.addIssue({
@@ -51,8 +49,24 @@ const validateSubjectAltNames = z
}: ${invalidEntries.join(", ")}. Prefix non-DNS values with their type (e.g. "URI:spiffe://...", "IP:10.0.0.1", "EMAIL:[email protected]").`
});
}
+
+ if (JSON.stringify(entries).length > MAX_ALLOWED_SUBJECT_ALT_NAMES_LENGTH) {
+ ctx.addIssue({
+ code: z.ZodIssueCode.custom,
+ message: `Allowed subject alternative names must not exceed ${MAX_ALLOWED_SUBJECT_ALT_NAMES_LENGTH} characters in total.`
+ });
+ }
});
+const IdentityTlsCertAuthResponseSchema = IdentityTlsCertAuthsSchema.extend({
+ allowedSubjectAltNames: z.string().array().nullable()
+});
+
+const toTlsCertAuthResponse = <T extends { allowedSubjectAltNames?: string | null }>(auth: T) => ({
+ ...auth,
+ allowedSubjectAltNames: auth.allowedSubjectAltNames ? parseAllowedSubjectAltNames(auth.allowedSubjectAltNames) : null
+});
+
const validateCaCertificate = (caCert: string) => {
if (!caCert) return true;
try {
@@ -247,7 +261,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
),
response: {
200: z.object({
- identityTlsCertAuth: IdentityTlsCertAuthsSchema
+ identityTlsCertAuth: IdentityTlsCertAuthResponseSchema
})
}
},
@@ -262,6 +276,8 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
isActorSuperAdmin: isSuperAdmin(req.auth)
});
+ const tlsCertAuthResponse = toTlsCertAuthResponse(identityTlsCertAuth);
+
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
orgId: req.permission.orgId,
@@ -270,7 +286,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
metadata: {
identityId: identityTlsCertAuth.identityId,
allowedCommonNames: identityTlsCertAuth.allowedCommonNames,
- allowedSubjectAltNames: identityTlsCertAuth.allowedSubjectAltNames,
+ allowedSubjectAltNames: tlsCertAuthResponse.allowedSubjectAltNames,
accessTokenTTL: identityTlsCertAuth.accessTokenTTL,
accessTokenMaxTTL: identityTlsCertAuth.accessTokenMaxTTL,
accessTokenTrustedIps: identityTlsCertAuth.accessTokenTrustedIps as TIdentityTrustedIp[],
@@ -294,7 +310,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
logger.error(error, `Failed to send telemetry event [identityId=${identityTlsCertAuth.identityId}]`);
});
- return { identityTlsCertAuth };
+ return { identityTlsCertAuth: tlsCertAuthResponse };
}
});
@@ -370,7 +386,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
),
response: {
200: z.object({
- identityTlsCertAuth: IdentityTlsCertAuthsSchema
+ identityTlsCertAuth: IdentityTlsCertAuthResponseSchema
})
}
},
@@ -384,6 +400,8 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
identityId: req.params.identityId
});
+ const tlsCertAuthResponse = toTlsCertAuthResponse(identityTlsCertAuth);
+
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
orgId: req.permission.orgId,
@@ -392,7 +410,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
metadata: {
identityId: identityTlsCertAuth.identityId,
allowedCommonNames: identityTlsCertAuth.allowedCommonNames,
- allowedSubjectAltNames: identityTlsCertAuth.allowedSubjectAltNames,
+ allowedSubjectAltNames: tlsCertAuthResponse.allowedSubjectAltNames,
accessTokenTTL: identityTlsCertAuth.accessTokenTTL,
accessTokenMaxTTL: identityTlsCertAuth.accessTokenMaxTTL,
accessTokenTrustedIps: identityTlsCertAuth.accessTokenTrustedIps as TIdentityTrustedIp[],
@@ -416,7 +434,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
logger.error(error, `Failed to send telemetry event [identityId=${identityTlsCertAuth.identityId}]`);
});
- return { identityTlsCertAuth };
+ return { identityTlsCertAuth: tlsCertAuthResponse };
}
});
@@ -442,7 +460,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}),
response: {
200: z.object({
- identityTlsCertAuth: IdentityTlsCertAuthsSchema.extend({
+ identityTlsCertAuth: IdentityTlsCertAuthResponseSchema.extend({
caCertificate: z.string()
})
})
@@ -457,6 +475,8 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
actorAuthMethod: req.permission.authMethod
});
+ const tlsCertAuthResponse = toTlsCertAuthResponse(identityTlsCertAuth);
+
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
orgId: req.permission.orgId,
@@ -467,7 +487,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}
}
});
- return { identityTlsCertAuth };
+ return { identityTlsCertAuth: tlsCertAuthResponse };
}
});
@@ -493,7 +513,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
}),
response: {
200: z.object({
- identityTlsCertAuth: IdentityTlsCertAuthsSchema
+ identityTlsCertAuth: IdentityTlsCertAuthResponseSchema
})
}
},
@@ -506,6 +526,8 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
identityId: req.params.identityId
});
+ const tlsCertAuthResponse = toTlsCertAuthResponse(identityTlsCertAuth);
+
await server.services.auditLog.createAuditLog({
...req.auditLogInfo,
orgId: req.permission.orgId,
@@ -532,7 +554,7 @@ export const registerIdentityTlsCertAuthRouter = async (server: FastifyZodProvid
logger.error(error, `Failed to send telemetry event [identityId=${identityTlsCertAuth.identityId}]`);
});
- return { identityTlsCertAuth };
+ return { identityTlsCertAuth: tlsCertAuthResponse };
}
});
};
diff --git a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.test.ts b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.test.ts
index a0c503066e..cec1c02495 100644
--- a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.test.ts
+++ b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.test.ts
@@ -4,8 +4,10 @@ import {
isSubjectAltNameAllowed,
isValidAllowedSubjectAltNameEntry,
normalizeAllowedSubjectAltName,
+ parseAllowedSubjectAltNames,
parseCertificateSubjectAltNames,
parseSubjectDetails,
+ serializeAllowedSubjectAltNames,
TCertificateSanItem
} from "./identity-tls-cert-auth-fns";
@@ -165,62 +167,72 @@ describe("normalizeAllowedSubjectAltName", () => {
describe("isSubjectAltNameAllowed", () => {
test("matches a type-prefixed allow-list entry against the certificate", () => {
expect(
- isSubjectAltNameAllowed("URI:spiffe://example.org/svc", [{ type: "url", value: "spiffe://example.org/svc" }])
+ isSubjectAltNameAllowed(["URI:spiffe://example.org/svc"], [{ type: "url", value: "spiffe://example.org/svc" }])
).toBe(true);
});
test("matches a bare DNS allow-list entry against a DNS SAN", () => {
- expect(isSubjectAltNameAllowed("svc.example.com", [{ type: "dns", value: "svc.example.com" }])).toBe(true);
+ expect(isSubjectAltNameAllowed(["svc.example.com"], [{ type: "dns", value: "svc.example.com" }])).toBe(true);
});
test("matches DNS SANs case-insensitively", () => {
- expect(isSubjectAltNameAllowed("svc.example.com", [{ type: "dns", value: "SVC.EXAMPLE.COM" }])).toBe(true);
+ expect(isSubjectAltNameAllowed(["svc.example.com"], [{ type: "dns", value: "SVC.EXAMPLE.COM" }])).toBe(true);
});
test("matches email SAN domain case-insensitively but local-part case-sensitively", () => {
// domain casing differs -> still matches
- expect(isSubjectAltNameAllowed("EMAIL:[email protected]", [{ type: "email", value: "[email protected]" }])).toBe(true);
+ expect(isSubjectAltNameAllowed(["EMAIL:[email protected]"], [{ type: "email", value: "[email protected]" }])).toBe(
+ true
+ );
// local-part casing differs -> must NOT match
- expect(isSubjectAltNameAllowed("EMAIL:[email protected]", [{ type: "email", value: "[email protected]" }])).toBe(false);
+ expect(isSubjectAltNameAllowed(["EMAIL:[email protected]"], [{ type: "email", value: "[email protected]" }])).toBe(
+ false
+ );
});
test("does not conflate SAN types (bare value defaults to DNS and must not match a URI SAN)", () => {
expect(
- isSubjectAltNameAllowed("spiffe://example.org/svc", [{ type: "url", value: "spiffe://example.org/svc" }])
+ isSubjectAltNameAllowed(["spiffe://example.org/svc"], [{ type: "url", value: "spiffe://example.org/svc" }])
).toBe(false);
});
test("does not match a same-string SAN of a different type", () => {
// Allow-list wants a URI SAN; a DNS SAN with the same string must not pass.
expect(
- isSubjectAltNameAllowed("URI:spiffe://example.org/svc", [{ type: "dns", value: "spiffe://example.org/svc" }])
+ isSubjectAltNameAllowed(["URI:spiffe://example.org/svc"], [{ type: "dns", value: "spiffe://example.org/svc" }])
).toBe(false);
});
test("matches when any one of several allow-list entries is satisfied", () => {
expect(
- isSubjectAltNameAllowed("URI:spiffe://example.org/other, svc.example.com", [
- { type: "dns", value: "svc.example.com" }
- ])
+ isSubjectAltNameAllowed(
+ ["URI:spiffe://example.org/other", "svc.example.com"],
+ [{ type: "dns", value: "svc.example.com" }]
+ )
).toBe(true);
});
test("returns false when no certificate SAN matches", () => {
expect(
- isSubjectAltNameAllowed("URI:spiffe://example.org/svc", [{ type: "url", value: "spiffe://example.org/other" }])
+ isSubjectAltNameAllowed(["URI:spiffe://example.org/svc"], [{ type: "url", value: "spiffe://example.org/other" }])
).toBe(false);
});
test("returns false when the certificate has no SANs", () => {
- expect(isSubjectAltNameAllowed("svc.example.com", undefined)).toBe(false);
- expect(isSubjectAltNameAllowed("svc.example.com", [])).toBe(false);
+ expect(isSubjectAltNameAllowed(["svc.example.com"], undefined)).toBe(false);
+ expect(isSubjectAltNameAllowed(["svc.example.com"], [])).toBe(false);
});
- test("tolerates whitespace in the allow-list", () => {
+ test("returns false for an empty allow-list", () => {
+ expect(isSubjectAltNameAllowed([], [{ type: "dns", value: "svc.example.com" }])).toBe(false);
+ });
+
+ test("trims surrounding whitespace on each allow-list entry", () => {
expect(
- isSubjectAltNameAllowed(" svc.example.com , URI:spiffe://example.org/svc ", [
- { type: "dns", value: "svc.example.com" }
- ])
+ isSubjectAltNameAllowed(
+ [" svc.example.com ", " URI:spiffe://example.org/svc "],
+ [{ type: "dns", value: "svc.example.com" }]
+ )
).toBe(true);
});
});
diff --git a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.ts b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.ts
index 4b5fefb2ad..d355947071 100644
--- a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.ts
+++ b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-fns.ts
@@ -105,15 +105,31 @@ export const isValidAllowedSubjectAltNameEntry = (entry: string): boolean => {
};
export const isSubjectAltNameAllowed = (
- allowedSubjectAltNames: string,
+ allowedSubjectAltNames: ReadonlyArray<string>,
certificateSanItems?: ReadonlyArray<TCertificateSanItem>
): boolean => {
const certificateSans = new Set(parseCertificateSubjectAltNames(certificateSanItems));
if (certificateSans.size === 0) return false;
return allowedSubjectAltNames
- .split(",")
.map(normalizeAllowedSubjectAltName)
.filter((san): san is string => san !== null)
.some((allowedSan) => certificateSans.has(allowedSan));
};
+
+export const serializeAllowedSubjectAltNames = (entries?: ReadonlyArray<string> | null): string | null | undefined => {
+ if (entries === undefined) return undefined;
+ if (entries === null || entries.length === 0) return null;
+ return JSON.stringify(entries);
+};
+
+export const parseAllowedSubjectAltNames = (stored?: string | null): string[] => {
+ if (!stored) return [];
+ try {
+ const parsed = JSON.parse(stored) as unknown;
+ if (Array.isArray(parsed)) return parsed.filter((entry): entry is string => typeof entry === "string");
+ return [];
+ } catch {
+ return [];
+ }
+};
diff --git a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts
index 256922000b..8520b23eb6 100644
--- a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts
+++ b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-service.ts
@@ -42,7 +42,12 @@ import { TMembershipIdentityDALFactory } from "../membership-identity/membership
import { TOrgDALFactory } from "../org/org-dal";
import { validateIdentityUpdateForSuperAdminPrivileges } from "../super-admin/super-admin-fns";
import { TIdentityTlsCertAuthDALFactory } from "./identity-tls-cert-auth-dal";
-import { isSubjectAltNameAllowed, parseSubjectDetails } from "./identity-tls-cert-auth-fns";
+import {
+ isSubjectAltNameAllowed,
+ parseAllowedSubjectAltNames,
+ parseSubjectDetails,
+ serializeAllowedSubjectAltNames
+} from "./identity-tls-cert-auth-fns";
import { TIdentityTlsCertAuthServiceFactory } from "./identity-tls-cert-auth-types";
type TIdentityTlsCertAuthServiceFactoryDep = {
@@ -196,7 +201,7 @@ export const identityTlsCertAuthServiceFactory = ({
);
const isValidSubjectAltName = isSubjectAltNameAllowed(
- identityTlsCertAuth.allowedSubjectAltNames,
+ parseAllowedSubjectAltNames(identityTlsCertAuth.allowedSubjectAltNames),
sanExtension?.names.items
);
if (!isValidSubjectAltName) {
@@ -435,7 +440,7 @@ export const identityTlsCertAuthServiceFactory = ({
identityId: identityMembershipOrg.identity.id,
accessTokenMaxTTL,
allowedCommonNames,
- allowedSubjectAltNames,
+ allowedSubjectAltNames: serializeAllowedSubjectAltNames(allowedSubjectAltNames),
accessTokenTTL,
encryptedCaCertificate: encryptor({ plainText: Buffer.from(caCertificate) }).cipherTextBlob,
accessTokenNumUsesLimit,
@@ -540,7 +545,7 @@ export const identityTlsCertAuthServiceFactory = ({
const updatedTlsCertAuth = await identityTlsCertAuthDAL.updateById(identityTlsCertAuth.id, {
allowedCommonNames,
- allowedSubjectAltNames,
+ allowedSubjectAltNames: serializeAllowedSubjectAltNames(allowedSubjectAltNames),
encryptedCaCertificate: caCertificate
? encryptor({ plainText: Buffer.from(caCertificate) }).cipherTextBlob
: undefined,
diff --git a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts
index fb2bc5d2fc..e820cb8926 100644
--- a/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts
+++ b/backend/src/services/identity-tls-cert-auth/identity-tls-cert-auth-types.ts
@@ -11,7 +11,7 @@ export type TAttachTlsCertAuthDTO = {
identityId: string;
caCertificate: string;
allowedCommonNames?: string | null;
- allowedSubjectAltNames?: string | null;
+ allowedSubjectAltNames?: string[] | null;
accessTokenTTL: number;
accessTokenMaxTTL: number;
accessTokenNumUsesLimit: number;
@@ -23,7 +23,7 @@ export type TUpdateTlsCertAuthDTO = {
identityId: string;
caCertificate?: string;
allowedCommonNames?: string | null;
- allowedSubjectAltNames?: string | null;
+ allowedSubjectAltNames?: string[] | null;
accessTokenTTL?: number;
accessTokenMaxTTL?: number;
accessTokenNumUsesLimit?: number;
diff --git a/frontend/src/hooks/api/identities/types.ts b/frontend/src/hooks/api/identities/types.ts
index aa1b31904c..cce02fce65 100644
--- a/frontend/src/hooks/api/identities/types.ts
+++ b/frontend/src/hooks/api/identities/types.ts
@@ -574,7 +574,7 @@ export type IdentityTlsCertAuth = {
identityId: string;
caCertificate: string;
allowedCommonNames: string;
- allowedSubjectAltNames: string | null;
+ allowedSubjectAltNames: string[] | null;
accessTokenTTL: number;
accessTokenMaxTTL: number;
accessTokenNumUsesLimit: number;
@@ -587,7 +587,7 @@ export type AddIdentityTlsCertAuthDTO = {
identityId: string;
caCertificate: string;
allowedCommonNames?: string;
- allowedSubjectAltNames?: string;
+ allowedSubjectAltNames?: string[];
accessTokenTTL: number;
accessTokenMaxTTL: number;
accessTokenNumUsesLimit: number;
@@ -602,7 +602,7 @@ export type UpdateIdentityTlsCertAuthDTO = {
identityId: string;
caCertificate: string;
allowedCommonNames?: string | null;
- allowedSubjectAltNames?: string | null;
+ allowedSubjectAltNames?: string[] | null;
accessTokenTTL?: number;
accessTokenMaxTTL?: number;
accessTokenNumUsesLimit?: number;
diff --git a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx
index b11c193b22..c790a7aef7 100644
--- a/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx
+++ b/frontend/src/pages/organization/AccessManagementPage/components/OrgIdentityTab/components/IdentitySection/IdentityTlsCertAuthForm.tsx
@@ -118,7 +118,7 @@ export const IdentityTlsCertAuthForm = ({
reset({
caCertificate: data.caCertificate,
allowedCommonNames: data.allowedCommonNames || undefined,
- allowedSubjectAltNames: data.allowedSubjectAltNames || undefined,
+ allowedSubjectAltNames: data.allowedSubjectAltNames?.join("\n") || undefined,
accessTokenTTL: String(data.accessTokenTTL),
accessTokenMaxTTL: String(data.accessTokenMaxTTL),
accessTokenNumUsesLimit: data.accessTokenNumUsesLimit
@@ -152,12 +152,21 @@ export const IdentityTlsCertAuthForm = ({
}: FormData) => {
if (!identityId) return;
+ const allowedSubjectAltNamesList = allowedSubjectAltNames
+ ? allowedSubjectAltNames
+ .split("\n")
+ .map((entry) => entry.trim())
+ .filter(Boolean)
+ : [];
+
if (data) {
await updateMutateAsync({
...(projectId ? { projectId } : { organizationId: orgId }),
caCertificate,
allowedCommonNames: allowedCommonNames || null,
- allowedSubjectAltNames: allowedSubjectAltNames || null,
+ allowedSubjectAltNames: allowedSubjectAltNamesList.length
+ ? allowedSubjectAltNamesList
+ : null,
identityId,
accessTokenTTL: Number(accessTokenTTL),
accessTokenMaxTTL: Number(accessTokenMaxTTL),
@@ -170,7 +179,9 @@ export const IdentityTlsCertAuthForm = ({
identityId,
caCertificate,
allowedCommonNames: allowedCommonNames || undefined,
- allowedSubjectAltNames: allowedSubjectAltNames || undefined,
+ allowedSubjectAltNames: allowedSubjectAltNamesList.length
+ ? allowedSubjectAltNamesList
+ : undefined,
accessTokenTTL: Number(accessTokenTTL),
accessTokenMaxTTL: Number(accessTokenMaxTTL),
accessTokenNumUsesLimit: Number(accessTokenNumUsesLimit || "0"),
@@ -267,16 +278,16 @@ export const IdentityTlsCertAuthForm = ({
<InfoIcon className="size-3.5 text-muted" />
</TooltipTrigger>
<TooltipContent className="max-w-md">
- Comma separated subject alternative names allowed to authenticate against
- the identity. Prefix entries by type (URI:, DNS:, IP:, EMAIL:). Bare entries
- are treated as DNS names. Leave empty to skip SAN validation.
+ Subject alternative names allowed to authenticate against the identity, one
+ per line. Prefix entries by type (URI:, DNS:, IP:, EMAIL:). Bare entries are
+ treated as DNS names. Leave empty to skip SAN validation.
</TooltipContent>
</Tooltip>
</FieldLabel>
- <Input
+ <TextArea
{...field}
id="allowedSubjectAltNames"
- type="text"
+ placeholder={"URI:spiffe://example.org/svc\nsvc.example.com"}
isError={Boolean(error)}
/>
<FieldError>{error?.message}</FieldError>
diff --git a/frontend/src/views/IdentityAuthMethods/content/IdentityTlsCertAuthContent.tsx b/frontend/src/views/IdentityAuthMethods/content/IdentityTlsCertAuthContent.tsx
index 62365e4c3b..1c991d1bc7 100644
--- a/frontend/src/views/IdentityAuthMethods/content/IdentityTlsCertAuthContent.tsx
+++ b/frontend/src/views/IdentityAuthMethods/content/IdentityTlsCertAuthContent.tsx
@@ -66,10 +66,7 @@ export const IdentityTlsCertAuthContent = ({ identityId }: ViewAuthMethodProps)
.join(", ")}
</IdentityAuthFieldDisplay>
<IdentityAuthFieldDisplay className="col-span-2" label="Allowed Subject Alternative Names">
- {data.allowedSubjectAltNames
- ?.split(",")
- .map((san) => san.trim())
- .join(", ")}
+ {data.allowedSubjectAltNames?.join(", ")}
</IdentityAuthFieldDisplay>
</div>
);