Skip to content

fix: hide credentials in response bodies, with --show-secrets to opt out - #19

Merged
AustinMusiku merged 4 commits into
masterfrom
hide-body-secrets
Nov 10, 2026
Merged

AustinMusiku merged 4 commits into
masterfrom
hide-body-secrets

Conversation

@AustinMusiku

Copy link
Copy Markdown
Owner

--show-body (v0.11.0) printed the token that request_headers hides. In a login flow, the account request showed Authorization: Bearer xxxxx, and the login body right above it held the same token in plain text. An agent run reported it, and was filtering access_token out itself before printing or saving anything.

Bodies now hide credentials the same way the headers do, and --show-secrets turns all hiding off for when the real values are needed.

default
  login    body {"access_token":"xxxxx","refresh_token":"r-9f2c41"}
  account  Authorization Bearer xxxxx   body {"you_sent":"Bearer xxxxx"}
--show-secrets
  login    body {"access_token":"eyJhbGci...c2ln","refresh_token":"r-9f2c41"}
  account  Authorization Bearer eyJhbGci...c2ln   body {"you_sent":"Bearer eyJhbGci...c2ln"}

What a body hides

Exact values of 8 characters or more, shown as xxxxx, so a cookie like lang=en doesn't hide every en:

  • The request's own credentials: its Authorization and Proxy-Authorization (after the scheme), its Cookie values and its URL password. This covers servers that echo the request back, like httpbin's /headers.
  • The response's Set-Cookie values.
  • Values that later steps send as credentials: the .http loader notes each {{name.response...}} ref inside an Authorization, Proxy-Authorization or Cookie header, file variables included. It hands the step that ref points to a Secrets function, which the collector runs on that step's response and passes on as record.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

  • Requests: masking happens only when output is written. Steps are still built from the real body, so {{login.response.body.access_token}} sends the real token.
  • Secrets that nothing sends: a refresh_token that no request sends still shows. The README, help and SKILL.md say so.

--show-secrets

  • Turns off every redaction at once: request_headers, url, location, bodies and the waterfall's URL labels. render.JSON now takes render.Options for this.
  • Read from the command line only, like -k, so no config file or TIMELINE_* variable can turn it on. A test checks TIMELINE_SHOW_SECRETS=true has no effect.
  • SKILL.md tells agents to pass tokens with {{...}} rather than copying them out of the output. It suggests --show-secrets for cases like decoding a JWT's exp after a 401, and says not to save that output.

Each commit passes go vet and go test -race on 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.

Copilot AI balanced review requested due to automatic review settings November 10, 2026 13:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@AustinMusiku
AustinMusiku merged commit 4fd1eab into master Nov 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants