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
Merge branch 'feat/adilsitos/eng-4966-stack-2' into feat/adilsitos/eng-4966-stack-3
adilson795c75ebc696
diff --cc CLAUDE.mdindex 51c34b45a3,1cf042ada7..aa387f9a54--- a/CLAUDE.md+++ b/CLAUDE.md@@@ -50,6 -50,6 +50,7 @@@ Enterprise features live in `backend/sr### Self-Hosted DeploymentInfisical supports self-hosted deployment via Docker. Key considerations:++- **`Dockerfile.standalone-infisical`** — single-container image with both frontend and backend; used for simple deployments.- **`Dockerfile.fips.standalone-infisical`** — FIPS 140-2 compliant variant for regulated environments. Be strict about not introducing dependencies that break FIPS compliance.- **`docker-compose.prod.yml`** — production compose with backend, PostgreSQL, and Redis.@@@ -79,7 -79,7 +80,7 @@@ That list describes what the guide curr### Code Comments--**Default to no comments.** One earns its place only by explaining *why*: a non-obvious constraint, a workaround, an ordering dependency, or logic that looks wrong until you know the reason.++**Default to no comments.** One earns its place only by explaining _why_: a non-obvious constraint, a workaround, an ordering dependency, or logic that looks wrong until you know the reason.Never write: narration restating the next line; section headers inside a function (`// --- validation ---`); change history (`// Added retry logic`, `// NEW`); references to plans, tickets, PRs, or reviewers; docstrings restating the signature; commented-out code.@@@ -118,6 -118,6 +119,7 @@@ Secret Scanning has one active project### Service Factory + Manual DI (Backend)No IoC container in either backend. Every service is a factory function with explicit dependencies.++- **Node.js**: Wired in `backend/src/server/routes/index.ts` — see `backend/CLAUDE.md`.- **Go**: Wired in `backend-go/internal/server/api/api.go` via `NewRegistry()` — see `backend-go/CLAUDE.md`.@@@ -145,7 -145,7 +147,7 @@@ which every type now uses for policy CRendpoint**: `access-approval-*` and `secret-approval-*` predate this module and are what we areconverging away from. A product-facing service on top of it (PAM's `pam-access-request-service.ts`) isfor product vocabulary only: resolving the resource a request names, notifications, and read models.--Any rule about what is *allowed* belongs in the resource, or the product's own API and the shared API++Any rule about what is _allowed_ belongs in the resource, or the product's own API and the shared APIstop agreeing.A policy on the global approval system can hand its requests to a delegated approval system (ServiceNow)@@@ -172,24 -177,15 +179,24 @@@ one from Infisical: the requester, or apolicy blocked by pending requests is freed for editing. Every provider implements `TDelegatedApprovalProvider` against the same`TDelegatedApprovalDispatchInput` and registers in `DELEGATED_APPROVAL_PROVIDER_MAP`(`dispatch/providers/<name>/`); a new policy type adds an arm to `TDelegatedApprovalDispatchDetails` and a- builder in `DELEGATED_APPROVAL_DISPATCH_DETAILS_BUILDER_MAP` rather than branching in a provider. The worker- reads from the primary, never checks the license, and throws bullmq's `UnrecoverableError` for anything a retry- cannot fix. The callback contract (token issuance, the inbound route; approve / reject later) is its own+ builder in `DELEGATED_APPROVAL_DISPATCH_DETAILS_BUILDER_MAP` rather than branching in a provider. The consumer+ reads from the primary, never checks the license, and treats bullmq's `UnrecoverableError` as the terminal failure+ signal, returning `Failed` for it and `Retry` for anything else. The callback contract (token issuance now, the inbound route and approve / reject later) is its ownmodule, `backend/src/services/delegated-approval-callback/`, so the delegated approval module never grows a-callback branch. A request gets exactly one callback token for its whole life: it is random, issued on the first-dispatch attempt, and stored encrypted under the org KMS key in `encryptedCallbackToken` so every retry resends-the same value; the inbound side finds the row by the provider's record id and compares the decrypted token with-the presented one. Never send a provider a token that differs from the one stored for the request; the provider-keeps the first token it was given and cannot be told another, so a mismatch is unrecoverable.+callback branch. A request gets exactly one callback token for its whole life: it is random, prefixed `inf_ext_`,+issued on the first dispatch attempt, and stored encrypted under the org KMS key in `encryptedCallbackToken` so+every retry resends the same value. Never send a provider a token that differs from the one stored for the+request; the provider keeps the first token it was given and cannot be told another, so a mismatch is+unrecoverable. The provider calls `POST /api/v1/delegated-approvals/callback` (unauthenticated, IP rate limited)+with the token in the `Infisical-Approval-Token` header and a body naming the event and the provider's record id;+the body carries no decision, which a later worker reads back from the provider. The route finds the row by+`providerRequestId` (404 when none), counts the callback in `callbackAttempts` before checking anything else so a+wrong token for a known record still burns the request, and on the sixth callback sets the row `failed` with a+readable `statusReason` and cancels the attached approval request in the same transaction, so the policy is freed+and the UI stops offering Cancel. Every other refusal (bad or missing token, request not `waiting_approval`)+gets one neutral 403 while the reason goes to the log. An accepted callback only emits an outbox event: `eventType` is the body's event,+`idempotencyKey` is the delegated request id so a repeat is dropped, and the `delegated-approval-callback`+consumer is a placeholder that marks the row delivered until the read-back worker replaces it.### API Layer (Frontend)diff --cc backend/src/server/routes/index.tsindex 049880c8f2,b1b0730fec..9581b7b846--- a/backend/src/server/routes/index.ts+++ b/backend/src/server/routes/index.ts@@@ -3243,21 -3241,20 +3242,22 @@@ export const registerRoutes = asyncconst delegatedApprovalCallbackService = delegatedApprovalCallbackServiceFactory({delegatedApprovalRequestDAL,- kmsService+ approvalRequestDAL,+ kmsService,+ eventEmitter: eventOutboxService});- const delegatedApprovalDispatchQueue = delegatedApprovalDispatchQueueFactory({- delegatedApprovalRequestDAL,- delegatedApprovalPolicyDAL,- delegatedApprovalCallbackService,- approvalRequestDAL,- projectDAL,- appConnectionDAL,- kmsService,- queueService- });+ eventOutboxRegistry.register(+ delegatedApprovalDispatchConsumerFactory({+ delegatedApprovalRequestDAL,+ delegatedApprovalPolicyDAL,+ delegatedApprovalCallbackService,+ approvalRequestDAL,+ projectDAL,+ appConnectionDAL,+ kmsService+ })+ );const delegatedApprovalService = delegatedApprovalServiceFactory({delegatedApprovalPolicyDAL,