Skip to content

Frontend should not attach Authorization header to /api/config/pre-login #5407

Closed

Description

@Yicong-Huang

What happened?

frontend/src/app/app.module.ts configures JwtModule.forRoot with disallowedRoutes: ["forum/api/users"], so every other request — including the anonymous pre-login config fetch — carries the localStorage JWT as Authorization: Bearer … whenever one is present.

/api/config/pre-login is @PermitAll by definition (returns flags needed to render the login page itself). When the stored token's signature can't be verified server-side — which happens after a backend signing-key rotation, manual localStorage tampering, or cross-deployment cookie bleed — the eager JwtAuthFilter from PR #5404 returns 401 + error="invalid_token" to the pre-login request.

GuiConfigService.loadPreLogin runs inside APP_INITIALIZER and has no retry on failure, so the entire SPA session is stuck without the config flags (localLogin, googleLogin, …) that the login form depends on. The login page renders without its form until the user manually reloads the tab.

The footgun is the auto-attach of Authorization to an endpoint that is by definition anonymous, not the backend's 401 policy.

How to reproduce?

  1. Open the app and inspect localStorage in DevTools.
  2. Set access_token to any JWT-shaped string whose header / payload decode but whose signature fails server-side verification — e.g. localStorage.setItem("access_token", "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJ4IiwidXNlcklkIjoxLCJyb2xlIjoiQURNSU4iLCJleHAiOjk5OTk5OTk5OTl9.bogus").
  3. Navigate to any route that triggers a full app bootstrap (e.g. open http://localhost:4200/about in a new tab).
  4. Observe: backend log shows GET /api/config/pre-login returning 401. The page header and "About" copy render but the login form (Sign In / Sign Up tabs, Username, Password inputs) is missing.
  5. Manually reload the tab — the interceptor's earlier logout cleared localStorage, so the second bootstrap fires pre-login anonymously, gets 200, and the form appears.

Branch

main

Commit Hash (Optional)

749798d (after PR #5392; the eager-401 backend in PR #5404 makes the regression user-visible but the root cause is the front-end auto-attach)

What browsers are you seeing the problem on?

  • Chrome / Chromium (verified via Playwright)

Relevant log output

INFO  org.eclipse.jetty.server.RequestLog: [0:0:0:0:0:0:0:1] - "GET /api/config/pre-login HTTP/1.1" 401
WARN  org.apache.texera.auth.JwtAuthFilter: Invalid JWT: Unable to parse token
ERROR Failed to load pre-login configuration: HttpErrorResponse
ERROR Failed to load GUI config during app init: Error: Failed to load pre-login configuration from backend: [object Object]

Activity

  1. added theissue type on Jun 6, 2026
  2. changed the issue type fromtoon Jun 6, 2026
  3. added a commit that references this issue on Jun 6, 2026
    1000d76
  4. added a commit that references this issue on Jun 7, 2026
    65aca57
  5. added a commit that references this issue on Jun 22, 2026
    70b1b4f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions