Redact sensitive data from logging#906
Conversation
2611048 to
5856e92
Compare
5856e92 to
3d05ce6
Compare
|
There is different ticket to fix https://github.com/linode/linodego/security/code-scanning/16, which is being reported here. |
There was a problem hiding this comment.
Pull request overview
This PR standardizes sensitive-header redaction across both Resty debug logging hooks and the package’s internal httpClient request/response logging, ensuring secrets (e.g., Authorization tokens) do not appear in logs.
Changes:
- Introduces a shared redaction map (
redactHeadersMap) and aredactHeadershelper for sanitizing logged headers. - Applies header redaction to internal
httpClientrequest/response logging output. - Expands test coverage for header redaction and log sanitization behavior.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| client.go | Adds shared redaction configuration + helper, and uses it in request/response logging and Resty log hooks. |
| client_test.go | Adds unit tests for header redaction and an integration-style test ensuring logs don’t contain raw tokens. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
📝 Description
This PR unifies obfuscation of sensitive data on Resty and logRequest/Response levels by redacting sensitive values.
✔️ How to Test
go test -v -run TestEnableLogSanitization ./...go test -v -run TestRedactHeaders ./...