Skip to content

fix(browser): keep no secret value as a default in taught and recorded flows - #251

Merged
william-monroy merged 7 commits into
mainfrom
fix/teach-secrets
Dec 3, 2026
Merged

william-monroy merged 7 commits into
mainfrom
fix/teach-secrets

Conversation

@william-monroy

@william-monroy william-monroy commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

Teach mode and flow recording now keep no value for a few more kinds of secret input, and a taught vault sign-in replays as the person did it.

Changes

  1. Card fields by name. A field named like a card number or expiry (cardnumber, card_number, ccNum, card-expiry, credit_card_number) is a card field in sensitive.ts, as one with a cc- autocomplete is. This covers teach mode, browser_record, the trace pause and natural language actions. The in-page check of teach mode now reads names word by word, as the server does.
  2. Vault values from the start. Teach mode and FlowRecorder read the identity's vault user names and passwords from the secret store before the first typed step is kept, and hold them in memory only (VaultValues in vault.ts). They are dropped when teaching or a recording stops. A user name counts as the whole typed value, with case and spaces ignored. A password counts as the whole value, or inside other text when it has 4 or more characters. Locators, fingerprints and element names drop these values, and so does the trace pause. A recorded browser_navigate keeps no query string or fragment.
  3. Sign-in fold. A taught sign-in starts only at a password or one-time code input on a page of a vault site. A vault user name typed elsewhere, such as an email at checkout, only loses its default. The fold takes in the user-name typing of the same form and document across a checked box or a key (Tab, Escape). It stops at a submit-like click or at Enter in that form, so a sign-in that asks for the user name first replays as shown. Later typing is taken in only into the fields the sign-in took in.
  4. Submit. The person's submit ends the sign-in. It is dropped only when browser_login will submit (loginSubmits, where the policy's "autoSubmit": false wins over the vault). Otherwise it stays a step.
  5. In-page check. A text area or editable element named like a secret reports only its length, as an input does.
  6. Tests. test/teach.test.ts is new and needs no browser. It covers card names, vault values, the code-field rule, the start of a sign-in on the vault site's own origin, the fold and its stop at a submit, later typing, element names with a vault value, and the submit with and without the policy. recorder.test.ts adds the card name, vault values before login, the navigation address, and element names. sensitive.test.ts adds card names and near misses.

Docs: teach-mode.mdx and flows.mdx now say what is kept and what is not.

Checks

  • tsc --noEmit (browser), biome check, knip, scripts/no-em-dash.mjs, scripts/changeset-names.mjs, and the generated docs check
  • vitest run test/teach.test.ts test/recorder.test.ts test/sensitive.test.ts: 32 passed

@william-monroy
william-monroy force-pushed the fix/teach-secrets branch 2 times, most recently from bd1992c to b2ab3d6 Compare December 3, 2026 19:49
…d flows

- A card number or expiry field named like one (cardnumber, card_number)
  counts as a card field, as one with a cc- autocomplete does.
- Teach mode and flow recording read the identity's vault values when they
  start and hold them in memory, so a vault value typed by hand keeps no
  default before browser_login runs. A value under 4 characters counts only
  as the whole of what was typed.
- A taught vault sign-in takes in the user name typed into the same form on
  the same page, even with other steps between or after the password.
- The person's submit is dropped only when browser_login will submit: the
  identity policy's autoSubmit false keeps it as a step.
- In the page, a text area or editable element named like a secret reports
  only its length, as an input does.
…at a submit

- A taught vault sign-in starts only at a password or one-time code input.
  A vault user name typed elsewhere only loses its default.
- The backward fold stops at a submit-like click or Enter in the same form,
  so a sign-in that asks the user name first replays as shown.
- The person's submit ends the sign-in even when it stays a step, and later
  typing is taken in only into the fields the sign-in took in.
- Locators, fingerprints and names drop vault values read at the start.
- Vault user names match as the whole typed value, case aside; passwords of
  4 or more characters also inside other text.
- The in-page secret check reads names word by word, as the server does.
- Vault values are dropped when teaching or a recording stops; the trace
  pause also knows them, and a recorded navigation keeps no query string.
… nothing

- A button of type button or reset (a show-password toggle) is no submit:
  it ends no sign-in and stops no fold, and inside a sign-in that
  browser_login submits it is not a step.
- Vault user names are kept out of locators, fingerprints and names in any
  case.
While a sign-in that browser_login submits is open, a click on a button
that submits nothing waits. The person's own submit drops it if it is a
show-password toggle and keeps it as a step after browser_login otherwise.
When the sign-in ends another way (another step, a new document, the end of
teach mode), the held clicks stay steps, so a page that signs in from script
replays its button. Switches, boxes, tabs and cookie banner buttons are
never held.
Only a new document, the end of teach mode, or a step on another page or
outside the sign-in's form ends it. Steps in its form while it is open (a
box checked, a choice, a key, a cookie banner's button) go before the
browser_login step when it submits. Held clicks that were not the sign-in
go there too; when the sign-in ends without the person's submit, only the
last held click goes after browser_login. The consent pattern now needs
cookie or consent wording, and a button about a forgotten or changed
password is no show-password toggle.
…ithout a form

Without a form, only keys and typing on the sign-in's fields, boxes
checked, choices and cookie banner buttons leave it open; any other click
or typing ends it, and a second button that submits nothing ends it rather
than being held. A link and Escape end any sign-in, so they stay after
browser_login. Enter ends a sign-in without a form only on its fields. The
first user name field of the form typed after the password is taken in.
…keep it open at Escape on its fields

The second-button rule now applies only to a sign-in without a form, so a
plain button before a script sign-in button goes before browser_login and
the last one after it. Escape on one of the sign-in's fields leaves it open;
elsewhere it still ends it.
@william-monroy
william-monroy merged commit 214161b into main Dec 3, 2026
22 of 23 checks passed
@william-monroy
william-monroy deleted the fix/teach-secrets branch December 3, 2026 22:00
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