GET /tasks uses credentials from headers instead of the session

Aberta
#481 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
55/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
go

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
36
Forks
76
Merge médio
11d 28min
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de CCExtractor/ccsync

Todas as issues de CCExtractor/ccsync

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.