Skip to content

macOS engine: observation never reads, keeps or shows a password field's value, length or selection (#405) - #411

Merged
SSFSKIM merged 21 commits into
mainfrom
fix/405-secure-field-unread
Nov 18, 2026
Merged

SSFSKIM merged 21 commits into
mainfrom
fix/405-secure-field-unread

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What changes

On macOS, cua's observation read a password field's value like any other field's. Every app we measured masks it before cua sees it (see #405), so the agent got one mask character per character: the exact length, but not the text. Nothing in cua guarded the field, though, so a provider that returned plaintext would have put the password into native IPC, the Node diff cache, lineage identity and the agent's text. Now cua guards what leaves the engine or stays in it, whatever the provider returns (rulings 1ea561bc:804, 808, 811, 813, 817).

The read path (native/engine/Sources/Engine/Fetch.swift):

  • One batch per element, classified from its own reply. ElementSource.classifiedData asks for role, subrole and the value-bearing attributes (AXValue, AXValueDescription, AXNumberOfCharacters) in one AXUIElementCopyMultipleAttributeValues call. For ordinary window elements this is exactly main's request. When the reply classifies the element as closed, the value attributes are removed before anything decodes, converts, caches or formats them.

  • What counts as closed (ruling 813):

    • a role or subrole of AXSecureTextField;
    • an unreadable role;
    • AXTextField, AXTextArea or AXComboBox with an unreadable subrole.

    These render secure text, with no value, length, Details or selected text. Any other readable role whose subrole read fails (an AX error, not an absent or unsupported subrole) has its value dropped and renders value unread.

  • Parameterized reads (the Markdown/attributed-string read of text fields of up to 2,000 characters, and select_text's attributed read) can't share a batch with role. Each makes a role/subrole classification just before the read, and fails closed. select_text refuses a password field, because whether a search succeeds would reveal its text.

  • The focused element's AXSelectedText rides in a batch with role and subrole, and is dropped if that batch is closed.

Identity (Lineage.swift):

  • A password field's identity holds no value or description and records secure. A same-labelled plain field never inherits its token.
  • A value or classification that failed to read matches only for the same handle, so a timeout can't move a token to another control.
  • AXValueDescription is now tracked separately from the value.

Paste (ruling 808, Paste.swift):

  • For a password field, the engine still reads the field's count internally, to confirm the paste, but the paste meta carries only secure: true, never a range or count.
  • The paste confirms only when the count moved by exactly the delivered plain-text length (the .string representation for HTML or Markdown).
  • A notification triggers a read, but can't override a count that doesn't match. A failed poll never confirms.

Render (src/services/engine/render.mjs): secure text and value unread. Neither is pruned when unlabelled. Non-secure output is byte-identical to main's.

Docs:

  • agent-cursor.md (with its oracle and pinned copies) says what an observation shows for a password field.
  • The README's secrets paragraph says the screen, and so screenshots, still show one mask per character, while cua's macOS observation shows secure text with no length, and the Linux engine (Linux engine: audit and guard password-role fields in the observation walk (parity with the macOS secure-field rule) #407) still shows the masks.
  • secrets_list's description now ends "…which still shows its length on screen", wording true on both platforms.
  • The Decision Log has entries for each review round and ruling.

Evidence

Hosted qualification, kit on probe/405-qual (README at 7813808): fix 5f29261 against main 11f1ff6, both unmodified, on GitHub-hosted macOS with synthetic passwords of 23 and 31 characters, 7 of them selected.

  • Six lanes, 90/90 seeded rows per head, 90/90 byte-identical ordinary-control pairs: CfT 157, default and MAWS-parity Electron 44, Safari 27.2, Firefox 160 and AppKit NSSecureTextField. Runs: full 44228841099, and Firefox 44230454220, because the full run's Firefox 159 startup was setup-invalid before any engine RPC.
    • Fix: native IPC, full render, transition and repeat (diff) text carry no password value, mask, count or selection, and print secure text.
    • Main: the masks at the exact length, for contrast.
  • {{secret:…}} typed into the CfT password field: delivered exactly 5/5 on each head. Only the fix's follow-up observation hides the length.
  • Paste into the password field: delivered on both heads.
    • main confirmed by notification and returned the baseline range and count;
    • the fix confirmed by a count-matching AX read and returned only {secure: true}.
  • Hosted proof suites: 17 native tests with a stub provider that returns plaintext, and 63 Node render/diff/cache tests.

Latency (ruling 817). Small and large pages are within noise. A reused settle tree pays one classification request per Markdown read: about 12 ms on a page with 218 text fields, about 1 ms on a typical page with 5–20 inputs.

p50 wall, main → fix CfT (20/head) AppKit
small fixture 55.7 → 56.1 ms 17.3 → 15.9
large page (286 nodes, 216 inputs) 176.1 → 178.2 229.5 → 237.7
reused settle tree 466.5 → 484.3 456.4 → 463.2 (40/head, interleaved)
  • AppKit reused tail, settled (44230116365, 40 per head, 8 alternating blocks):
    • p95/max went from 522/705 ms on main to 545/570 on the fix;
    • the busy and width phases make the same 224 reads on both heads;
    • the earlier 1.5 s outlier was runner noise.
  • The consistent cost is the final walk: +12 ms p50, slower in 8 of 8 blocks (attributes 0.5 → 12.4 ms), with 218 Markdown reads on both heads. CfT shows the same: attributes 2.3 → 13.1 ms, with 219 Markdown reads.

Limits

Verification

  • swift test (native/engine): on the merged head: 1,333 tests, 0 failures, 1 skipped (pre-existing).
  • Node: render/diff/observations/service, spike-engine, native-matrix goldens, core-documentation, docs-oracle, bootstrap-kernel, mcp-maws-hint, mcp-browser-surface, mcp-server and package-contents, 266 tests on the merged head: 261 pass, 1 skipped (hosted-only). Four fail on this Mac only because its screen is locked: the debug engine relay and three real-engine facade tests drive the live engine, which answers -10020 The Mac is locked. The hosted test gate runs them.
  • Mutation checks: every guard in each round was removed and caught (four engine rounds plus the renderer). The one surviving mutant, a redundant request-level filter, was removed.
  • Review: doperpowers:reviewer-high over five rounds.
    • r1 (7 findings), r2 (8: 7 fixed, 1 dismissed as a boundary) and r3 (4) were on the two-request design.
    • The design then changed to a single batch (ruling 811). A review of that rework found 3, all fixed.
    • The final narrow re-review confirmed them and found one renderer pruning defect, fixed.
    • The qualification kit was reviewed by doperpowers:reviewer-medium before dispatch.
  • ci-gate on ec25580 (main a39d26f merged in), gates plugin, test and engine-swift: GREEN, https://github.com/SSFSKIM/cua/actions/runs/44234590323. The sandbox and browser-parity gates were not run: the change touches neither the sandbox nor the browser extension path. An earlier gate on 05ed880 was red because the shared secrets_list text named macOS on the Linux surface; fixed at e1df6b5.

Plugin 0.28.13.

Closes #405

Sminos-Session: cursor235#b93055dd (cua on macbook)

…nd never reads a password field's value, length, Markdown or selection (refs #405)

Every element is now read in two requests: all its attributes but AXValue
and AXNumberOfCharacters first, then those two, beside AXRole and AXSubrole
read again, only when the first classified it as neither a password field
(role or subrole AXSecureTextField) nor unclassifiable (a role or subrole
it could not read). A field the second request finds closed keeps nothing
of it, and a request keeps only what it asked for. The Markdown read and
the focused element's AXSelectedText are classified just before, and
select_text refuses a password field before reading it.

A password field's node carries `secure: true` and no value, length or
Markdown, stays settable, and its identity keeps no value (valueUnread).
The settle's busy walk reads no value attributes at all; the observation
that reuses its reads adds only the value's request, and a re-fetch walk
asks for the value only of an element the rest already matches.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…or selected text, in the full tree and the diff (refs #405)

A node the engine marks `secure`, or whose role or subrole is
AXSecureTextField whatever value it carries, keeps no value or Markdown in
the renderer: its Value part prints `secure text`, no transformation can
take a value from it, the trailer drops the selected text when it is the
focused element, and so a diff never sees what it holds change. Every other
node renders byte for byte as before.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…th (refs #405)

agent-cursor.md's typing paragraph gains a sentence after its password-field
sentence: an observation's value for such a field reads `secure text`,
selectText cannot select in it, and a screenshot shows what the field
displays. The docs oracle and the core-documentation test carry it byte for
byte; PROVENANCE.md and the surface inventory's "Table 3 addition
(2026-11-17, #405)" record it.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…s debt (refs #405)

The entry records the classification before every value read, what a
password field's node and identity carry, the entry points covered, the
renderer's `secure text`, the cost, the model's sentence, and what is left:
the paste's effect reading, logged in tech-debt-tracker.md.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…es just before and in its own batch, and a paste's password-field numbers stay in the engine (refs #405)

The review of 2e5b305..6dc4bcd. `guardedRead` requests value-bearing
attributes only beside AXRole and AXSubrole, drops the whole answer when
that classification is closed, and sends that batch only after a
classification made just before it.

- AXValueDescription is value-bearing: read in the guarded batch, kept off
  a password field's node and identity, and dropped from Details by the
  renderer.
- A field the Markdown's classification finds closed closes the walk's
  data and the source's cache: the node is secure, its identity valueUnread.
- A structure the settle's busy walk read is classified again before the
  value's batch.
- The focused selected text and select_text's value and attributed reads
  go through the guard; select_text refuses a field closed by then.
- A failed value read (`valueFailed`) is no longer a wildcard in a match
  that needs the value.
- A listed read asks for the role and subrole whatever the element lists.
- Paste (ruling 1ea561bc:808): a password field's range and count are
  read to judge the paste, which confirms only a count moved by exactly the
  line less the replaced selection, and the meta carries only `secure`.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…405)

The paste is in #405 (ruling 1ea561bc:808), so its tech-debt entry goes.

Sminos-Session: cursor235#b93055dd (cua on macbook)
Sminos-Session: cursor235#b93055dd (cua on macbook)
… not in the macOS observation (refs #405)

#409's sentences said a masked field still shows the value's length. With
#405 that holds for the screen, and so screenshots, but cua's macOS
observation reads such a field as `secure text` with no length; the Linux
engine's still shows the masks (#407). The README's secrets paragraph and
the end of secrets_list's description say so, and the hint digest in
test/mcp-maws-hint.test.mjs is re-recorded, naming #405.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…a wildcard, and a paste is judged on its numbers alone (refs #405)

The re-review of 6dc4bcd..6a1c765, seven findings.

- The paste reading reads role, subrole, range and count in one batch and
  marks the numbers by that batch's classification, or its failure.
- A Markdown classification that fails as a whole closes the field;
  select_text refuses when its classification before the attributed read
  fails.
- A value batch that cannot classify, or fails, marks the element
  unverified (valueFailed, descriptionFailed), which matches only another
  unverified one; a batch that reads the role and subrole gives the data
  those fresher ones, so a known change to secure no longer matches on
  stale structural ones. The re-fetch walk decides each structural match by
  the full read.
- AXValueDescription has its own unread and failed marks: #390's valueless
  source and ignoringValue compare it again.
- Paste movement is the range's and count's (`moved`), never the secure
  mark; a notification no longer confirms where the count decides; and the
  count is judged against the delivered plain text, not a markup source.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…orded (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d drops a password field's value as it is decoded (refs #405)

Design ruling 1ea561bc:811: the separate classification request cost
+44-61% walk time (smoke 44224481847), so each element is read in main's
one batch, its role and subrole beside its value attributes, classified
from that reply, and a closed element's value, value description and
length dropped in the same function, before anything reads or formats
the reply. An element whose role or subrole is missing or fails is treated
as a password field. The structure-only read, the reuse's
reclassification and the focus preflight go; the focused AXSelectedText
and select_text's AXValue each ride in one batch with the role and
subrole. The parameterized reads keep a classification just before,
failing closed.

Also the review of 6a1c765..bc52384: a failed paste poll is no reading
and a password field's reading moves only on a number it read; the
paste's batch keeps the budget's timeout; the identity records and
compares `secure`; and two failed reads match only for the same handle.

Sminos-Session: cursor235#b93055dd (cua on macbook)
… rejected two-request read's numbers (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
… only where one can be, and a closure by failure never matches another handle (refs #405)

Ruling 1ea561bc:813: a role or subrole AXSecureTextField, an unreadable
role, or a text-entry role whose subrole cannot be read still says
`secure` (`secure text`); any other readable role whose subrole cannot be
read has its value dropped and says `valueUnread`, rendered `value
unread`.

The review of bc52384..cd7a2f6: a closed reply's value attributes are
left out of the names the data is decoded from, so nothing keeps,
converts or bounds them; a closure by failure is recorded apart from
`secure` (`classificationFailed`) and matches only another such for the
same handle; and the stub's checks look for a distinctive 41-unit length
in any form and its mask runs in the error wire and the captured stderr,
failing when the capture fails.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ixes (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ned, so `value unread` keeps its line and index (refs #405)

`descriptive` counted `secure` but not `valueUnread`, so an unlabelled
AXGroup marked `valueUnread` was pruned before its Value part could print.

Sminos-Session: cursor235#b93055dd (cua on macbook)
… on every platform (refs #405)

The description is shared by the macOS and Linux computer surfaces, and
the Linux one must name nothing of macOS (test/mcp-browser-surface.test.mjs).
It now ends: a password field still shows its length on screen, one mask
character per character. The README keeps the macOS `secure text` against
Linux masks difference. The hint digest is re-recorded.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…-field-unread (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ord field's value, length or selection (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ue, length or selection in the fix's output, latency within noise (refs #405)

Sminos-Session: cursor235#b93055dd (cua on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-18T04:18:49.782714Z ec25580 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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.

macOS engine: observation never reads a secure field's value, length or selection (protection is the AX provider's today)

1 participant