Skip to content

the box says what kind of box has focus on the page in front, so a password is typed only into a password box - #38

Merged
hexuria merged 1 commit into
mainfrom
gol/focused-field
Oct 10, 2026
Merged

hexuria merged 1 commit into
mainfrom
gol/focused-field

Conversation

@hexuria

@hexuria hexuria commented Oct 10, 2026

Copy link
Copy Markdown
Owner

Why

On 10 Oct 2026 a saved-login fill typed the password into Facebook's email box, in plain sight, and pressed Log in. The fill clicks where the AI said each field is, and that click landed on the wrong box. The server had no way to know which box had focus.

What

  • docker/active-tab/focus.js is a new content script on every page, top frame only. It tells the extension what kind of box has focus: password, text (email, tel, search, url, number, textarea or contenteditable), other, or none. It sends only that word, never the box's contents or anything else of the page. It reports on focusin, focusout and input, so a "show password" toggle is seen.
  • background.js keeps each tab's last focus kind and sends it with the page in front. A new page counts as unknown until it reports.
  • box-host active_tab records focus (only those four words; anything else is dropped) and seq, which counts the browser's reports. GET /v1/chrome/active-tab now answers {url, atMs, focus, seq}. A reader that clicked a field waits for seq to move before it trusts focus.
  • The manifest gains content_scripts (<all_urls>, document_idle). Permissions are unchanged: tabs and nativeMessaging.

Tests

  • New: each_report_says_what_kind_of_box_has_focus. Reports come through numbered, and a word outside the four is dropped.
  • cargo test --workspace --no-fail-fast: everything passes except jail::tests::absolute_inside_ok, which fails only on macOS (the /var → /private/var temp-folder symlink) and is unchanged since well before this PR. Clippy -D warnings and fmt are clean. node --check passes on both scripts, and the manifest parses.

Live check (image built from this branch, grok-box:local 47946f03)

A throwaway container served a test login page: an email box with autofocus, then a password box. I drove it with the box's own /v1/cua/key and read GET /v1/chrome/active-tab:

step report
page open, email focused "focus":"text","seq":5
Tab to the password box "focus":"password","seq":7
Tab off the form "focus":"none","seq":8
Shift+Tab back "focus":"password","seq":9

The server half is hexuria/opengrok-server (gol/fill-right-box). It reads focus and seq and refuses to type a password anywhere but a password box.

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