Repository navigation
fix: hide credentials in response bodies, with --show-secrets to opt out - #19
Merged
Merged
Conversation
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.
--show-body(v0.11.0) printed the token thatrequest_headershides. In a login flow, the account request showedAuthorization: Bearer xxxxx, and the login body right above it held the same token in plain text. An agent run reported it, and was filteringaccess_tokenout itself before printing or saving anything.Bodies now hide credentials the same way the headers do, and
--show-secretsturns all hiding off for when the real values are needed.What a body hides
Exact values of 8 characters or more, shown as
xxxxx, so a cookie likelang=endoesn't hide everyen:AuthorizationandProxy-Authorization(after the scheme), itsCookievalues and its URL password. This covers servers that echo the request back, like httpbin's/headers.Set-Cookievalues..httploader notes each{{name.response...}}ref inside anAuthorization,Proxy-AuthorizationorCookieheader, file variables included. It hands the step that ref points to aSecretsfunction, which the collector runs on that step's response and passes on asrecord.Content.Hide. That covers the login token, even though login's line is written before account is built.Each value is also matched in its JSON-escaped forms, including
\/, and longer values are matched first.What it doesn't change
{{login.response.body.access_token}}sends the real token.refresh_tokenthat no request sends still shows. The README, help and SKILL.md say so.--show-secretsrequest_headers,url,location, bodies and the waterfall's URL labels.render.JSONnow takesrender.Optionsfor this.-k, so no config file orTIMELINE_*variable can turn it on. A test checksTIMELINE_SHOW_SECRETS=truehas no effect.{{...}}rather than copying them out of the output. It suggests--show-secretsfor cases like decoding a JWT'sexpafter a 401, and says not to save that output.Each commit passes
go vetandgo test -raceon its own. The built binary also ran a login flow against a local server, with and without--show-secrets, and showed a URL password in the waterfall.