GET /tasks uses credentials from headers instead of the session

Aperta
#481 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Start from the AuthMiddleware wiring and the GET /tasks handler described in main.go, then read the referenced #338 discussion to see whether the mobile-app exception is meant to cover this route. Reproduce with a small Go test using the same AuthMiddleware → TasksHandler chain and a session for user A plus user B's X-User-* headers. Done means /tasks uses the session credentials like the POST endpoints and a test covers the mismatched-header case.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Describe the bug
After #408, AuthMiddleware overwrites email, UUID and encryptionSecret with the session values, but only for POST bodies. GET /tasks still reads them from the X-User-Email, X-User-UUID and X-Encryption-Secret headers, which the middleware doesn't touch. So whatever the client sends is used, even if it doesn't match the logged-in user.

To Reproduce

  1. Log in as user A.
  2. Call GET /tasks with user B's values in the X-User-* headers.
  3. It returns 200 and the fetch runs with user B's credentials.

I checked this with a small Go test using the same wiring as main.go (AuthMiddleware → TasksHandler).

Expected behavior
/tasks should use the session credentials, same as the POST endpoints.

Additional context
A possible fix is to set the X-User-* headers from the session in AuthMiddleware for GET requests. I know from #338 that some of this is intentional for the mobile app, so I wanted to check first: should /tasks follow the same rule as the other endpoints? Happy to open a PR if so.

Lingua principale
TypeScript
Stelle
36
Fork
76
Merge medio
11g 28m
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di CCExtractor/ccsync

Tutte le issue di CCExtractor/ccsync

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.