Repository navigation
test(secrets): Cover the key-header decoy in the miss text of a run with the token - #51
Merged
Merged
Conversation
…ith the token
A run with the write token redacts the text of a miss on the main
thread. That path must pass the rule, so only the body is checked. With
`{}` in place of the rule, the key header stands in for the password
field, and the miss gets a change with the password.
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.
Adds one test to
packages/service/tests/redaction.test.ts. No code changes.#47 made the main-thread miss path for write-token runs (
recorder.ts,redactedText) pass the rule tosecrets.redactRequest. No test failed when that rule was dropped, so nothing guarded it.The test: "does not let a key header take the place of a form field in the text of a miss"
autorun with the write token recordsnote=y&password=hunter2-SECRET-xyzwithx-trace: b. Its sample keeps its text.replayrun with the token sendsnote=x&password=hunter2-SECRET-xyzwithx-trace: a&password=<<redacted>>. The rule hasvalues: {v: "x&"}andkeyHeaders: ["x-trace"].missedwith nochange, and neither the recording nor the request sample may containSECRET. The recorder setsmiss.requestonly when the miss has a change, so this also keeps the password out of themiss.requestspan attribute.Checked on Node 24.22.2:
pnpm checkandpnpm test:coveragepass, with 107 tests. WhenredactRequest(keyed.text, request, rule)changes toredactRequest(keyed.text, request, {}), the test fails withexpected { …(2) } to be undefined: the miss gets a change, and its text keeps the password.via @dcramer.
--
View Session [Sentry]