mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-09-22 13:39:35 +00:00
removed TLD requirement from SAN extension dns field
This commit is contained in:
@@ -16,7 +16,7 @@ export const validateAltNameField = z
|
||||
.refine(
|
||||
(name) => {
|
||||
return (
|
||||
isFQDN(name, { allow_wildcard: true }) ||
|
||||
isFQDN(name, { allow_wildcard: true, require_tld: false }) ||
|
||||
z.string().url().safeParse(name).success ||
|
||||
z.string().email().safeParse(name).success ||
|
||||
isValidIp(name)
|
||||
@@ -45,7 +45,7 @@ export const validateAltNamesField = z
|
||||
// Split and validate each alt name
|
||||
return data.split(", ").every((name) => {
|
||||
return (
|
||||
isFQDN(name, { allow_wildcard: true }) ||
|
||||
isFQDN(name, { allow_wildcard: true, require_tld: false }) ||
|
||||
z.string().url().safeParse(name).success ||
|
||||
z.string().email().safeParse(name).success ||
|
||||
isValidIp(name)
|
||||
|
||||
@@ -160,6 +160,10 @@ export const InternalCertificateAuthorityFns = ({
|
||||
return { type: "email", value: altName };
|
||||
}
|
||||
|
||||
if (isFQDN(altName, { allow_wildcard: true, require_tld: false })) {
|
||||
return { type: "dns", value: altName };
|
||||
}
|
||||
|
||||
if (z.string().url().safeParse(altName).success) {
|
||||
return { type: "url", value: altName };
|
||||
}
|
||||
@@ -168,10 +172,6 @@ export const InternalCertificateAuthorityFns = ({
|
||||
return { type: "ip", value: altName };
|
||||
}
|
||||
|
||||
if (isFQDN(altName, { allow_wildcard: true })) {
|
||||
return { type: "dns", value: altName };
|
||||
}
|
||||
|
||||
throw new BadRequestError({ message: `Invalid SAN entry: ${altName}` });
|
||||
});
|
||||
|
||||
@@ -434,6 +434,10 @@ export const InternalCertificateAuthorityFns = ({
|
||||
return { type: "email", value: altName };
|
||||
}
|
||||
|
||||
if (isFQDN(altName, { allow_wildcard: true, require_tld: false })) {
|
||||
return { type: "dns", value: altName };
|
||||
}
|
||||
|
||||
if (z.string().url().safeParse(altName).success) {
|
||||
return { type: "url", value: altName };
|
||||
}
|
||||
@@ -442,10 +446,6 @@ export const InternalCertificateAuthorityFns = ({
|
||||
return { type: "ip", value: altName };
|
||||
}
|
||||
|
||||
if (isFQDN(altName, { allow_wildcard: true })) {
|
||||
return { type: "dns", value: altName };
|
||||
}
|
||||
|
||||
throw new BadRequestError({ message: `Invalid SAN entry: ${altName}` });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user