Repository navigation
docs(security): document pages that hide a password field from e2e - #2034
Conversation
On the web engine, e2e decides in the page's main world whether a field is secure. A page script that replaces `Element.prototype.matches` makes a password field count as a plain field. The observed screen then shows its value, `inputValue` and `getAttribute` return it, and a failed `toHaveValue` or `toHaveAttribute` prints it. Configured secrets are still redacted, and screenshots still mask the field outside a closed shadow root. The places that say password fields are masked or never reach the model link the limit: the security reference's model-input table, the agent-steps and decision-models guides, and the e2e skill's agent reference. Refs e2e-inc#2010 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
…attribute `getAttribute` and `toHaveAttribute` read the element's HTML attributes, not its live value, so they expose a hidden password field's value only when the `value` attribute holds it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eld leaks - The MCP `POLICY_DENIED` row and the e2e skill's writing-tests reference say a read of a secure field is denied, as `screen.mdx` does, since a password field a page hides from e2e is not one. - decision-models says the text model sees a hidden field's value and `type` can fill it, and that only `typeSecret` fills a configured secret. - The security reference names the limit in its model-input table link, and says a closed shadow root loses its screenshot mask only when the page also replaces `querySelectorAll`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
0 issues found across 5 files (changes from recent commits).
Heads up: you’ve reached your flex budget. Increase your flex budget or wait for usage to reset.
View guided diff | Re-trigger cubic
|
Note 🤖 Claude Opus 5.5 responding on behalf of @samanyudas Ready for human review at One call for @okwasniewski: your triage comment asked only for the |
okwasniewski
left a comment
There was a problem hiding this comment.
[claude-opus-5-5] automated review on behalf of @okwasniewski
Checked at 9a5401a (docs only, mergeable clean, all checks green, both cubic threads fixed and resolved).
Every claim in the new "Where redaction stops" item matches main (3e7d19d):
- Screen and
inputValue: the only secure checks areel.matches(options.secureFieldSelector)inpackages/web/src/in-page/read-semantics.ts:598(embedded name) and:1618(the node'ssecureflag). Withmatchesreplaced the node is a plain textbox, soobservation.ts:207keeps its value andlocator/engine.ts:54no longer refuses the read or thetoHaveValue/toHaveAttributeassertions. - Attributes: the
valueattribute is dropped onlyif (secure)(read-semantics.ts:1639), andgetAttributereadsel.attributes, not the live value, so "when the HTMLvalueattribute holds it" is right. - Screenshots:
secureFieldMasks(packages/web/src/observe.ts:32) uses Playwright's own CSS engine for light DOM and open roots, so the mask holds. The closed-root mask goes throughe2e-closed, which calls the page'squerySelectorAllin the main world (closed-shadow.ts:94,:98), so the closed-root exception is right too. - Text model:
decision/src/elements.ts:163offerstypeonly when neitherinputPurpose === 'password'norsecureis set, so a hidden field getstype. A configured password still can't go into it because its purpose isnone. "OnlytypeSecretfills a configured secret" holds. - The "password field" to "secure field" renames in
reference/mcp.mdxand the skill'swriting-tests.mdmatchscreen.mdxand whatlocator/engine.tsactually checks. The skill copies underplugins/e2e/are identical.
Must fix
- None.
Nits
docs/reference/security.mdx:272: "and the page also replacesquerySelectorAll" names one internal method. ReplacingWeakMap.prototype.get(closed-shadow.ts:87) breaks the closed-root mask the same way. "unless it is in a closed shadow root and the page replaces other DOM methods too" stays true without listing internals.docs/decision-models.mdx:136:typeis offered only when the field also has noautocomplete="current-password"/"new-password". "can fill it" already covers this, so no change is needed unless you want it exact.
Verified by reading the code paths above on main. I did not rerun the testbed, because the PR changes no code and the author's main-vs-script table matches each path. CI: 28 checks, all green or skipped.
Issue
Refs #2010. This is option 3 from the triage comment. Option 1, saving
Element.prototype.matchesin the context init script, waits for #1503, so the issue stays open.Why
el.matches(options.secureFieldSelector)atpackages/web/src/in-page/read-semantics.ts:598and:1618.Element.prototype.matches, e2e reads a password field as a plain textbox, and the docs said that can't happen.What changes
docs/reference/security.mdx, "Where redaction stops": a new item covers the case:inputValueshow the valuetoHaveValueprints the valuegetAttributeandtoHaveAttributedo the same when the HTMLvalueattribute holds the password<secret:name>querySelectorAlldocs/agent-steps.mdxdocs/decision-models.mdx, which also says the text model then sees the value andtypecan fill the fieldskills/e2e/references/agent.mdPOLICY_DENIEDnow say secure field, asscreen.mdxalready does:docs/reference/mcp.mdxandskills/e2e/references/writing-tests.md. The skill edits are synced toplugins/e2e/.expect.mdx"Secure fields",screen.mdx, and thePOLICY_DENIEDrow, stay as they are. They remain true, because the hidden field no longer counts as secure.Verified
Ran it locally: yes
The testbed ran with the CLI built from main (
3e7d19de1). The branch changes no code, so main and the branch behave the same. Each case loaded<label>Password <input type="password" value="gen-Pw-918273"></label>, once as is and once with<script>Element.prototype.matches = () => false;</script>.inputValue()POLICY_DENIED"gen-Pw-918273"getAttribute('value')POLICY_DENIED"gen-Pw-918273"inputValue()/getAttribute('value')afterfill('typed-pw-777'), novalueattribute"typed-pw-777"/nullexpect(field).toHaveValue('nope')POLICY_DENIEDASSERTION_FAILED,trace.mdholdsvalue "gen-Pw-918273"expect(field).toHaveAttribute('value', 'nope')POLICY_DENIEDASSERTION_FAILED, the message holds the valueinputValue()on a configured secret (admin-pass)POLICY_DENIED<secret:admin.password>querySelectorAllreplaced too🤖 Generated with Claude Code