Skip to content

Secure fields: the accessibility tree carries a password or its length, and a web autofill is added to what was typed; fixes are on a fork #586

Closed

Description

@Entrpi

Two leaks and a failure in password fields.

1. Accessibility text runs carry a secure field's text

a11y_text_nodes gives every text input TextRun children. Its secure check covers only selectable text, so secure inputs get runs too. Each run's value comes from a11y_drawn_text, which returns the field's display text:

  • a revealed password goes into the tree as plaintext;
  • a masked one goes as one dot per character, with each character's length, position and width.

So a screen reader, or any process with accessibility access, can read a revealed password and count a masked one. The field node itself already leaves its value unset, and El::revealed promises no accessibility text. The leak is not visible in --tree, accessibility_json or the goldens, because all of them leave runs out.

2. A web autofill is added to what was typed

On the web, the hidden <input type="password"> sends its whole value to Rust as typed text and then empties itself. Rust types that text at the caret. That works for one keystroke at a time. But a browser or password-manager fill sets the whole value at once, so it is added to what the person already typed: 13 characters filled over 8 typed leave 21, and the sign-in fails. The input also sets autocomplete="off", so most password managers never offer to fill it.

Fix

Two commits on dev 14e3c5d, on branch safety-secure-fields of Entrpi/rune.

f3578e8a: no accessibility text run for a secure field.

  • A secure node gets no runs, field or not, and a11y_drawn_text returns nothing for it.
  • The field keeps its password role, its name, and its click, focus, set-value and replace-selected-text actions. Its value stays unset.
  • It no longer offers SetTextSelection, which has no run to point into.
  • Trade-off: with no runs, a screen reader can no longer move through a secure field by character or follow its caret.
  • Tests walk the whole accessibility_tree() subtree of a single-line and a multi-line secure field, masked and revealed. They find no TextRun, no character arrays, no selection, no SetTextSelection, and neither the plaintext nor the mask in any value, label, description or placeholder. Another test reveals and then conceals both fields with a client active, and checks each update the same way.

b7ce1734: a web fill replaces the field's text.

  • A new pure function in bridge.js, secureKind, classifies each input event on the password input. These count as a fill and go to Rust as secure_replace, even when the value is empty, which clears the field:
    • an event with no inputType;
    • insertReplacementText;
    • an insertText of more than one grapheme cluster, counted in data, or in the value when data is null (the input is emptied after each event, so the value holds what this event added);
    • any input on an element that matches :autofill or :-webkit-autofill.
  • A keystroke inserts one grapheme cluster and goes as secure, as before. A password field takes no IME, autocorrect or dictation. A paste keeps its own listener. Without Intl.Segmenter, every insertText counts as typing, so one emoji can never replace the field.
  • Runtime::web_secure_replace applies the same focus and secure checks as web_secure, and replaces the field's whole text as one edit. It holds the value in a Zeroizing buffer and logs, traces and mirrors nothing of it.
  • The input sets autocomplete="current-password". Rune has no way yet for a field to say it takes a username, a new password or a one-time code.
  • The listener body is an exported passwordInput(event, input, key, send). node --test crates/rune/src/platform/web/bridge.test.mjs covers the classification and the listener: the input is emptied after every event, an empty fill clears the field, empty typing sends nothing, and nothing is sent while no Rune field has the keyboard. Rust unit tests cover the replacement, including a fill over typed text, a second fill, an empty fill, a fill for a field that lost focus, a paste over a selection, and that the value reaches no log, trace, mirror, accessibility tree or Debug output.
  • WEB.md says exactly which inputs count as a fill. The web input smoke gains fill, autofill and paste steps. I could not run those smoke steps: this machine has no wasm-bindgen or WASI SDK.

Each commit has a changelog fragment.

On macOS (Apple silicon), the documented test command, cargo test -p rune -p rune-kit --features rune-kit/markdown --no-fail-fast, passes with this branch and the other three safety branches merged on dev 14e3c5d: 2,786 passed, 0 failed. Dev alone gives 2,749 passed, 0 failed. The four branches are safety-secure-fields, safety-hostile-content, safety-gpu-failures and safety-release-dev-surface; they merge cleanly except for one import line in image.rs. cargo check --workspace --all-targets and scripts/file-size.sh pass. node --test crates/rune/src/platform/web/bridge.test.mjs passes (9 tests).

Filed together with #587, #588 and #589, the other safety fixes from the same review.

Activity

  1. Hona commented on Nov 23, 2026

    @Hona
    Member

    Secure fields no longer put their text, mask or length into the accessibility tree (no text runs, character metrics, selection or SetTextSelection), the web mirror, the --html export, --tree, key logs or TextEdit Debug. On the web, the password input now uses autocomplete="current-password", and a browser or password-manager fill replaces what was typed instead of being added to it. Fixed on dev in #1607 (23f83d6).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions