Skip to content

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

fix: address greptile review - add logging in logout catch block and maxAge: 0 on jid cookie

Devin AI7c169dad1cf1
diff --git a/backend/src/server/routes/v1/auth-router.ts b/backend/src/server/routes/v1/auth-router.ts
index f26fae3adb..db4c009963 100644
--- a/backend/src/server/routes/v1/auth-router.ts
+++ b/backend/src/server/routes/v1/auth-router.ts
@@ -28,16 +28,18 @@ export const registerAuthRoutes = async (server: FastifyZodProvider) => {
try {
const { decodedToken } = await server.services.authToken.validateRefreshToken(req.cookies.jid);
await server.services.login.logout(decodedToken.userId, decodedToken.tokenVersionId);
- } catch {
+ } catch (err) {
// If token validation fails (e.g. expired/malformed refresh token),
// we still proceed to clear all session cookies below.
+ req.log.warn(err, "Logout token validation failed; proceeding to clear cookies");
}
void res.cookie("jid", "", {
httpOnly: true,
path: "/",
sameSite: "strict",
- secure: appCfg.HTTPS_ENABLED
+ secure: appCfg.HTTPS_ENABLED,
+ maxAge: 0
});
void res.cookie("infisical-project-assume-privileges", "", {