Skip to content

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

Convert to UTC

Fang-Pen Lin9ab27eef6e37
diff --git a/backend/src/services/identity-access-token/identity-access-token-dal.ts b/backend/src/services/identity-access-token/identity-access-token-dal.ts
index 29b12ceb3d..46702d7fe1 100644
--- a/backend/src/services/identity-access-token/identity-access-token-dal.ts
+++ b/backend/src/services/identity-access-token/identity-access-token-dal.ts
@@ -60,17 +60,17 @@ export const identityAccessTokenDALFactory = (db: TDbClient) => {
`
-- Check if the token's effective expiration time has passed.
-- The expiration time is calculated by adding its TTL to its last renewal/creation time.
- COALESCE(
+ (COALESCE(
"${TableName.IdentityAccessToken}"."accessTokenLastRenewedAt", -- Use last renewal time if available
"${TableName.IdentityAccessToken}"."createdAt" -- Otherwise, use creation time
- )
+ ) AT TIME ZONE 'UTC') + -- Convert to UTC so that it can be an immutable function for our expression index
+ make_interval(
secs => LEAST(
"${TableName.IdentityAccessToken}"."accessTokenTTL", -- Token's specified TTL
? -- Capped by MAX_TTL (parameterized value)
)
)
- < NOW() -- Check if the calculated time is before now
+ < NOW() AT TIME ZONE 'UTC' -- Check if the calculated time is before now (converted to UTC)
`,
[MAX_TTL]
);