Skip to content

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

fix(identity-access-token): ensure revocation version bump on direct membership deletions

Victor Hugo dos Santos42d9c685fd91
diff --git a/backend/e2e-test/routes/v1/identity-access-token-redesign.spec.ts b/backend/e2e-test/routes/v1/identity-access-token-redesign.spec.ts
index 12c6badc56..6f70c5526f 100644
--- a/backend/e2e-test/routes/v1/identity-access-token-redesign.spec.ts
+++ b/backend/e2e-test/routes/v1/identity-access-token-redesign.spec.ts
@@ -16,6 +16,7 @@ import jwt from "jsonwebtoken";
import { AccessScope, IdentityAuthMethod, OrgMembershipRole, TableName } from "@app/db/schemas";
import { seedData1 } from "@app/db/seed-data";
+import { KeyStorePrefixes } from "@app/keystore/keystore";
import { AuthTokenType } from "@app/services/auth/auth-type";
// ---------------------------------------------------------------------------
@@ -126,6 +127,13 @@ const deleteOrgIdentityMembership = async (identityId: string) => {
await testDb(TableName.MembershipRole).where({ membershipId: membership.id }).delete();
await testDb(TableName.Membership).where({ id: membership.id }).delete();
+
+ // The real removal paths (membershipIdentityService.deleteMembership,
+ // identityV1.deleteIdentity sub-org branch) bump the identity's revocation
+ // version so cached "allow" verdicts are rechecked once against Postgres. This
+ // helper mutates the row directly, so mirror that bump here — otherwise the
+ // cache-gated membership check keeps serving the stale allow until the TTL.
+ await testRedis.incr(KeyStorePrefixes.IdentityRevocationVersion(identityId));
};
const waitForRevocationRow = async (tokenId: string) => {