Repository navigation
fix(flow): withhold secrets and tokens in JSON bodies and headers from network capture - #1367
Merged
Merged
Conversation
…m network capture Review of #1269: redaction found secret and token names only in form fields and URL queries, so a JSON login body ({"password": ...}) kept the password, and a token that only a response carried (a login's access_token) was missed. - Names are now found in JSON request and response bodies at any depth. A JSON body's password-like or token-like field is replaced field by field, whatever its length; every value found is then withheld wherever else it appears. - Set-Cookie values and Authorization credentials are kept in memory and withheld wherever traffic echoes them (<session:cookie>, <session:authorization>). - The name patterns cover session, api_key, jwt, bearer, authorization, passphrase, private_key, and exactly pin, otp, sid and auth. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gitleaks flagged two of the literals in the first commit; they are pinned in .gitleaksignore by commit, file, rule and line, as other reviewed test literals are, and are no longer literals. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
First of six fixes from an external review of #1269 (the API step). This is the security one. It is independent of the API-step stack and targets
main.Bug
network_capture.redactfound secret and token names only in form fields and URL queries. As a result:{"user": {"password": ...}}) kept the password innetwork.jsonl;access_token, aSet-Cookievalue) was missed wherever later traffic echoed it.Fix
Set-Cookievalues andAuthorizationcredentials are kept in memory only, and withheld wherever a body, URL or script echoes them (<session:cookie>,<session:authorization>). Headers are still never written.session,api_key,jwt,bearer,authorization,passphraseandprivate_key, plus exactlypin,otp,sidandauth.NETWORK_CAPTURE.md(the file contract) andAPI_TIER.mdare updated.Tests
tests/test_network_capture_redact_json.py(new) runs a synthetic JSON login through the realNetworkCapturepath intonetwork.jsonl:Set-Cookievalue or bearer credential survives anywhere;secretis withheld by its field name;All three tests fail on
main. The existing capture, proposal and actuator tests still pass (34 with the new ones).Synthetic values only.
🤖 Generated with Claude Code