Skip to content

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

add an expiration check inside the transaction

adilsonc856859cea7e
diff --git a/backend/src/services/secret-access-approval-request-bridge/secret-access-approval-request-bridge-service.ts b/backend/src/services/secret-access-approval-request-bridge/secret-access-approval-request-bridge-service.ts
index e4c3a1331d..5c0e86af55 100644
--- a/backend/src/services/secret-access-approval-request-bridge/secret-access-approval-request-bridge-service.ts
+++ b/backend/src/services/secret-access-approval-request-bridge/secret-access-approval-request-bridge-service.ts
@@ -603,6 +603,10 @@ export const secretAccessApprovalRequestBridgeServiceFactory = ({
throw new BadRequestError({ message: "The request has been closed" });
}
+ if (locked.expiresAt && new Date(locked.expiresAt) < new Date()) {
+ throw new BadRequestError({ message: "This access request has expired and can no longer be reviewed" });
+ }
+
const steps = await approvalRequestStepsDAL.find({ requestId }, { tx, sort: [["stepNumber", "asc"]] });
const currentStepIndex = steps.findIndex((step) => step.stepNumber === locked.currentStep);
const currentStep = steps[currentStepIndex];