#2102 Redact proxy credentials from worker logs - #2151
Merged
Merged
Conversation
rzo1
approved these changes
Sep 13, 2026
dpol1
approved these changes
Sep 15, 2026
dpol1
left a comment
Member
There was a problem hiding this comment.
LGTM. The String constructor still includes the rejected connection string in its exception; could we omit it there too, since it may contain credentials?
Findings flagged by Claude
… and add test for redaction
Contributor
Author
Addressed |
Contributor
|
thx @Riddhish1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Redact proxy credentials from worker logs
The problem
SCProxy.toString()included the proxy username and password when credentials were configured:HttpProtocolpassed this value toLOG.debug()for every proxied fetch. When DEBUG logging was enabled, proxy credentials were therefore written to worker logs and could be shipped to central log aggregation.These credentials may belong to paid third-party proxy services and should not be exposed to everyone with access to worker logs.
What this PR changes
Redact credentials in
SCProxy.toString()Authenticated proxies are now rendered as:
Unauthenticated proxies continue to render normally:
Proxy credentials remain available through
getUsername()andgetPassword()for the actual authentication flow. Equality and hashing are also unchanged because they operate directly on the proxy fields.Remove proxy stringification from OkHttp logging
The OkHttp protocol now logs only the proxy endpoint:
This prevents the logging path from depending on the proxy's rendered representation.
Compatibility impact
The rendered value of
SCProxy.toString()is no longer a credential-bearing connection string. This is intentional becausetoString()may be used implicitly by logging and diagnostics.No production code in this repository requires the full connection string from
toString(). Proxy construction and authentication continue to use the individual proxy getters.Tests
Updated the existing proxy tests to verify the redacted representation for authenticated proxies while preserving the existing endpoint format for unauthenticated proxies.
The tests also continue to verify that:
Verification
Result:
Also verified: