fix: hide camelCase secrets in --dry-run and --debug output - #42
Closed
Bradenream wants to merge 3 commits into
Closed
Bradenream wants to merge 3 commits into
Bradenream wants to merge 3 commits into
Conversation
--dry-run and --debug print request and response bodies to stderr, and
hid only a fixed list of lowercase names: password, secret, token,
api_key and a few more. The Voiceflow API names its fields in camelCase,
so most of the secrets it carries printed in full:
- integration credentials: apiKeySecret, keySecret, secretKey,
oauthSecretKey, webhookSecret, webhookSecretKey, authHeaderValue
- a secret's value in secret create and set-value
- Authorization values in API tool and MCP server headers
Coding agents keep stderr in their transcripts.
The rule now comes from a survey of all 868 property names in the
OpenAPI spec:
- Names are compared without case or separators. Those ending in
secret, secretkey, password, token, apikey or privatekey are hidden,
which covers every name the old list had. Counts like maxTokens and
identifiers like accountSid, apiKeySid and keyId stay visible.
- credentials is hidden whole.
- A {key, value} pair whose key names a credential, such as an
Authorization header, hides its value.
- On the secret endpoints, defaultValue and value are hidden.
- Booleans, numbers and null are never hidden.
The rule lives in internal/client/redact.go. diagnostics.go calls it
from redactJSON and from both request-body previews.
4 of 5 tasks
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Credential-pair redaction incorrectly converts null, boolean, and numeric values into redaction strings.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Improves diagnostic redaction to prevent camelCase credentials and secret endpoint values from leaking through stderr.
Changes:
- Adds normalized, suffix-based secret detection.
- Redacts credential pairs and secret endpoint fields.
- Adds Go and CLI behavior tests.
| File | Description |
|---|---|
internal/client/redact.go |
Defines expanded redaction rules. |
internal/client/diagnostics.go |
Applies rules to diagnostic bodies. |
internal/client/redact_test.go |
Tests redaction logic. |
test/redaction.test.ts |
Tests CLI dry-run/debug output. |
Files not reviewed (1)
- internal/client/diagnostics.go: Generated file
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
A {key, value} pair whose key names a credential, such as an
Authorization header, had its value replaced whatever it held, so
{"key": "Authorization", "value": null} printed as "[REDACTED]". That
broke this change's own rule that booleans, numbers and null are never
hidden, and changed the value's JSON type. The pair now hides a value
only when it could hold a secret, as named fields already did. Copilot
raised this in review.
5 of 6 tasks
effervescentia
approved these changes
Oct 2, 2026
Contributor
Merge activity
|
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.

Summary
--dry-runand--debugprint request and response bodies to stderr. They hid only a fixed list of lowercase names:password,secret,token,api_keyand a few more. The Voiceflow API names its fields in camelCase, so most of the secrets it carries printed in full:apiKeySecret,keySecret,secretKey,oauthSecretKey,webhookSecret,webhookSecretKey,authHeaderValuesecret createandsecret set-valueAuthorizationvalues in API tool and MCP server headers. In responses this applies to API tool headers, which the API returns as saved; MCP header values come back already masked.Coding agents keep stderr in their transcripts, so a dry run or a debug run leaked these.
The rule now comes from a survey of all 868 property names in the OpenAPI spec (
internal/client/redact.go):secret,secretkey,password,token,apikeyorprivatekeyare hidden, which covers every name the old list had. Counts such asmaxTokensand identifiers such asaccountSid,apiKeySid,keyIdandaccessTokenIDstay visible.credentialsis hidden whole.{key, value}pair whose key names a credential, such as anAuthorizationheader, hides its value.defaultValueandvaluehidden. Elsewhere they stay visible, so a variable's default still shows.hasPassword: truestill shows.Before and after
hasPassword, which stays visible as a booleantest/redaction.test.ts(4--dry-runand 2--debugleak routes)Test plan
gofmt,go vet ./...andgo test ./...pass;go.modis unchanged.internal/client/redact_test.gocovers:Removing any of the three parts of the rule fails at least one test.
test/redaction.test.ts: each case sends a canary in a secret field, through--dry-runor through--debugagainst a local server, and checks the canary never reaches stderr while ordinary fields do. All 6 leak on master.Full suite with fix: restore vf docs search, and make the test suite hermetic and green #37 applied: 84/84. With fix: restore vf docs search, and make the test suite hermetic and green #37, fix: stop waiting on the silent stdin an agent's shell hands vf #38 and the other three fixes from this batch: 101/101.
CI:
CLI behaviourshows master's 4 existing failures until fix: restore vf docs search, and make the test suite hermetic and green #37 merges.#39 also edits
internal/client/diagnostics.go, and the two apply cleanly together.Not covered: if the API ever sent a malformed response, the SDK's own parse error could quote a raw field value. Only the API could cause that, so it is left as is.