Skip to content

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

fix(acme): add GET /new-nonce support per RFC 8555 (#5776)

Saif Ur Rahmanb1f77ba1de67
diff --git a/backend/src/ee/routes/v1/pki-acme-router.ts b/backend/src/ee/routes/v1/pki-acme-router.ts
index cf99ad116b..3effecef1c 100644
--- a/backend/src/ee/routes/v1/pki-acme-router.ts
+++ b/backend/src/ee/routes/v1/pki-acme-router.ts
@@ -100,8 +100,8 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
handler: async (req) => server.services.pkiAcme.getAcmeDirectory(req.params.profileId)
});
- // HEAD /api/v1/cert-manager/acme/profiles/<profile_id>/new-nonce
- // New Nonce (RFC 8555 Section 7.2)
+ // HEAD & GET /api/v1/cert-manager/acme/profiles/<profile_id>/new-nonce
+ // New Nonce (RFC 8555 Section 7.2) - HEAD returns 200, GET returns 204
server.route({
method: "HEAD",
url: "/profiles/:profileId/new-nonce",
@@ -123,10 +123,36 @@ export const registerPkiAcmeRouter = async (server: FastifyZodProvider) => {
handler: async (req, res) => {
const nonce = await server.services.pkiAcme.getAcmeNewNonce(req.params.profileId);
res.header("Replay-Nonce", nonce);
+ res.header("Cache-Control", "no-store");
return "";
}
});
+ server.route({
+ method: "GET",
+ url: "/profiles/:profileId/new-nonce",
+ config: {
+ rateLimit: readLimit
+ },
+ schema: {
+ hide: false,
+ tags: [ApiDocsTags.PkiAcme],
+ description: "ACME New Nonce (GET) - generate a new nonce and return in Replay-Nonce header with 204 No Content",
+ params: z.object({
+ profileId: z.string().uuid()
+ }),
+ response: {
+ 204: z.string().length(0)
+ }
+ },
+ handler: async (req, res) => {
+ const nonce = await server.services.pkiAcme.getAcmeNewNonce(req.params.profileId);
+ res.header("Replay-Nonce", nonce);
+ res.header("Cache-Control", "no-store");
+ return res.status(204).send();
+ }
+ });
+
// POST /api/v1/cert-manager/acme/profiles/<profile_id>/new-account
// New Account (RFC 8555 Section 7.3)
server.route({