Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Error() methods modify the request URL of the response they wrap

Aperta
#4,651 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@AdamMagued ci sta già lavorando.

Dal 20/10/2026.

  • #4654 di @AdamMagued — aperta

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

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.URL no longer holds the URL that was sent, so code that reads or reuses it (for example to retry) gets REDACTED values.
  • 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

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 google/go-github

Tutte le issue di google/go-github

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.