Skip to content

Hold frames while a typing read is in flight, and redact numeric bodies in rewritten archives - #591

Merged
vishnuv688 merged 2 commits into
mainfrom
fix/589-redaction-followups
Nov 25, 2026
Merged

vishnuv688 merged 2 commits into
mainfrom
fix/589-redaction-followups

Conversation

@vishnuv688

Copy link
Copy Markdown
Member

What & why

Follow-up to #589 for two review comments that arrived as it merged (1, 2).

  1. A frame could leave before its password was learned. The WebdriverIO service starts the field-type read in beforeCommand without 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.sendUpstream now holds every frame while a typing read is in flight (core/secret-redaction.ts typingReadsPending / 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.
  2. A numeric password survived the end-of-run archive rewrite. Each line was parsed as JSON and walked, so a stored body 123456 became a number the walk skips. A line that is not a JSON record or list is now redacted as text.

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Polish (an improvement to an existing feature)
  • Breaking change (existing behavior changes for users)
  • Documentation
  • Internal (build, CI, dependencies, tooling)

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.ts updated, and tables regenerated with pnpm docs:capabilities, if this adds or changes user-facing behaviour

No capability change; pnpm docs:capabilities --check passes.

Notes for reviewers

  • Why core: the hold sits in the base class every JS adapter sends through, so it covers any adapter whose read overlaps the typing. Selenium and Nightwatch await the read before the keys are sent, so for them it only delays frames for the read's own round trip. Python reads before send_keys runs and is unaffected.
  • Trace archives were never exposed by (1): they are written at the end with every learned password.
  • Checks: 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.

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.
@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
devtools Ready Ready Preview Nov 25, 2026 3:40am UTC

Request Review

@vishnuv688 vishnuv688 self-assigned this Nov 25, 2026
@greptile-apps

greptile-apps Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous escaped-password issue is fixed.

Summary

Holds live messages until pending field-type reads finish, then sends them in order with newly learned passwords removed.

  • Outgoing frames wait until password-field checks finish.
  • Trace rewrites redact numeric body lines.

Reviews (2) · Last reviewed commit: "Walk JSON string bodies when re-redactin..." · Reviewed by Greptile

Comment on lines +92 to +93
if (typeof parsed !== 'object' || parsed === null) {
return redactor.redactString(line)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security 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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
@vishnuv688
vishnuv688 merged commit d490f08 into main Nov 25, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant