Repository navigation
fix(auth): use session credentials for GET /tasks instead of client headers - #487
Open
WiseShrestha wants to merge 1 commit into
Open
WiseShrestha wants to merge 1 commit into
WiseShrestha wants to merge 1 commit into
Conversation
…eaders AuthMiddleware only overwrote credentials in POST bodies, so GET /tasks still used whatever X-User-Email, X-User-UUID and X-Encryption-Secret headers the client sent, even when they belonged to another user. The middleware now sets those headers from the session on every authenticated request. TasksHandler and the frontend are unchanged, and the POST body injection and the 401 for requests without a session work as before. Adds middleware tests for the GET case from the issue, the POST body overwrite, and the missing-session 401. Fixes CCExtractor#481 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013TjiucazWUjDoYj1dsAmKB
This branch has not been deployed
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.
Description
AuthMiddlewareoverwrote credentials with the session values only in POST bodies, soGET /tasksstill used whateverX-User-Email,X-User-UUIDandX-Encryption-Secretheaders the client sent, even when they belonged to another user (repro in #481).The middleware now sets those three headers from the session on every authenticated request.
TasksHandlerand the frontend are unchanged; the POST body injection and the 401 for requests without a session work as before./tasksalready required a session since #408, so this does not change behaviour for clients without auth.Checklist
npx prettier --write .(for formatting): not applicable, no frontend changesgofmt -w .(for Go backend)npm test(for JS/TS testing): not applicable, no frontend changesAdditional Notes
backend/middleware/auth_test.go(the first tests for this middleware): the GET case from the issue (logged in as A, headers for B, handler sees A), GET with no headers, the POST body overwrite, and the missing-session 401. The two GET tests fail without the fix.go testonly inbackend/, so it does not run./middlewareor./controllers. Locally:go test ./middleware/passes.Test_OAuthHandlerin./controllersalready panics onmain, unrelated to this change.