Skip to content

Fix/issue 2339 secure token architecture#2345

Merged
janavipandole merged 3 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2339-secure-token-architecture
Jun 20, 2026
Merged

Fix/issue 2339 secure token architecture#2345
janavipandole merged 3 commits into
janavipandole:mainfrom
Prateek2007-cmd:fix/issue-2339-secure-token-architecture

Conversation

@Prateek2007-cmd

Copy link
Copy Markdown
Contributor

Description

Resolves Issue #2339 (Long-lived Access Tokens & Missing Revocation) and natively remediates XSS Token Extraction vulnerabilities.

Previously, the authentication system issued 7-day long-lived access tokens and stored them in localStorage. This meant an XSS attack could easily steal the token, granting an attacker a full week of access with no ability for the user to revoke it.

This PR overhauls the token architecture to use short-lived access tokens and secure refresh tokens via HttpOnly cookies.

Changes Made

  • Access + Refresh Tokens: Reduced access token TTL from 7 days to 15 minutes. Implemented a 7-day refresh token.
  • HttpOnly Cookies: Refactored auth.py to issue tokens exclusively via HttpOnly, Secure, SameSite=Lax cookies, rendering them immune to JavaScript extraction (XSS).
  • Session Revocation: Added a POST /api/auth/logout endpoint to instantly destroy the authentication cookies, properly terminating the session.
  • Frontend Refactor: Purged insecure localStorage.setItem("token") usage from login.js and register.js.

Type of Change

  • Security Fix
  • Architectural Overhaul

@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown

@Prateek2007-cmd is attempting to deploy a commit to the janavipandole's projects Team on Vercel.

A member of the Team first needs to authorize it.

@janavipandole janavipandole merged commit 6985ac8 into janavipandole:main Jun 20, 2026
12 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants