Skip to content

fix(auth): use session credentials for GET /tasks instead of client headers - #487

Open
WiseShrestha wants to merge 1 commit into
CCExtractor:mainfrom
WiseShrestha:fix/tasks-session-credentials
Open

WiseShrestha wants to merge 1 commit into
CCExtractor:mainfrom
WiseShrestha:fix/tasks-session-credentials

Conversation

@WiseShrestha

Copy link
Copy Markdown

Description

AuthMiddleware overwrote credentials with the session values only 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 (repro in #481).

The middleware now sets those three headers from the session on every authenticated request. TasksHandler and the frontend are unchanged; the POST body injection and the 401 for requests without a session work as before. /tasks already required a session since #408, so this does not change behaviour for clients without auth.

Checklist

  • Ran npx prettier --write . (for formatting): not applicable, no frontend changes
  • Ran gofmt -w . (for Go backend)
  • Ran npm test (for JS/TS testing): not applicable, no frontend changes
  • Added unit tests, if applicable
  • Verified all tests pass
  • Updated documentation, if needed: not needed

Additional Notes

  • New 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.
  • The CI backend job runs go test only in backend/, so it does not run ./middleware or ./controllers. Locally: go test ./middleware/ passes. Test_OAuthHandler in ./controllers already panics on main, unrelated to this change.
  • This change was written with the help of an AI coding assistant (Claude); I reviewed and tested it.

…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

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GET /tasks uses credentials from headers instead of the session

2 participants