diff --git a/backend/src/ee/services/certificate-est/certificate-est-service.ts b/backend/src/ee/services/certificate-est/certificate-est-service.ts index e39c834f3c..627cc58c6b 100644 --- a/backend/src/ee/services/certificate-est/certificate-est-service.ts +++ b/backend/src/ee/services/certificate-est/certificate-est-service.ts @@ -244,10 +244,6 @@ export const certificateEstServiceFactory = ({ const certificates = extractX509CertFromChain(caCertChain).map((cert) => new x509.X509Certificate(cert)); - if (!certificates) { - throw new BadRequestError({ message: "Failed to parse certificate chain" }); - } - const caCertificate = new x509.X509Certificate(caCert); return convertRawCertsToPkcs7([caCertificate.rawData, ...certificates.map((cert) => cert.rawData)]); }; diff --git a/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.ts b/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.ts index 8f747a3370..48d7939707 100644 --- a/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.ts +++ b/backend/src/ee/services/ssh-certificate-template/ssh-certificate-template-validators.ts @@ -10,7 +10,7 @@ export const isValidUserPattern = (value: string): boolean => { if (value === "*") return true; // Handle wildcard separately // Simpler, more specific pattern for usernames - const userRegex = /^[a-z_][a-z0-9_-]$/; + const userRegex = /^[a-z_][a-z0-9_-]*$/i; return userRegex.test(value); }; diff --git a/backend/src/lib/axios/digest-auth.ts b/backend/src/lib/axios/digest-auth.ts index 1731e57497..449c471fdd 100644 --- a/backend/src/lib/axios/digest-auth.ts +++ b/backend/src/lib/axios/digest-auth.ts @@ -28,8 +28,8 @@ export const createDigestAuthRequestInterceptor = ( nc += 1; const nonceCount = nc.toString(16).padStart(8, "0"); const cnonce = crypto.randomBytes(24).toString("hex"); - const realm = authDetails.find((el) => el[0].toLowerCase().indexOf("realm") > -1)?.[1].replaceAll('"', ""); - const nonce = authDetails.find((el) => el[0].toLowerCase().indexOf("nonce") > -1)?.[1].replaceAll('"', ""); + const realm = authDetails.find((el) => el[0].toLowerCase().indexOf("realm") > -1)?.[1]?.replaceAll('"', "") || ""; + const nonce = authDetails.find((el) => el[0].toLowerCase().indexOf("nonce") > -1)?.[1]?.replaceAll('"', "") || ""; const ha1 = crypto.createHash("md5").update(`${username}:${realm}:${password}`).digest("hex"); const path = opts.url; diff --git a/backend/src/lib/validator/validate-string.test.ts b/backend/src/lib/validator/validate-string.test.ts index 953f6e7575..73e1728966 100644 --- a/backend/src/lib/validator/validate-string.test.ts +++ b/backend/src/lib/validator/validate-string.test.ts @@ -15,7 +15,7 @@ describe("validate-string", () => { test("Check special characters", () => { expect(characterValidator([CharacterType.AlphaNumeric, CharacterType.Hyphen])("Hello-World")).toBeTruthy(); - expect(characterValidator([CharacterType.AlphaNumeric, CharacterType.Hyphen])("Hello-World")).toBeTruthy(); + expect(characterValidator([CharacterType.AlphaNumeric, CharacterType.Plus])("Hello+World")).toBeTruthy(); expect(characterValidator([CharacterType.AlphaNumeric, CharacterType.Underscore])("Hello_World")).toBeTruthy(); expect(characterValidator([CharacterType.AlphaNumeric, CharacterType.Colon])("Hello:World")).toBeTruthy(); expect(characterValidator([CharacterType.AlphaNumeric, CharacterType.Underscore])("Hello World")).toBeFalsy(); diff --git a/backend/src/services/secret/secret-fns.ts b/backend/src/services/secret/secret-fns.ts index ca106c71f3..2574dc13ec 100644 --- a/backend/src/services/secret/secret-fns.ts +++ b/backend/src/services/secret/secret-fns.ts @@ -207,7 +207,7 @@ export const recursivelyGetSecretPaths = ({ const formatMultiValueEnv = (val?: string) => { if (!val) return ""; if (!val.match("\n")) return val; - return `"${val.replaceAll("/n", "\\n")}"`; + return `"${val.replaceAll("\n", "\\n")}"`; }; type TInterpolateSecretArg = {