Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
Address PR comment
Carlos Monastyrskibed48565248f
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.tsindex 31e8a46d09..0ba71484fb 100644--- a/backend/src/lib/api-docs/constants.ts+++ b/backend/src/lib/api-docs/constants.ts@@ -2208,20 +2208,13 @@ export const CERTIFICATES = {serialNumber: "The serial number of the certificate to get."},REVOKE: {- id: "The ID of the certificate to revoke.",+ id: "The ID or SHA-1/SHA-256 thumbprint of the certificate to revoke. Thumbprint colons and casing are ignored.",serialNumber:"The serial number of the certificate to revoke. The revoked certificate will be added to the certificate revocation list (CRL) of the CA.",revocationReason: "The reason for revoking the certificate.",revokedAt: "The date and time when the certificate was revoked.",serialNumberRes: "The serial number of the revoked certificate."},- REVOKE_BY_THUMBPRINT: {- thumbprint:- "The SHA-1 or SHA-256 thumbprint (fingerprint) of the certificate to revoke. Colons and casing are ignored.",- revocationReason: "The reason for revoking the certificate.",- revokedAt: "The date and time when the certificate was revoked.",- serialNumberRes: "The serial number of the revoked certificate."- },DELETE: {id: "The ID of the certificate to delete.",serialNumber: "The serial number of the certificate to delete."diff --git a/backend/src/server/routes/v1/certificate-router.ts b/backend/src/server/routes/v1/certificate-router.tsindex 213b4d6e65..66b3ad7491 100644--- a/backend/src/server/routes/v1/certificate-router.ts+++ b/backend/src/server/routes/v1/certificate-router.ts@@ -7,6 +7,7 @@ import { EventType } from "@app/ee/services/audit-log/audit-log-types";import { ApiDocsTags, CERTIFICATES } from "@app/lib/api-docs";import { NotFoundError } from "@app/lib/errors";import { ms } from "@app/lib/ms";+import { isUuidV4 } from "@app/lib/validator";import { readLimit, writeLimit } from "@app/server/config/rateLimiter";import { addNoCacheHeaders } from "@app/server/lib/caching";import { openApiHidden } from "@app/server/lib/schemas";@@ -1649,8 +1650,9 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {}},handler: async (req) => {+ const { id: identifier } = req.params;const { revokedAt, cert, ca } = await server.services.certificate.revokeCert({- id: req.params.id,+ ...(isUuidV4(identifier) ? { id: identifier } : { thumbprint: identifier }),actor: req.permission.type,actorId: req.permission.id,actorAuthMethod: req.permission.authMethod,@@ -1688,70 +1690,6 @@ export const registerCertificateRouter = async (server: FastifyZodProvider) => {}});- server.route({- method: "POST",- url: "/revoke-by-thumbprint",- config: {- rateLimit: writeLimit- },- onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),- schema: {- hide: false,- operationId: "revokeCertificateByThumbprint",- tags: [ApiDocsTags.PkiCertificates],- description: "Revoke a certificate by its SHA-1 or SHA-256 thumbprint",- body: z.object({- thumbprint: z.string().trim().min(1).describe(CERTIFICATES.REVOKE_BY_THUMBPRINT.thumbprint),- revocationReason: z.nativeEnum(CrlReason).describe(CERTIFICATES.REVOKE_BY_THUMBPRINT.revocationReason)- }),- response: {- 200: z.object({- message: z.string().trim(),- serialNumber: z.string().trim().describe(CERTIFICATES.REVOKE_BY_THUMBPRINT.serialNumberRes),- revokedAt: z.date().describe(CERTIFICATES.REVOKE_BY_THUMBPRINT.revokedAt)- })- }- },- handler: async (req) => {- const { revokedAt, cert, ca } = await server.services.certificate.revokeCert({- thumbprint: req.body.thumbprint,- revocationReason: req.body.revocationReason,- actor: req.permission.type,- actorId: req.permission.id,- actorAuthMethod: req.permission.authMethod,- actorOrgId: req.permission.orgId- });-- await server.services.auditLog.createAuditLog({- ...req.auditLogInfo,- projectId: ca.projectId,- event: {- type: EventType.REVOKE_CERT,- metadata: {- certId: cert.id,- cn: cert.commonName,- serialNumber: cert.serialNumber- }- }- });-- await server.services.telemetry.sendPostHogEvents({- event: PostHogEventTypes.CertificateRevoked,- distinctId: getTelemetryDistinctId(req),- organizationId: req.permission.orgId,- properties: {- orgId: req.permission.orgId- }- });-- return {- message: "Successfully revoked certificate",- serialNumber: cert.serialNumber,- revokedAt- };- }- });-server.route({method: "DELETE",url: "/:id",diff --git a/docs/api-reference/endpoints/certificates/revoke-by-thumbprint.mdx b/docs/api-reference/endpoints/certificates/revoke-by-thumbprint.mdxdeleted file mode 100644index 4afefe1c77..0000000000--- a/docs/api-reference/endpoints/certificates/revoke-by-thumbprint.mdx+++ /dev/null@@ -1,4 +0,0 @@-----title: "Revoke by Thumbprint"-openapi: "POST /api/v1/cert-manager/certificates/revoke-by-thumbprint"----diff --git a/docs/docs.json b/docs/docs.jsonindex b7381cf168..8b541335a3 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -3103,7 +3103,6 @@"api-reference/endpoints/certificates/renew","api-reference/endpoints/certificates/update-config","api-reference/endpoints/certificates/revoke",- "api-reference/endpoints/certificates/revoke-by-thumbprint","api-reference/endpoints/certificates/delete","api-reference/endpoints/certificates/cert-body","api-reference/endpoints/certificates/bundle",