mirror of
https://gitea.com/gitea/tea.git
synced 2026-10-26 11:01:25 +01:00
fix(transport): keep harmless query values visible in --debug output
--debug replaced every query value with REDACTED, so it could not show which filters were sent. Redact only parameters that can authenticate a request (tokens, passwords, secrets, signatures, storage credentials, OAuth codes and the OAuth state), and log the sanitized server message of failed responses. A 404 now names the request instead of blaming the instance, and API errors recorded from a request keep its instance and credential so a caller can look up why it failed. Network failures keep the server they could not reach. Signed-off-by: bircni <bircni@icloud.com>
This commit is contained in:
7 files changed
+225
-17
No files matched your search
@@ -54,7 +54,9 @@ func (t captureTransport) RoundTrip(req *http.Request) (*http.Response, error) {
|
||||
return resp, err
|
||||
}
|
||||
data, _ := io.ReadAll(io.LimitReader(resp.Body, maxErrorBody))
|
||||
holder.Store(newAPIError(resp.StatusCode, req.Method, req.URL.Path, t.token, data))
|
||||
failure := newAPIError(resp.StatusCode, req.Method, req.URL.Path, t.token, data)
|
||||
failure.bind(req.URL, t.base)
|
||||
holder.Store(failure)
|
||||
resp.Body = struct {
|
||||
io.Reader
|
||||
io.Closer
|
||||
|
||||
Reference in new issue
Block a user