Skip to content

Stop the Bot browser e2e mistaking node ids for a leaked card code - #638

Merged
sambitcreate merged 1 commit into
mainfrom
claude/project-thread-g2m4g4
Oct 28, 2026
Merged

sambitcreate merged 1 commit into
mainfrom
claude/project-thread-g2m4g4

Conversation

@sambitcreate

Copy link
Copy Markdown
Owner

Requested by sbt · project thread

What happened

tests/e2e/bot-browser.spec.ts:109 flaked once on #583 (head 7138ae4, run 40441401512, macOS E2E 3/3) with tableSeen.leaked = ["737"]. It passed on retry.

Cause: the test, not the Bot browser

The fixture checked for leaks by searching the whole JSON of the snapshot for each secret. That JSON includes Chromium's accessibility node ids (nodeId, parentId, childIds, backendDOMNodeId). They're counters, so the 3-digit security code 737 matches whenever a node gets id 737, 3737, 4737, 5737 and so on.

I reproduced it by loading /card-table 300 times in the real Electron fixture. The old check reported a "leak" in 11 of the 300 snapshots (about 4%). Every hit was a node id, and the card code itself never appeared. One example hit: {"nodeId":"4737","role":"LabelText","name":""}. The longer secrets (6 or more characters, or with letters) can't collide this way.

Fix

A leakedIn helper looks only at the strings a snapshot shows, skipping node ids and element refs. Both the login masking check and the card-table check use it.

  • Same 300-navigation run with the new check: 0 false hits.
  • Failing-first check of the oracle: with scrubBrowserSnapshot temporarily switched off, the spec fails at masking.leaked (481516, 4242424242424242). The card-table check reports 737 (the real code, in the button's name), 550071, 4000123412341234 and 5555444433332222. So it still catches a real leak.
  • bot-browser.spec.ts passes 4 times in a row locally (Linux, xvfb). npm run type-check:e2e and eslint are clean.

The change is test-only and touches no product code or docs.


Generated by Claude Code

bot-browser.spec.ts:109 flaked on #583 (run 40441401512) with
tableSeen.leaked ["737"]. The check searched the whole JSON of the
snapshot, and Chromium's accessibility node ids (nodeId 737, 4737,
5737...) are counters that can spell the fixture's 3-digit security
code. Navigating /card-table 300 times, the old check reported a leak
in 11 snapshots; every hit was a node id, never the code.

The leak checks now look only at the strings a snapshot shows, skipping
node ids and element refs. With the boundary's scrubbing switched off,
the new check still reports 737 and the other card values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018VA6RErv2zR8rF2mUh5aR8
@sambitcreate sambitcreate self-assigned this Oct 28, 2026

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes in the Bot browser E2E fixture, including the snapshot contracts and secret-masking assertions that consume its results.

  • Collision-free leak detection: leakedIn scans nested string values while excluding generated node IDs and element references, avoiding accidental matches against the short card code.
  • Preserved secret coverage: Login masking and card-table checks retain detection in names, values, selectors, attributes, and nested accessibility source text without changing product behavior.

Validation passed: npm run type-check:e2e, ESLint for the changed file, and direct checks of the actual helper against an ID-only collision and six real-leak fixtures. The Electron spec was not run because this checkout lacks node_modules/electron/dist/electron.

Pullfrog  | View workflow run | Using gpt-6.1-sol | 𝕏

@sambitcreate
sambitcreate merged commit d4ff905 into main Oct 28, 2026
25 checks passed
@sambitcreate
sambitcreate deleted the claude/project-thread-g2m4g4 branch October 28, 2026 22:40
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.

2 participants