Repository navigation
fix(web): keep the session on auth 401s and pin the API tests - #888
Merged
Merged
Conversation
- apiFetch treats a 401 from /auth/* as bad credentials, not as an expired session: the session is kept and the server message is exposed instead of reloading /login. - Test the openSSE constructor wiring, the login 401 path, the absence of Content-Type on the three FormData uploads, and broaden the direct network check to window/globalThis/self fetch, XMLHttpRequest, EventSource and sendBeacon in .js, .mjs, .cjs and .jsx files.
- change-password returns 403 for a wrong current password and keeps 401 for an invalid or expired session, like authInit's bad setup token. - apiFetch only treats a 401 from /auth/login as bad credentials; every other 401 clears the session and returns to /login. - Tests cover change-password with an expired session and with a wrong current password, and the direct-network check parses the AST so comments, strings and test files cannot produce false positives.
BaaRai
force-pushed
the
fix/web-auth-401-followup
branch
from
December 3, 2026 00:20
81e4091 to
15f1b1b
Compare
- Test the 401 login fallback when the body is not JSON. - Flag bare sendBeacon calls and parse .js, .mjs and .cjs as JavaScript. - Record the change-password 403 in the CHANGELOG.
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.
Follow-up to #883.
apiFetchonly treats a 401 from/auth/loginas bad credentials. Every other 401 clears the session and returns to/login.POST /api/auth/change-passwordreturns 403 for a wrong current password and keeps 401 for an invalid or expired session, so a typo does not log the operator out and an expired session does. The CHANGELOG records the API status change.openSSEconstructor wiring, the absence ofContent-Typeon the threeFormDatauploads, and the direct-network check parses the AST so comments, strings and test files cannot produce false positives.Tests:
test:auth38/38,test:upload7/7,test:sse10/10,tsc --noEmitclean,go vet ./serverclean,TestChangePasswordpasses.