Repository navigation
Hold frames while a typing read is in flight, and redact numeric bodies in rewritten archives - #591
Conversation
WebdriverIO starts the field-type read in beforeCommand without holding the hook, so a console line or request the typing itself set off could reach the dashboard before the password was learned. Frames sent while a read is in flight are now held, at most for the read's 2 s ceiling, and sent in order once it settles, redacted with what it learned. The end-of-run archive rewrite parsed each line as JSON and walked the result, so a stored body such as `123456` became a number the walk skips and a numeric password survived. A line that is not a JSON record or list is now redacted as text. Follow-up to review comments on #589.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
[Medium impact] The PR appears safe to merge; the previous escaped-password issue is fixed. SummaryHolds live messages until pending field-type reads finish, then sends them in order with newly learned passwords removed.
Reviews (2) · Last reviewed commit: "Walk JSON string bodies when re-redactin..." · Reviewed by Greptile |
| if (typeof parsed !== 'object' || parsed === null) { | ||
| return redactor.redactString(line) |
There was a problem hiding this comment.
Escaped passwords survive archive rewrites
JSON string bodies now skip redaction of their decoded value. For example, a stored body "\u0073ecret" contains the password secret, but redactString(line) cannot match it because secretVariants does not generate Unicode escapes. An archive written before that password was learned therefore keeps it after the final rewrite. Previously, redactor.redact(parsed) removed it.
Keep parsed strings on the existing path and use raw-text redaction only for the other simple JSON values. Add a test with an escaped JSON string body.
How this was verified: Response bodies are stored unchanged, and this branch matches their encoded text instead of the decoded string that the previous code redacted.
There was a problem hiding this comment.
Fixed in df6fa33: a JSON string line now goes back through the value walk, so the redactor sees the decoded text. Only numbers, booleans and null use the raw-text path. A new test stores a body that spells the password with a S escape. It fails without the fix and passes with it.
Generated by Claude Code
A stored body that is a JSON string can spell a password with escapes such as S, which the raw-text match never finds, so an archive written before that password was learned kept it. Strings go back through the value walk, which redacts the decoded text; only numbers, booleans and null take the raw-text path. Addresses review comments on #591
What & why
Follow-up to #589 for two review comments that arrived as it merged (1, 2).
beforeCommandwithout holding the hook, so the keys reach the page while the read is in flight. A console line or request the typing set off in that window went to the live dashboard with the old redactor.SessionCapturerBase.sendUpstreamnow holds every frame while a typing read is in flight (core/secret-redaction.tstypingReadsPending/whenTypingReadsSettle) and sends them in order once it settles, redacted with what it learned. A read is capped at 2 s, so that is the longest a frame waits. The hook is never held.123456became a number the walk skips. A line that is not a JSON record or list is now redacted as text.Type of change
Packages touched
shared(types and contracts)core(framework-agnostic capture/reporting)elements(published element/snapshot API —@wdio/elements)service(WebdriverIO adapter)nightwatch-devtools(Nightwatch adapter)selenium-devtools(Selenium adapter)selenium-devtools-py(Selenium Python adapter)backend(server)app(UI)script(page-injected runtime)trace(Trace mode)Capability matrix
packages/conformance/src/features.tsupdated, and tables regenerated withpnpm docs:capabilities, if this adds or changes user-facing behaviourNo capability change;
pnpm docs:capabilities --checkpasses.Notes for reviewers
send_keysruns and is unaffected.pnpm build,pnpm typecheck,pnpm lint(0 errors),pnpm test(317 files, 4335 passed),pnpm docs:capabilities --check, the Python wire-type sync and the Python suite (965) are green; the bundle leak grep finds nothing. Both new tests fail without the fix.Screenshots / recordings
Not applicable: no UI change.