Skip to content

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

bind for every session

Thiago Araujo da Silvaf44d1a5e08ae
diff --git a/backend/src/services/mfa-session/mfa-session-service.ts b/backend/src/services/mfa-session/mfa-session-service.ts
index 15b62e1f05..2225e1b22d 100644
--- a/backend/src/services/mfa-session/mfa-session-service.ts
+++ b/backend/src/services/mfa-session/mfa-session-service.ts
@@ -76,7 +76,7 @@ export const mfaSessionServiceFactory = ({
return false;
}
- if (resourceId === MfaStepUpResource.MfaManagement && mfaSession.initiatingTokenVersionId !== tokenVersionId) {
+ if (mfaSession.initiatingTokenVersionId && mfaSession.initiatingTokenVersionId !== tokenVersionId) {
return false;
}
@@ -147,10 +147,7 @@ export const mfaSessionServiceFactory = ({
});
}
- if (
- mfaSession.resourceId === MfaStepUpResource.MfaManagement &&
- mfaSession.initiatingTokenVersionId !== tokenVersionId
- ) {
+ if (mfaSession.initiatingTokenVersionId && mfaSession.initiatingTokenVersionId !== tokenVersionId) {
throw new ForbiddenRequestError({
message: "MFA session does not belong to current session"
});
@@ -224,10 +221,7 @@ export const mfaSessionServiceFactory = ({
});
}
- if (
- mfaSession.resourceId === MfaStepUpResource.MfaManagement &&
- mfaSession.initiatingTokenVersionId !== tokenVersionId
- ) {
+ if (mfaSession.initiatingTokenVersionId && mfaSession.initiatingTokenVersionId !== tokenVersionId) {
throw new ForbiddenRequestError({
message: "MFA session does not belong to current session"
});
diff --git a/backend/src/services/mfa-session/mfa-session-types.ts b/backend/src/services/mfa-session/mfa-session-types.ts
index f5f5ede80e..7188c390f9 100644
--- a/backend/src/services/mfa-session/mfa-session-types.ts
+++ b/backend/src/services/mfa-session/mfa-session-types.ts
@@ -18,11 +18,6 @@ export type TMfaSession = {
resourceId: string; // Generic - can be accountId, documentId, etc.
status: MfaSessionStatus;
mfaMethod: MfaMethod;
- // The login session (tokenVersionId) that INITIATED this step-up. Only set for
- // MFA-management step-ups; it binds verification, status polling, and consumption
- // to the initiating session so a challenge initiated by one session cannot be
- // completed by another (e.g. tricking a victim into finishing a stolen session's
- // challenge). Undefined for PAM sessions, which are account-scoped and unaffected.
initiatingTokenVersionId?: string;
};