fix(auth): blank login page — allow Vite /assets/ bundles during login#31
Merged
Conversation
When authentication is enabled, login.html rendered blank: the page's own
JS/CSS bundles (served by Vite under /assets/ as hashed, often shared chunks)
were treated as auth-required and 302-redirected to login.html, so the browser
refused to load them ("MIME type text/html" for the module script).
is_allowed_during_login() still whitelisted the old webpack paths (/js/login.js,
/css/login.css, ...) which Vite no longer emits — a leftover from the Vite
migration that only surfaces with auth on. Allow /assets/ during login: these
are static client bundles with no protected data, and the app stays unusable
without the authenticated API (admin/index pages still redirect to login).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Symptom
With authentication enabled (e.g.
htpasswd),login.htmlrenders blank. Browser console shows:The login page's own bundles are being 302-redirected to
login.html?next=/assets/...instead of served.Root cause
is_allowed_during_login()(which exempts login-page resources from auth) still whitelists the old webpack paths —/js/login.js,/css/login.css,/img/...— that the Vite build no longer produces. Vite emits the login page's JS/CSS/fonts as hashed, often shared chunks under/assets/, none of which match the whitelist → they require auth → redirect to login → blank page.This is a leftover from the Vite migration and only surfaces when auth is on (so it was invisible in the auth-disabled dev config).
Fix
Allow
/assets/during login. These are static client bundles (no secrets, no protected data); the app stays unusable without the authenticated API, andindex.html/admin.htmlstill require auth and redirect to login.Verification
htpasswdconfig: before,/assets/login-*.js→ 302→login (blank); after, → 200 and the credentials form renders (verified with Playwright:hasForm: true,hasUserInput: true, container populated; no module-load errors).pytest src/tests/— 1744 passed (added/assets/*cases toweb_auth_utils_test.py;admin.htmlstill correctly prohibited).Note
Backend-only change; not a regression of the recent dark-mode login work (the dark-mode toggle itself renders fine once the bundles load).
🤖 Generated with Claude Code