Skip to content

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

Address claude comment

Carlos Monastyrskie30ce347704d
diff --git a/backend/src/server/plugins/inject-cert-manager-project-id.ts b/backend/src/server/plugins/inject-cert-manager-project-id.ts
index 31243a49e0..c6c18371f1 100644
--- a/backend/src/server/plugins/inject-cert-manager-project-id.ts
+++ b/backend/src/server/plugins/inject-cert-manager-project-id.ts
@@ -1,6 +1,8 @@
import { FastifyPluginAsync } from "fastify";
import fp from "fastify-plugin";
+import { BadRequestError } from "@app/lib/errors";
+
const CERT_MANAGER_PREFIXES = ["/api/v1/cert-manager/", "/api/v1/pki/", "/api/v2/pki/"];
const readProjectIdFromRequest = (req: { query?: unknown; body?: unknown; params?: unknown }): string | null => {
@@ -35,10 +37,10 @@ export const injectCertManagerProjectId: FastifyPluginAsync = fp(async (server)
try {
req.internalCertManagerProjectId = await server.services.certManagerProjectResolver.resolve(req.permission.orgId);
- } catch {
- // Leave internalCertManagerProjectId empty — endpoints that genuinely need it will surface their own
- // error at the service layer, and endpoints that infer the project from another entity (profileId,
- // certId, alertId, etc.) continue to work.
+ } catch (err) {
+ // Swallow only the resolver's expected "no project / no default" errors so endpoints that infer the
+ // project from another entity (profileId, certId, alertId, etc.) keep working.
+ if (!(err instanceof BadRequestError)) throw err;
}
});
});