Error() methods modify the request URL of the response they wrap
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 30/100
- Issue-Typ
- Bug
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- go
- Bereich
- backend-api-design
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Go
- Sterne
- 11.3k
- Forks
- 2.6k
- Ø Merge
- 2 T. 14 Std.
- Gemergte PRs (30 T.)
- 33
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus google/go-github
-
Add support for force-cancel and approve workflow run endpointsEvtl. vergeben @Shudharshan07 hat das heute übernommen. Offen
google/go-github#4661 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Rate-limit retry replays a consumed request body for POST/PUT/PATCHEvtl. vergeben @AdamMagued hat das heute übernommen. Offen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 70/100
google/go-github#4656 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
otel: redact sensitive query parameters before recording http.urlEvtl. vergeben @sai5880 hat das heute übernommen. Offen
Schwierigkeit 4/5 1-2 Tage Anfängerfreundlichkeit 55/100
Maintainer antworten meist innerhalb von 1 Tag
-
Add support for Copilot coding agent permissions APIEvtl. vergeben @ninadsutrave hat das vor 1 Tag übernommen. Offen
google/go-github#4650 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 5/100
google/go-github#4636 · 7 Kommentare · 3 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in google/go-github
Ähnliche Issues
-
Mend: dependency security vulnerability
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
kube-tarian/sigrun#202 ·
-
question raised-by:verifier
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
medici-finance/assay#4013 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
tsukumogami/tsuku#2775 ·
Maintainer antworten meist innerhalb von 1 Tag
-
automation models
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
Maintainer antworten meist innerhalb von 1 Tag