Auth transports add credentials after cross-origin redirects
- Lingua principale
- Go
- Stelle
- 11.3k
- Fork
- 2.5k
- Merge medio
- 1g 20h
- PR unite (30g)
- 53
Descrizione
## Summary
`BasicAuthTransport` and `UnauthenticatedRateLimitedTransport` add credentials in `RoundTrip` for each outgoing request. When Go's `net/http` client follows a redirect to a different origin, the redirected request can pass through the same transport and receive those credentials again.
## Expected behavior
Credentials added by these transports should only be sent to the original origin. Redirected requests that cross origin should continue without these transport-managed credentials.
## Reproduction
This can be reproduced with two `httptest` servers: one server returns a redirect to a second server, and the second server records whether the redirected request contains the transport-added authorization headers.
## Proposed fix
PR #4364 avoids adding these credentials on cross-origin redirect requests and includes regression coverage for both affected transports.
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Inizia con BasicAuthTransport e UnauthenticatedRateLimitedTransport, in particolare con i relativi metodi RoundTrip, e riproduci il comportamento con due server httptest come descritto. Il lavoro è completato quando esiste una copertura di regressione per entrambi i transport e le richieste reindirizzate a un’origine diversa non contengono i relativi header di autorizzazione aggiunti dal transport.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- go
- Ambito
- backend-api-design, security
- Tipo di issue
- Bug
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 25/100