Skip to content

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

fix(pki): scope pkcs12 octet-stream to 200 and document password rules

bernie-gbc1efaad368b
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index 690a51981c..d086d043f8 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -2345,7 +2345,7 @@ export const CERTIFICATES = {
},
EXPORT_PKCS12: {
password:
- "Password to protect the PKCS#12 keystore with. Must be 14 to 100 characters and contain a letter, a number and a special character.",
+ "Password to protect the PKCS#12 keystore with. Must be 14 to 100 characters, contain a letter, a number and a special character, have no more than 3 repeated consecutive characters, and contain no escape characters (newline, tab, carriage return or backslash).",
alias: "Friendly name for the certificate inside the keystore.",
keystore:
"The PKCS#12 keystore (.p12) as binary data, containing the certificate, its chain and its private key, encrypted with the given password."
diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.ts
index a92c0a09a1..a046686f39 100644
--- a/backend/src/server/routes/v1/certificate-router.ts
+++ b/backend/src/server/routes/v1/certificate-router.ts
@@ -2079,7 +2079,6 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
operationId: "exportCertificatePkcs12",
tags: [ApiDocsTags.PkiCertificates],
description: "Download certificate in PKCS12 format",
- produces: ["application/octet-stream"],
params: z.object({
id: z.string().trim().uuid().describe(CERTIFICATES.GET.id)
}),
@@ -2088,11 +2087,15 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {
alias: z.string().trim().min(1, "Alias is required").max(255).describe(CERTIFICATES.EXPORT_PKCS12.alias)
}),
response: {
- 200: z
- .any()
- .describe(
- JSON.stringify({ type: "string", format: "binary", description: CERTIFICATES.EXPORT_PKCS12.keystore })
- )
+ 200: z.any().describe(
+ JSON.stringify({
+ content: {
+ "application/octet-stream": {
+ schema: { type: "string", format: "binary", description: CERTIFICATES.EXPORT_PKCS12.keystore }
+ }
+ }
+ })
+ )
}
},
handler: async (req, reply) => {