Skip to content

macOS engine: set_value writes a background Chromium page's field without the pointer and confirms only an exact read-back (#390) - #403

Merged
SSFSKIM merged 8 commits into
mainfrom
fix/390-value-without-focus
Nov 18, 2026
Merged

SSFSKIM merged 8 commits into
mainfrom
fix/390-value-without-focus

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 18, 2026

Copy link
Copy Markdown
Owner

What changes

On macOS, set_value on a web page's text field in a background Chromium or Electron window was refused with backgroundClickRefused before anything was written. The refusal came from the field-focus preparation (route 3's click fallback), not from the write: skipping that preparation, the write delivered. So the agent was told it couldn't set a value it could.

The fix (native/engine/Sources/Engine/ValueWithoutFocus.swift):

  • A plan before route 3's hold. On a shared desktop (not a dedicated one), with no foreground override for the app, when the target is a text field of a web page in a Chromium-based app in the background, and the field doesn't already have keyboard focus, set_value now sets AXFocused on the field and writes the value. There is no hold, no pointer event, no key and no activation.
  • An exact read-back. It then reads the value back and answers ok only when the read equals the request, UTF-16 for UTF-16. Otherwise:
    • a field that refuses the write → backgroundClickRefused, as before;
    • a field that accepts the write but reads differently (it transforms input, or the read times out at 1 s) → valueUnconfirmed;
    • any read at Chromium's 10,000-character cap → valueUnconfirmed (possiblyTruncated), because a capped read can't show what follows it.
  • A secret or a password field is never read. A {{secret:…}} value or a concealed field is written and always answers valueUnconfirmed (concealed). Review found that main also read those values on every route, while resolving the element and while choosing how to type. That is fixed everywhere: every set_value element resolution is now valueless (ElementSource.readsValue false, ElementIdentity.valueUnread), and the type choice classifies role and subrole within the same step as its single AXValue read (setValueClosed), so a field that turns secure mid-call isn't read.

Foreground set_value, Safari (its background route is still posted, route 3), Firefox, and native apps are unchanged.

agent-cursor.md adds two sentences to its fourth paragraph (and the docs oracle and core-documentation test that pin its text follow). The first: in the background, a Chromium page's setValue is set without a click and read back; it succeeds only once the field reads the new value, otherwise it fails with valueUnconfirmed, as it always does for a secret or a password field. The second (ruling 1ea561bc:793): the field becomes the page's focused element with no focus or blur event, so anything a page does only on focus doesn't happen.

Evidence

docs/evidence/2026-11-17-value-without-focus/README.md. The kit is on probe/390-qual (2f479ec). Everything ran on GitHub-hosted macOS against fix e417be4 and main 290303c, both unmodified, on the same browser per job. Each cell was judged against the page's own DOM value and React state at 0/50/250/1000 ms after the reply. An ok counts as false if any checkpoint disagrees.

Background, fix e417be4 CfT 156 default Electron MAWS-parity Electron
ordinary set_value, 20 each ok 20/20, exact at every checkpoint ok 20/20 ok 20/20
read-back, p50 / max ms 32 / 94 31 / 49 28 / 46
RPC, p50 / max ms 39 / 127 49 / 65 37 / 53
uppercase-transform guard, 5 each valueUnconfirmed 5/5 5/5 5/5
> 12k value possiblyTruncated 5/5 4/4 executed 5/5
exactly 10k + page-appended suffix possiblyTruncated 5/5 5/5 5/5
{{secret:…}} (test store, temp HOME) concealed 5/5, 0 reads 5/5, 0 reads 5/5, 0 reads
  • False ok: 0 on both heads.
  • Main: in CfT and parity Electron, every background cell is backgroundClickRefused with nothing written. Default-titlebar Electron on main delivers through route 3's pointer fallback, with transient raises in 40/40 (engine meta); the fix delivers there with none.
  • Side effects on the new path (119 trials): 0 pointer or key events, 0 native activations, 0 raises. The cover window stayed frontmost across 4,082 samples. The page sees input → handler → change; document.activeElement moves to the field, and document.hasFocus() stays false.
  • Foreground and Safari controls: 5/5 on both heads, behaviour unchanged.

Limits

  • The page sees no focus or blur event. The field becomes the active element without a focus or focusin. A page that reacts only to focus events (for example, opening an autocomplete on focus) won't see one. agent-cursor.md says so next to set_value.
  • Secrets and password fields always answer valueUnconfirmed, even when the write landed (15/15 delivered). The live secret cell proves 0 reads on this route's read-back only. Other AXValue reads are covered by source review and the unit tests (SensitiveValueTests). The observation walk still reads a password field's AXValue; that is pre-existing and outside set_value.
  • The fixture is a controlled React field in owned windows with default and MAWS-parity chrome, not the real MAWS app or a Radix dialog. A field turning secure mid-call isn't live-tested.
  • Activation and order are sampled (10 ms requested, gaps up to 56 ms), not traced continuously.
  • One long-value repetition was setup-invalid (frontmost not verified before any engine launch or RPC). It was kept, not rerun.
  • CfT rolled image between runs: the 20-repetition claim is for CfT 156 (full); smoke ran 157.

Verification

  • swift test (native/engine) on e417be4; this head adds only the version bump, the evidence README and one docs sentence: 1,314 tests, 0 failures, 1 skipped (pre-existing).
  • Node: core-documentation, docs-oracle, docs-source-behavior, package-contents and every services-engine-* test, 220 tests: 219 pass, 0 fail, 1 skipped (test/services-engine-real.test.mjs "the untrusted engine: …", hosted-only). The doc set and package-contents re-run on this head: 24/24.
  • Mutation checks: 22/22 on the build, 13/13 and 8/8 on the review fixes.
  • Review: doperpowers:reviewer-medium, three rounds.
    • r1, incorrect: a read capped at 10k could confirm by prefix, and secret or password AXValue was read during coercion and re-fetch. Fixed at 2532a1b.
    • r2, incorrect: a 10k read equal to a 10k request still confirmed while the field held more, and secure classification happened too early. Fixed at e417be4.
    • r3: correct. The qualification kit was reviewed by doperpowers:reviewer-medium before dispatch.
  • ci-gate on e9f4e05, gates plugin, test and engine-swift: GREEN, https://github.com/SSFSKIM/cua/actions/runs/44200799533 (the head before the docs sentence, 141142e, was GREEN too: https://github.com/SSFSKIM/cua/actions/runs/44199833296). The sandbox and browser-parity gates were not run: the change touches neither the sandbox nor the browser extension path.

Plugin 0.28.10.

Closes #390

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

…t the refused focus fallback and reads the value back (refs #390)

In a background Chromium or Electron window, set_value on a page text field
that needed focus was refused as backgroundClickRefused before any write:
focusFieldIfNeeded's AXFocused re-read comes too soon for Chromium, and its
fallback click is refused in a web area in shared mode.

Such a field (needs focus, inside an AXWebArea, Chromium-family process,
route 3, shared mode, no route-4 override) now takes no focus hold and no
fallback click: the AXFocused write alone by route 1, the value written,
then read back every 5 ms within 1 s. Ok only on an exact read (UTF-16
equal, or a strict prefix at Chromium's 10,000 cap). A rejected write is
refused as before; an accepted one not read back as written, a concealed
value or a password field (never read) answer valueUnconfirmed. Every other
field, app, route and mode keeps main's preparation.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…d read back (refs #390)

agent-cursor.md's fourth paragraph gains a closing sentence: such a setValue
succeeds only once the field reads the new value, else valueUnconfirmed,
always so for a secret or a password field. 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, #390)" record it.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…ocus (refs #390)

#359's wait before set_value's write and its watch after it stay as they
are around #390's route: the read-back runs after the accepted write and
before the watch, a refused write runs neither, and after the re-fetch the
watch's drift answers before #390's unconfirmed answer. #390's copy of the
cut-prefix rule goes; it uses #359's writtenValueRead. The docs keep #359's
sentence after the valueUnconfirmed one and close the paragraph with #390's.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…alue never reads a secret's or a password field's value (refs #390)

The review of c236f26 (two P2s). First, the unfocused read-back took #359's
rule, under which a 10,000-character prefix at Chromium's cap confirmed a
longer write; here the read is the only proof the write landed, so only an
exact read confirms, and a cut read answers valueUnconfirmed
(possiblyTruncated). #359's watch keeps its rule.

Second, main read AXValue on every route of a sensitive set_value: the
token's re-reads before the write, the coercion and the .ignoringValue
re-check, whose walk read every element's value. For a concealed request or
a password field (recorded, or live once resolved) those resolutions now
take a source that requests no AXValue, the coercion takes the string type
unread, and the renewed identity keeps no value, its match leaving the
value out so the token still resolves later.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…t_value's token re-reads never read AXValue (refs #390)

The review of 2532a1b (two P2s). A write of exactly 10,000 characters
read back equal may sit in a field holding more, so any read at the cap
now answers valueUnconfirmed (possiblyTruncated), as type_text counts it.

The sensitivity was decided ahead of the reads, from the recorded identity
and once after the scroll, so a field that turned secure since, or in the
focus step, could still be read. Now set_value's resolutions (re-reads, the
scroll's, the re-check and its walk) always take the valueless source, the
value left out of their match, and the coercion classifies the field
(concealed, password, unclassifiable) in its own step, just before its
read.

Sminos-Session: cursor235#b93055dd (cua on macbook)
…he pointer and confirms only an exact read-back (refs #390)

Sminos-Session: cursor235#b93055dd (cua on macbook)
… 60/60 by exact read-back with no pointer, key or raise (refs #390)

Sminos-Session: cursor235#b93055dd (cua on macbook)
…r blur event (refs #390)

Ruling 1ea561bc:793: the hosted qualification found the field becomes the page's
focused element with no focus, focusin, blur or focusout event, so the docs line
next to set_value says so.

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-18T00:38:49.798191Z e9f4e05 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.

@SSFSKIM
SSFSKIM merged commit 2e5b305 into main Nov 18, 2026
6 checks passed
SSFSKIM added a commit that referenced this pull request Nov 18, 2026
…sibility; keep 0.28.11

Sminos-Session: cursor235#b93055dd (cua on macbook)
SSFSKIM added a commit that referenced this pull request Nov 18, 2026
… plugin 0.28.12

The only conflicts were the plugin version in plugin.json and marketplace.json (main
0.28.11, this branch 0.28.10), resolved to 0.28.12. Main's changes (the macOS engine's
set_value without focus, the secrets docs and the surface text) touch no file of this
branch.

Sminos-Session: linux171#3c5ca588 (cua on dc-linux171-1e68)
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: background set_value in Chromium/Electron is refused where a write without the focus step delivers

1 participant