Repository navigation
Conversation
#get_token passes the params to Faraday as a Hash. The debug logger is added before :url_encoded, so it prints the request body with #pretty_inspect, and the sanitized logger, which only redacts JSON and form-encoded pairs, leaves the client secret, the code verifier and the refresh token in the output.
This branch has not been deployed
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.
With
OAUTH_DEBUG=true, secrets from the request body of#get_tokenandAccessToken#refresh!end up in the debug log:client_secret(withauth_scheme: :request_body),code_verifier, andrefresh_token. These specs reproduce it through the real client calls and currently fail.This happens because
#get_tokenpasses the params to Faraday as aHash, and the debug logger is added before:url_encoded. So Faraday logs the body via#pretty_inspect, like{"client_secret" => "..."}.SanitizedLoggeronly redacts theAuthorizationheader, JSON pairs, andkey=valuepairs, so this format slips through. The existing form-encoded spec doesn't catch it because it passes an already-encoded string toclient.request.This could be fixed by making
SanitizedLoggeralso redact RubyHash#inspectoutput ("key" => "value",key: "value",:key=>"value"). That way it works regardless of the middleware order or a customconnection_build. On top of that, the default connection could add the logger after:url_encoded, so the log shows the real encoded body.