Skip to content

Commit 021cd9e

Browse files
Potential fix for code scanning alert no. 163: Clear text storage of sensitive information
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
1 parent 9dd29d0 commit 021cd9e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

apps/api/src/auth/auth.controller.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,13 @@ export class AuthController {
134134
profile,
135135
);
136136

137-
// Set HTTP-only cookie - in monorepo deployment, this cookie works directly
138-
// since frontend and API are on the same domain
139-
res.cookie('access_token', result.access_token, COOKIE_OPTIONS);
137+
// Set HTTP-only cookie with an opaque session identifier instead of the raw access token.
138+
// The session identifier should be mapped server-side to the actual access token.
139+
res.cookie('access_token', result.sessionId, COOKIE_OPTIONS);
140140

141141
// Redirect to frontend callback page
142-
// Token in URL is kept for backward compatibility and as fallback
143-
res.redirect(`${frontendUrl}/auth/callback?token=${result.access_token}`);
142+
// Session identifier in URL is kept for backward compatibility and as fallback
143+
res.redirect(`${frontendUrl}/auth/callback?token=${result.sessionId}`);
144144
} catch (error) {
145145
if (
146146
error instanceof UnauthorizedException &&

0 commit comments

Comments
 (0)