Repository navigation
feat(reporters): add secrets option to redact sensitive values - #43334
Merged
Dmitry Gozman (dgozman) merged 2 commits intoOct 14, 2026
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Pavel Feldman (pavelfeldman)
approved these changes
Oct 13, 2026
- secrets is a list of { name?, value }
- extract wrapReportersWithSecrets()
- drop config validation, use Map instead of WeakMap
Dmitry Gozman (dgozman)
force-pushed
the
reporter-secrets
branch
from
October 14, 2026 16:25
30e4feb to
be6785b
Compare
Contributor
Test results for "tests 1"2 flaky21778 passed, 523 skipped Merge workflow run. |
Contributor
Test results for "MCP"1 failed 9203 passed, 1495 skipped Merge workflow run. |
Contributor
|
Hi, I'm the Playwright bot and I took a first look at the CI failure. 🟢 The failure is a confirmed pre-existing flakeThe PR is clear. The same Windows/Firefox idle-timeout test and error have failed repeatedly on DetailsThe only real failure is in MCP browser lifecycle handling. This PR changes test reporter redaction and does not modify the MCP idle timer, browser backend, or Firefox lifecycle code. Pre-existing flake / infra
Triaged by the Playwright bot - agent run |
aragossa
added a commit
to pii-shield/trace-scrub
that referenced
this pull request
Oct 23, 2026
…the stand README: the maintainers did ship masking (microsoft/playwright#43334, #43423, #43220); say what the native option covers, recommend it, and what remains for this tool (values the server hands back, HAR, storageState, older versions, recorded artifacts). Measured with 1.65.0-alpha-2026-10-23: trace.secrets with password+email 35 -> 16, HAR and storageState unchanged; this tool on top 1 / 1 / 0. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This was referenced Oct 30, 2026
Bruno Almeida (brunoccalmeida)
added a commit
to brunoccalmeida/playwright-qa-starter-kit
that referenced
this pull request
Nov 17, 2026
Closes #43 ## What A failed `APIRequestContext` call writes every request and response header (including `Cookie: token=…`) to its call log. Playwright records that log in the step **before** a test can catch the error, so the auth cookie reached the CI log, `report.jsonl`, the `.md` attachments of the blob and the public HTML report. - `src/reporting/redacting-reporter.ts`, listed **first** in `playwright.config.ts`: masks every header outside a short allowlist (`HARMLESS_HEADERS`) in the `→`/`←` blocks of the call log, in errors (`message`, `stack`, `value`, `cause`), steps, `onError` and text attachments. - **Fail closed:** if an attachment cannot be read or rewritten, the **file** is removed from disk. The blob reporter records the path on `onStepEnd` and zips whatever file exists at `onEnd`, so dropping the list entry alone is not enough (reviewer finding, fixed in the second commit). - Sentinel `scripts/check-report-redaction.ts` (last step of `npm run check`): runs failing requests against a local server through the **real** config's reporters in CI mode and searches the terminal output, the whole blob and the output dir for a random token. ## Why a reporter The origin (Playwright's fetch call log) has no option to hide headers, and the reporter `secrets` option was reverted upstream (microsoft/playwright#43334, #43870; tracked in #21). Mutating reporter objects is undocumented, which is why the sentinel exists: a Playwright upgrade that breaks it turns `check` red instead of leaking in silence. Sources: [OWASP Logging Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Logging_Cheat_Sheet.html), [OpenTelemetry redaction processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/processor/redactionprocessor) (allowlist, fail closed), [Playwright Reporter API](https://playwright.dev/docs/api/class-reporter). ## RED 1. Probe: closed port with a fake cookie → `Cookie: token=FAKE-SENTINEL-VALUE` in output and JSON. 2. Test before the reporter existed: `ERR_MODULE_NOT_FOUND`. 3. Reporter out of the config → "The token reached the terminal output", `report.jsonl` and the blob's `.md` attachments. 4. 16 of 16 mutations rejected from a green baseline. 5. Real merged HTML report: 0 token hits, 37 `[REDACTED]`. 6. Reviewer finding: a read-only file holding the token, against the old fail-closed code → "An attachment that could not be cleaned stayed on disk, where the blob reporter zips it." Mutation without the `catch` around `rmSync` → `ERR_FS_EISDIR`. ## Review Independent reviewer run on the diff against #43: 4 findings, all valid. Blob fail-closed: fixed. Session record wording: fixed. Test stdout/stderr (no `onStdOut`/`onStdErr`; no `console.` in the kit today) and attachments with `body` or a non-text type: recorded as scope limits in the session summary. ## Out of scope Values in URLs and response bodies; trace stays off in CI. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- 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.
Summary
secretsoption, a map of name to value. Values are replaced with<secret>NAME</secret>in everything the reporter receives: titles, steps, errors, stdout/stderr, attachment bodies and config.config.reporterso they do not leak through config dumps.References #38673