Error() methods modify the request URL of the response they wrap
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- go
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- Go
- Star
- 11.3k
- Fork
- 2.6k
- Merge trung bình
- 2 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 33
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của google/go-github
-
Add support for force-cancel and approve workflow run endpointsCó thể đã có người làm @Shudharshan07 đã nhận hôm nay. Đang mở
google/go-github#4661 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Rate-limit retry replays a consumed request body for POST/PUT/PATCHCó thể đã có người làm @AdamMagued đã nhận 1 ngày trước. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
google/go-github#4656 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
otel: redact sensitive query parameters before recording http.urlCó thể đã có người làm @sai5880 đã nhận 1 ngày trước. Đang mở
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add support for Copilot coding agent permissions APICó thể đã có người làm @ninadsutrave đã nhận 2 ngày trước. Đang mở
google/go-github#4650 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Discuss the future of this repoĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 5/100
google/go-github#4636 · 7 bình luận · 3 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của google/go-github
Issue tương tự
-
native
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
prime-radiant-inc/evener#4839 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
521xueweihan/HelloGitHub#4073 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
goharbor/terraform-provider-harbor#655 · 1 bình luận ·