Error() methods modify the request URL of the response they wrap
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 30/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- go
- Ambito
- backend-api-design
Direzione di ricerca
The issue identifies sanitizeURL in github/github.go and the Error() methods that pass it request URLs. Start by reading sanitizeURL and inspect the existing tests for these error types. Done means formatting the errors leaves the original URL unchanged, with a test covering that behavior; a linked pull request is already open.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
sanitizeURL in github/github.go updates uri.RawQuery on the *url.URL it receives. ErrorResponse.Error(), RateLimitError.Error(), AbuseRateLimitError.Error() and RedirectionError.Error() pass it r.Response.Request.URL (and r.Location) directly, so just formatting the error rewrites the caller's request URL.
u, _ := url.Parse("https://api.github.com/x?access_token=secret")
e := &github.ErrorResponse{Response: &http.Response{Request: &http.Request{Method: "GET", URL: u}, StatusCode: 404}}
_ = e.Error()
fmt.Println(u) // https://api.github.com/x?access_token=REDACTED
Effects:
- After an error is logged,
resp.Request.URLno longer holds the URL that was sent, so code that reads or reuses it (for example to retry) getsREDACTEDvalues. - Calling
Error()on the same error from two goroutines is a data race, because a "read-only" method writes to shared state.
Proposed fix: have sanitizeURL redact a copy of the URL and leave the input alone, plus a test that checks the input is unchanged.
I'm planning to work on this and send a PR, if it can be assigned to me.
AI disclosure: an AI tool helped find this and write this issue.
- Lingua principale
- Go
- Stelle
- 11.3k
- Fork
- 2.6k
- Merge medio
- 2g 8h
- PR unite (30g)
- 38
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di google/go-github
-
Rate-limit retry replays a consumed request body for POST/PUT/PATCHForse già presa @AdamMagued l’ha presa 2 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 70/100
google/go-github#4656 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
otel: redact sensitive query parameters before recording http.urlForse già presa @sai5880 l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 5/100
google/go-github#4636 · 11 commenti · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
http.Client.Timeout is ignored by redirect-aware requestsForse già presa @sb123sb123 l’ha presa 32 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Add Copilot content exclusion set/get enterprise and org set endpointsForse già presa @Tens1des l’ha presa 46 giorni fa. Aperta
google/go-github#4526 · 1 commento · 1 reazione · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di google/go-github
Issue simili
-
compress: block buffers get re-zeroed on every call, and the zeroing is immediately overwrittenAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ClickHouse/ch-go#1218 ·
I maintainer di solito rispondono entro 13 giorni
-
effort:s impact:low raised-by:reviewer risk:low
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
medici-finance/assay#4251 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
automation models
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
golang-migrate/migrate#1457 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
I maintainer di solito rispondono entro 1 giorno