blindfill 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,215 @@
1
+ # Browsers and providers
2
+
3
+ blindfill drives a Playwright `Page`. How that page is obtained is a **BrowserProvider**
4
+ (`src/actuators/web/providers/`, one file per provider, registered in `registry.ts`).
5
+
6
+ | id | file | what it does | attach to a running browser |
7
+ | ----------------- | -------------------- | ------------------------------------------------------------------------------------------------------- | --------------------------- |
8
+ | `chromium-launch` | `chromium-launch.ts` | Playwright launches Chromium (bundled, or `--executable` / `BLINDFILL_CHROMIUM` / `web.executablePath`) | no (owns its browser) |
9
+ | `chromium-cdp` | `chromium-cdp.ts` | `connectOverCDP`, loopback only | yes |
10
+ | `firefox-connect` | `firefox-connect.ts` | Playwright browser-server websocket (Firefox / Camoufox), loopback only | yes |
11
+ | `ego-cli` | `ego-cli.ts` | supported: the running Ego Lite via `ego-browser nodejs` (`ego://new`, `ego://<space>/<page>`) | yes (Ego task spaces) |
12
+ | `borrowed-page` | `borrowed-page.ts` | library use: caller passes its own `Page` (`withPage(page, …)`); never closed by blindfill | n/a |
13
+
14
+ ## Connecting a browser
15
+
16
+ **Nothing configured.** `blindfill session start` launches its own Chromium (Playwright's bundled build, or any
17
+ Chromium-based browser via `--executable`, `BLINDFILL_CHROMIUM` or `web.executablePath`; headless unless `--headed` or
18
+ `web.headless: false`). It starts with an empty profile and `session stop` closes it.
19
+
20
+ **Your own running browser, set once.** Put the endpoint in `~/.config/blindfill/config.json` (or the file named by
21
+ `BLINDFILL_CONFIG`), for example one of:
22
+
23
+ ```
24
+ { "backend": "bw", "web": { "endpoint": "http://127.0.0.1:9222" } }
25
+ { "backend": "bw", "web": { "endpointFile": "/path/to/endpoint.json", "browser": "firefox-connect" } }
26
+ ```
27
+
28
+ Then `blindfill session attach` needs no arguments, and the other commands (`fill`, `page list`, …) connect to it
29
+ directly. Order: flags (`--endpoint`/`--cdp`, `--endpoint-file`, `--browser`) > environment (`BLINDFILL_ENDPOINT`,
30
+ `BLINDFILL_ENDPOINT_FILE`, `BLINDFILL_BROWSER`) > config (`web.endpoint` or its alias `web.cdp`, `web.endpointFile`,
31
+ `web.browser`). Any endpoint flag replaces all configured endpoints; an endpoint wins over an endpoint file.
32
+ Without `browser`, the provider is inferred: `http(s)://` or a `/devtools/` path is `chromium-cdp`, any other `ws://`
33
+ is `firefox-connect`. Endpoints must be loopback.
34
+
35
+ **Endpoint file.** JSON `{"endpoint": "ws://127.0.0.1:PORT/TOKEN"}`; other keys are ignored. Any launcher can write it
36
+ (keep it mode 0600: the token gives full control of the browser). blindfill re-reads it on every connect, so a
37
+ launcher may rewrite it with a new port or token on each start.
38
+
39
+ | Browser | How to make it attachable |
40
+ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
41
+ | Chrome / Chromium / Edge | start it with `--remote-debugging-port=9222`; endpoint `http://127.0.0.1:9222`. Chrome 136+ ignores that flag on the default profile directory, so also pass `--user-data-dir=<separate directory>`: a separate profile (log in there once). Never expose the port beyond loopback. |
42
+ | Firefox | stock Firefox cannot be driven by Playwright. Run a Playwright-compatible Firefox (Playwright's own build, or Camoufox) as a **Playwright browser server** from a small launcher (`firefox.launchServer()`, or a persistent context published with `browser.bind`) and write its `wsEndpoint` to an endpoint file. Client and server Playwright versions must match ([Firefox / Camoufox](#firefox--camoufox)). |
43
+ | Camoufox | the same, via `camoufox.server.launch_server` (no contexts: blindfill creates an empty one) or a launcher that publishes a persistent context. Example: Ollie's launcher on ollie-ubuntu writes `/run/user/$UID/camoufox-desktop/connection.json` (see below). |
44
+ | Ego Lite | no CDP and no Playwright server. Either the running app through `ego-cli` with endpoint `ego://new` (supported; values pass through Ego's Node runtime), or a separate instance that blindfill launches itself, `session start --executable '/Applications/ego lite.app/Contents/MacOS/ego lite'`, with an empty profile ([Ego Lite](#ego-lite)). |
45
+
46
+ ## Using them
47
+
48
+ ```
49
+ blindfill session start [--executable /path/to/chromium-based-browser]
50
+ blindfill session attach --endpoint http://127.0.0.1:9222 # chromium-cdp (inferred)
51
+ blindfill session attach --endpoint ws://127.0.0.1:PORT/TOKEN --browser firefox-connect
52
+ blindfill session attach --endpoint-file ~/.cache/x/endpoint.json --browser firefox-connect # JSON {"endpoint": "..."}
53
+ blindfill fill --item ID --url https://… --browser firefox-connect --endpoint …
54
+ ```
55
+
56
+ Endpoints must be loopback (`localhost`, `127.0.0.1`, `[::1]`). Playwright-server URLs contain a token:
57
+ it is redacted in errors, `session status` and `session attach` output. `--endpoint-file` is re-read on
58
+ every connect, so a rotating token works.
59
+
60
+ Library: `import { withPage } from 'blindfill'; await withPage(page, { backend }, (bf) => bf.fill({ item, submit: true }))`.
61
+
62
+ ## Firefox / Camoufox
63
+
64
+ Playwright requires the client and the server to be the same version. blindfill bundles playwright-core 1.65.1;
65
+ Camoufox 0.5.9 ships Playwright 1.62.0, and connecting with the bundled client fails with
66
+ `428 Precondition Required`. `firefox-connect` therefore tries, in order: `opts.playwrightModule`, env
67
+ `BLINDFILL_PLAYWRIGHT_CORE`, the bundled client, then the optional dependency `playwright-core-compat`
68
+ (= playwright-core@1.62.0). Also: the `[::1]` spelling does not work with 1.62.0, so it is retried as `localhost`.
69
+ Page JS runs in an isolated world: heuristics rely on DOM evidence, never on window globals.
70
+
71
+ **Contexts.** `camoufox.server.launch_server` starts a browser with **no** contexts: blindfill creates a new one
72
+ (empty profile; it ends when blindfill disconnects). A server that publishes a persistent context (Playwright
73
+ `browser.bind`, like Ollie's `~/.local/bin/camoufox-desktop`) already has one: blindfill reuses it (the profile's
74
+ cookies and logins) and treats it as shared:
75
+
76
+ - `--url` never navigates an existing tab. A tab already at the same origin + path is reused; otherwise blindfill
77
+ opens a tab with `window.open(url, '_blank', 'noopener')` from an open tab (with `browser.link.open_newwindow=3`
78
+ that is a tab, not a window; Playwright `newPage` would open a window).
79
+ - Without `--url`, the page is chosen as usual: `--page`, `--url-includes`, else the last http(s) tab.
80
+ - Disconnecting (end of a command, `session stop`) never closes the context or any tab, including the tab
81
+ blindfill opened. Origin binding, the one-shot submit and the post-fill lock are unchanged.
82
+ - Tabs that Firefox has not loaded (restored lazily, or unloaded) are not visible to Playwright until they load.
83
+
84
+ Ollie's shared Camoufox on ollie-ubuntu publishes its endpoint in `/run/user/$UID/camoufox-desktop/connection.json`
85
+ (`{"endpoint": "ws://127.0.0.1:PORT/TOKEN", ...}`, mode 0600, rewritten on every start):
86
+
87
+ ```
88
+ blindfill session attach --browser firefox-connect --endpoint-file /run/user/$(id -u)/camoufox-desktop/connection.json
89
+ blindfill page list
90
+ blindfill fill --item ID --url https://… --submit # opens its own tab next to Ollie's
91
+ BLINDFILL_MARIONETTE=127.0.0.1:2828 blindfill passkey --item ID --url https://… --click '#signin' # passkeys
92
+ ```
93
+
94
+ Tested (opt-in, `BLINDFILL_TEST_FIREFOX=1 npx vitest run tests/firefox.test.ts`): Camoufox 158.0.1-beta.41 from the
95
+ local install (`~/.local/share/camoufox-runtime`), throw-away HOME and profile, client playwright-core 1.62.0 via
96
+ `playwright-core-compat`, started two ways: `camoufox.server.launch_server`, and a persistent context published with
97
+ `browser.bind` with a user tab already open. Connect, probe, fill+submit once with post-fill lock, lookalike origin
98
+ refused, honeypot and SPA forms, `withPage`, CLI `session attach --endpoint-file`; on the persistent context: the user
99
+ tab is never navigated, blindfill's tab is reused for the same URL, both survive disconnect, and `page list` / `probe`
100
+ through the launcher's `connection.json`. The test skips cleanly when the flag or the Camoufox runtime is missing.
101
+ Read-only check on Ollie's running shared Camoufox (2026-11-27): `session attach` with its `connection.json`,
102
+ `page list` and `session stop` saw its tabs and left them; nothing was filled or logged in.
103
+
104
+ **Passkeys** (Phase 3): Juggler has no WebAuthn, so blindfill uses the browser's Marionette port next to it.
105
+ Start the browser with `-marionette` and the prefs `security.webauth.webauthn_enable_softtoken=true`,
106
+ `security.webauth.webauthn_enable_usbtoken=false` (real USB security keys stop working in that browser), then
107
+ give blindfill the port: `BLINDFILL_MARIONETTE=127.0.0.1:2828` (loopback only; library: `ProviderOptions.marionette`).
108
+ Each ceremony opens the single Marionette session, adds one authenticator, and ends both; it fails if another client
109
+ holds the session. The Firefox authenticator is browser-wide, not per tab. Firefox serves WebAuthn only to the
110
+ focused document, so blindfill brings the page to the front; in spike 2 a page in another context did not get a
111
+ signature while armed (it was not focused), which is a side effect of focus, not a boundary. Firefox cannot set the
112
+ backup-eligible flag: passkeys it registers are BE=0 and the item gets `blindfill.passkey_be=0`; Bitwarden-made
113
+ (BE=1) passkeys are signed with BE=0 as well (owner decision 2026-11-27), so a relying party that checks BE rejects
114
+ them: an ordinary failure, and the result's `note` says to use Chromium (which, like the Android host, signs with the
115
+ item's flag). Marionette lacks the W3C `WebAuthn:SetCredentialProperties` command; once Firefox adds it, BE can be set. Tested by the
116
+ same opt-in suite with Camoufox started with `-marionette`, the two prefs and `marionette.port=0`, on the owner's
117
+ Mac and on ollie-ubuntu (Linux); the shared Camoufox was not used.
118
+
119
+ ## Ego Lite
120
+
121
+ Chromium-based (0.6.3.17, Chrome/156), checked on the owner's Mac on 2026-11-27.
122
+
123
+ - Works via `chromium-launch` with a custom executable: `BLINDFILL_CHROMIUM='/Applications/ego lite.app/Contents/MacOS/ego lite'`
124
+ (or `--executable`). e2e 17/17 and session start/status/stop passed. It is a separate instance with an **empty profile**.
125
+ - **Cannot attach over CDP**: the running instance exposes no CDP and no Playwright server.
126
+ - `ego-cli` (**supported** since 2026-11-28, owner decision) reaches the running instance through Ego's own `ego-browser nodejs`: a script inside
127
+ Ego's Node runtime serves page operations over a private unix socket (0700 state dir, nonce, one client). It adapts the
128
+ slice of Playwright's Page / Frame / handle API that `WebActuator` uses, so origin binding, document binding, lock,
129
+ one-shot and scrubbing are unchanged. All page code runs in one blindfill isolated world per frame document; every text
130
+ input re-checks, inside Ego and in the same call, that the element's document still has the scanned origin and that the
131
+ element has focus.
132
+ Not available on Windows (refused): the socket protection relies on a 0700 unix-socket directory, and a named-pipe
133
+ port has not been written. Ego Lite itself has a Windows beta.
134
+ - Cross-origin (out-of-process) iframes (since 2026-11-28): each iframe target whose parent frame is listed is attached
135
+ from the page's session (`Target.attachToTarget`, non-flat: `page.cdp` cannot route a flat session); its commands go
136
+ out as `Target.sendMessageToTarget` and the replies come back through `page.events()`. Each frame's operations, typing
137
+ and its origin/focus re-check run on that frame's own session, so frame rules and document binding work as in Chromium.
138
+ - Use: `blindfill session attach --endpoint ego://new` (a new task space; `ego://` selects `ego-cli`) or
139
+ `--endpoint ego://72/p1` (a space this agent controls). A space blindfill creates keeps its page afterwards
140
+ (`BLINDFILL_EGO_KEEP=0` closes it).
141
+ - Limits: a rule submit of kind `js` is refused (no request interception); no passkeys; each connect starts an
142
+ `ego-browser` process (~1 s).
143
+ - Passkeys probe (2026-11-28, owner's Mac, screen locked): Ego accepts `WebAuthn.enable`, `addVirtualAuthenticator` and
144
+ `getCredentials` on `page.cdp`, but the page's `navigator.credentials.create()` never reached the virtual
145
+ authenticator (no WebAuthn event, no credential). The owner's Ego profile has the Bitwarden extension, which replaces
146
+ `navigator.credentials.create/get` on every page (https: the call waits for its UI; `localhost`: `NotAllowedError`).
147
+ With those overrides removed and focus emulated, the native call still failed at once with `NotAllowedError`. A second
148
+ probe in a task space on an Ego profile with no extensions (owner-approved, local fake RP only, one tab, space closed
149
+ afterwards) failed the same way, with and without focus emulation. Both ran while the Mac was locked, so a lock-screen
150
+ refusal cannot be told apart from Ego blocking WebAuthn on agent pages. `ego-cli` does not support passkeys.
151
+ - **Exception to the provider contract**: filled values pass through Ego's Node runtime (as CDP `Input.insertText`
152
+ parameters). Everything below was checked for that reason.
153
+ - Tested (`BLINDFILL_E2E_BROWSER=ego npx vitest run tests/e2e.test.ts`, owner's Mac, Ego Lite 0.6.3.17, 2026-11-28):
154
+ 31 passed, including the cross-origin frame rule fill and the replaced cross-origin rule frame.
155
+ - Disk leak test (2026-11-27, `ego-browser nodejs`, random fake password via `page.fill` and CDP `Input.insertText`): not
156
+ found in `~/Library/Application Support/Citro Labs` (~1 GB), `~/Library/Caches` or `~/Library/Logs`, immediately and after 45 s.
157
+ - **Outbound traffic check** (2026-11-28, owner's Mac, Ego Lite 0.6.3.17, `ego-cli` at `dbfe53f`; the provider has since
158
+ been adapted to the current `WebActuator`, typing path unchanged). Fake data only: a local
159
+ login page on `localhost` and a new random password per run, in the user's running Ego (its normal profile, no proxy,
160
+ no certificate, no restart).
161
+ - Capture: Ego's own `chrome://net-export` in "Include raw bytes" mode (TLS plaintext of everything Chromium's network
162
+ service sends, which is also where Ego's built-in Sentry envelope and PostHog batch endpoints live, both in the
163
+ browser binary) for about 3 minutes around the runs; plus every 0.3 s `lsof` of every other Ego process, and `nettop`.
164
+ - Runs: fill without submit; fill with submit; a script that typed a password, made failing CDP calls carrying it, crashed
165
+ the page's renderer (`Page.crash`), and ended with an uncaught exception and an unhandled rejection (to provoke Sentry);
166
+ the same error script again under `nettop` for 60 s.
167
+ - Result: the passwords appear in the capture **only** in the form POST to the local page (searched raw, URL-encoded,
168
+ hex, UTF-16 and base64 at all three alignments, in the whole log and in every decoded socket payload). No Sentry or
169
+ PostHog request was made during the window, including after the errors. The `ego Helper (Node)` process (where the
170
+ values pass) and the browser process opened no network sockets; all traffic was the network service's.
171
+ - Crash reports: the renderer minidump written by the crash does not contain the password (it does contain the page's
172
+ host); Crashpad uploads are disabled on this install (`settings.dat`: uploads off, never attempted).
173
+ - Not blindfill-specific but worth knowing: after a submit, Ego's password manager runs Chromium's **leak check**
174
+ (`passwordsleakcheck-pa.googleapis.com`, a hashed and encrypted lookup, over QUIC), as it does for a password a person
175
+ types in that profile; no login was saved (no new entries in any profile's `Login Data`). The same applies to any
176
+ user profile reached through `chromium-cdp`.
177
+ - Disk after all runs: none of the passwords (ASCII or UTF-16) in `~/Library/Application Support/Citro Labs`, `~/.ego`,
178
+ `~/.ego-browser`, `~/.local/share/ego` or `~/Library/Logs` (7,194 files, 1.46 GB).
179
+ - **Not covered**: QUIC payloads (net-export does not log them; in the window they went only to Google endpoints:
180
+ the leak check, the new-tab page and the optimization guide), telemetry that is batched and sent later than ~3
181
+ minutes, process memory, a version with Crashpad uploads on, Ego's agent features (Ego's own AI sidebar), the Ego
182
+ UI operation log, and future Ego versions.
183
+ - **Ego UI operation log: not checked** (omp has no macOS Accessibility permission to open the task-space panel).
184
+ - **Support decision** (Mics, 2026-11-28): `ego-cli` is supported. The outbound traffic check above is the only one (about
185
+ 3 minutes, fake page); a longer capture and the Ego UI operation log were not checked, and Mics accepted both (long-time
186
+ Ego user). A real-site sign-in through `ego-cli` is pending until this Mac has the agent's Vault key; it will be added to
187
+ [TESTED.md](TESTED.md). Re-run the traffic check after Ego updates.
188
+
189
+ ## Adding a provider
190
+
191
+ A provider implements `BrowserProvider` (`types.ts`):
192
+
193
+ ```ts
194
+ interface BrowserProvider {
195
+ id: string; // /^[a-z][a-z0-9-]*$/
196
+ title: string;
197
+ attachable: boolean; // may a saved session reconnect to it?
198
+ capabilities: ProviderCapabilities;
199
+ connect(opts: ProviderOptions): Promise<ProviderConnection>;
200
+ }
201
+ interface ProviderConnection {
202
+ page: Page;
203
+ context: BrowserContext;
204
+ browser: Browser | null;
205
+ capabilities: ProviderCapabilities; // evaluateIsolatedWorld, cdp, ownsBrowser, pagesSurviveDisconnect
206
+ close(): Promise<void>; // release OUR handle; close the browser only if ownsBrowser
207
+ }
208
+ ```
209
+
210
+ Contract: loopback only (use `assertLoopbackEndpoint`); never log or return the endpoint raw (`redactEndpoint`);
211
+ no secrets ever pass through a provider; don't navigate; `close()` must not kill a browser you don't own.
212
+ Steps: add `providers/<id>.ts`, `registerProvider(...)` in `registry.ts`, extend `inferProviderId` if the endpoint
213
+ shape is distinctive, add a section here. Test: `tests/providers.test.ts` shows a fake provider; for a real browser,
214
+ copy `tests/firefox.test.ts` (opt-in env flag, skip cleanly, isolated profile, never touch a user's browser) and make sure the
215
+ fill/lock/origin/honeypot cases and the leak test pass.
@@ -0,0 +1,92 @@
1
+ # Android: app sign-up, WebView logins and Credential Manager passwords through the companion
2
+
3
+ Status: built (2026-11-28) after the owner decisions in §6; test results in
4
+ [TESTED.md](../TESTED.md). Owner decision (Mics, 2026-11-27): the phone path replaces the earlier
5
+ internal tool's scrcpy control completely and goes through the companion APK. This page covers the
6
+ remaining phone gaps: **mobile registration** and
7
+ **WebView logins**, plus Credential Manager password sign-in. Android passkey registration was built
8
+ earlier (Phase 4, ARCHITECTURE §3.2).
9
+
10
+ ## 1. What the earlier tool did
11
+
12
+ - `profile phone NAME --device SERIAL --package PKG [--user N] --authorize [--submit]`: one-time
13
+ binding of a saved item to a native app (device serial, Android user, package; APK path fingerprint,
14
+ publisher checked), saved in a private profile; `login NAME --target phone` then typed the
15
+ stored username and password through scrcpy's control channel.
16
+ - `register-phone ITEM --device --package --password-selector XPATH --confirm-selector XPATH
17
+ [--submit-selector XPATH] (--check | --authorize) [--submit]`: the item's stored (already generated)
18
+ password, read once, typed into the new-password and confirm fields that restricted UI-XML XPaths
19
+ select; refuses extra password fields or overlapping bounds; never retries, never clears input
20
+ unless `--replace-existing`; no Autofill, package-only identity.
21
+ - WebViews: refused ("never trust a WebView's self-reported origin").
22
+
23
+ What changes: the Android system, not blindfill, names the app (AssistStructure package) and its
24
+ signer (PackageManager), and the fields (AutofillId, autofill hints, input type, HTML attributes),
25
+ so no XPath, scrcpy, focus or geometry checks and no typing. The value goes only into an autofill
26
+ Dataset or a Credential Manager response.
27
+
28
+ ## 2. Binding (D1)
29
+
30
+ As in Bitwarden, an app is bound by its package: `androidapp://<pkg>` on the item. A
31
+ `blindfill.signers` pin is optional; when the item has one, the signer must match. This applies to
32
+ password fills, sign-up, Credential Manager passwords, passkey sign-in and passkey registration.
33
+ Risk (SECURITY 21): a fake app with the same package name, installed where the real one is absent,
34
+ gets the password.
35
+
36
+ ## 3. App sign-up (password registration)
37
+
38
+ Two steps, as on the web (`item generate`, then fill): the vault holds the password before any app
39
+ sees it, so a crash between the steps never leaves an account whose password is not in the vault.
40
+
41
+ 1. **Item.** An existing item that binds the app (no opt-in since 2026-11-28),
42
+ or a new one: `blindfill item generate <name> --android <pkg> --username <u> [--origin https://…]
43
+ [--length n] [--policy-file f]`. The password is generated on the host (CSPRNG, item policy) and
44
+ never printed.
45
+ 2. **Fill.** `blindfill android register --item <id> --serial <s>` (MCP `android_offer` with
46
+ `kind: "password-new"`) arms kind `password-new`. The companion's FillService reports package,
47
+ signer, the number of password fields and whether one carries a new-password hint (`newPassword`
48
+ autofill hint or `autocomplete=new-password`). The host checks the binding and the sign-up shape
49
+ (two password fields, or one with the hint; more than two refused) before reading the password.
50
+ The Dataset fills the username field (if found) and the same password into both password fields.
51
+ 3. **Submit.** Not done by blindfill: the agent taps the app's button; the result carries
52
+ `registration_outcome: "unknown"`. One arm answers one fill; no retry. If the app rejects the
53
+ password, the item keeps a password the account does not have.
54
+
55
+ The companion never saves (`onSaveRequest` stays a no-op). Credential Manager has no "fill a sign-up
56
+ form" call (`CreatePasswordRequest` is an app saving a password the user typed), so sign-up goes
57
+ through autofill.
58
+
59
+ ## 4. WebView logins and sign-up (D3)
60
+
61
+ Each `ViewNode` inside a WebView carries `getWebDomain()` and `getWebScheme()` of its document. The
62
+ companion reports the first scheme and domain and the number of distinct ones. The host accepts a
63
+ WebView when the screen shows exactly one domain, the scheme is `https`, and the item binds
64
+ `https://<domain>` (`checkWebBinding`, host match by default). The app itself need not be bound
65
+ (owner decision: one item serves the site and the apps that embed it). The domain is reported from
66
+ the app's own process, so any app can claim any domain (SECURITY 22). Passkeys are not offered to
67
+ WebViews.
68
+
69
+ ## 5. Credential Manager password sign-in (D2)
70
+
71
+ Apps that call Credential Manager with `GetPasswordOption` instead of relying on autofill: while
72
+ armed as `password`, the provider (`PasskeyProvider`, capability `TYPE_PASSWORD_CREDENTIAL`) offers
73
+ one `PasswordCredentialEntry` "blindfill: <item>"; picking it starts `PasswordActivity`, which reports
74
+ the caller (package and signer from `CallingAppInfo`, `cm: true`) and returns a `PasswordCredential`.
75
+ The host applies the app binding (no form shape to check). A privileged caller (a browser passing an
76
+ origin) is reported as `web` without a domain and refused. One arm serves whichever comes first:
77
+ autofill or Credential Manager.
78
+
79
+ ## 6. Owner decisions (Mics)
80
+
81
+ - **D1** (2026-11-27): package-only binding like Bitwarden; a signer pin, when present, is checked.
82
+ - **D2** (2026-11-27): Credential Manager password sign-in built now.
83
+ - **D3** (2026-11-27): WebViews bound by the domain alone.
84
+
85
+ ## 7. Not covered
86
+
87
+ - Android user / work profile (the earlier tool's `--user`): the companion answers for the user it runs as;
88
+ not tested with a second profile.
89
+ - Asset Links (`assetlinks.json`) checks.
90
+ - Apps that block autofill (`importantForAutofill=no`, custom views): refused by absence; there is
91
+ no scrcpy fallback.
92
+ - Frames of another domain inside a WebView (refused: more than one domain), OTP fields in apps.
@@ -0,0 +1,229 @@
1
+ # LINE gateway password re-login through blindfill: evaluation
2
+
3
+ Status: evaluation only (2026-11-27). Nothing here is built; no code, service or setting was changed.
4
+ Claims marked **[observed]** were seen read-only on ollie-ubuntu on 2026-11-27 (file listings, code,
5
+ docs, permission listings; no file under `data/`, no token, session or secret value was read);
6
+ **[source]** come from the cited code or docs; **[inference]** were not verified.
7
+
8
+ ## 1. Verdict
9
+
10
+ - On ollie-ubuntu, Ollie (the LLM agent), the `bw` agent API key, the LINE service and the LINE
11
+ session token share Unix user `ollie`, which has `NOPASSWD: ALL` sudo (§5). Mics accepts this
12
+ (2026-11-27). So every option here keeps the password away from the model and its logs by
13
+ construction of the code path, not by an OS boundary; that is also true of today's handoff-tool path.
14
+ - **Recommended: (d)**, the LINE launcher reads the one item from Bitwarden itself with the agent
15
+ API key, bound by item id, and pipes it to LINEJS; no blindfill and no LLM in the path. About
16
+ 1 agent day; retires the legacy handoff tool for LINE; adds no secret-export path to blindfill; no weaker than
17
+ today (§4.4).
18
+ - **Not recommended: (a)**, a blindfill "local process" actuator. On a shared uid its
19
+ path/hash/uid binding is defeatable (§4.1), so it would cost 4-6 days and widen blindfill's
20
+ promise without protecting anything (d) does not.
21
+ - **(b)** is not available: LINE has no login surface blindfill supports that yields a LINEJS session.
22
+ - **(c) QR login** needs no password on the host at all and is the strongest option, but adds a
23
+ phone scan to every re-login; keep it as the fallback and let Mics choose (§6).
24
+ - Every password re-login already needs the phone: LINE asks for a PIN on the primary device
25
+ (§2). The option choice changes where the password lives, not whether a person is involved.
26
+
27
+ ## 2. The current path (a legacy internal handoff tool)
28
+
29
+ ### 2.1 Flow
30
+
31
+ ```mermaid
32
+ sequenceDiagram
33
+ participant S as systemd (user ollie)
34
+ participant L as start-with-credentials.py
35
+ participant D as Deno pilot.ts (LINEJS)
36
+ participant O as legacy handoff tool
37
+ participant P as Xperia (LINE primary)
38
+ S->>L: start linejs-pilot.service
39
+ L->>L: data/session.json has authToken?
40
+ alt saved token
41
+ L->>D: run without password
42
+ else no token
43
+ L->>D: spawn with --password-stdin, stdin = pipe read end
44
+ L->>O: handoff linejs-pilot --output-fd W --json
45
+ O->>O: load grant, check item id/name and field kinds
46
+ O->>D: one JSON line {username,password}, then EOF
47
+ O-->>L: {"status":"written_to_pipe"} (no values)
48
+ D->>D: withPassword(email, password, random 6-digit pincode)
49
+ D->>D: pincall: pin -> data/authentication.json, phase awaiting_pin
50
+ Note over P: human-authorized confirm-phone-pin.cjs types the PIN on the phone via adb
51
+ D->>D: authToken -> data/session.json
52
+ end
53
+ ```
54
+
55
+ - **Trigger [source]** (`systemd/linejs-pilot.service`, `start-with-credentials.py`): any start of
56
+ `linejs-pilot.service` with no `authToken` in `data/session.json` requests the password at once.
57
+ `Restart=on-failure`, `RestartPreventExitStatus=78`, at most 6 starts per 30 minutes. A password
58
+ login, a failed handoff, a provider-rejected saved token, or a launcher crash without a usable
59
+ token exits 78, so systemd never retries a password login; a person restarts it. The unit is
60
+ `linked`, not enabled at boot (password-pipe doc 2026-10-20), and runs under lingering user
61
+ `ollie` [observed: `Linger=yes`, unit active].
62
+ - **Grant [source]** (the handoff tool's `handoff.py`): a per-grant `handoffs/linejs-pilot.json` in its config directory
63
+ must be a regular file, mode 0600, one link, owned by the caller uid, at most 16 KiB, exact
64
+ schema. It pins item name **and** 32-hex item id, the fields (here `username`, `password`
65
+ [observed]), `format=json`, a `purpose` and `destinations`
66
+ (`https://legy.line-apps.com`, `https://gf.line.naver.jp` [observed]). Only `text`/`password`
67
+ kinds; TOTP seeds refused. `purpose`/`destinations` are declarations; the code does not check
68
+ them against the reader (the handoff tool's own documentation says so).
69
+ - **Pipe [source]**: the launcher makes `pipe2(O_NONBLOCK|O_CLOEXEC)`, sets the read end blocking,
70
+ hands it to Deno as stdin, and passes only the write end to the handoff tool (`pass_fds`). The tool dups
71
+ the FD and requires: FIFO named `pipe:[n]` in `/proc/self/fd`, same uid, write-only,
72
+ nonblocking, not aliased to fd 0-2. It reads every field first, writes one payload of at most
73
+ `min(4096, PIPE_BUF)` bytes in one `write`, 2 s default deadline (`--timeout`; the launcher waits
74
+ 15 s for the process), no retry on partial write or full pipe. Values never in argv, env, files
75
+ or stdout; errors are fixed codes.
76
+ - **Receiver [source]** (`credential-input.ts`, `current/sidecar/main.ts`): reads stdin to EOF,
77
+ max 4096 bytes, strict UTF-8, JSON object with exactly `password,username`, both non-empty;
78
+ zeroes its buffer; any failure is the single error `CredentialInputInvalid`. Deno permissions:
79
+ read/write only `data/` (plus read of `openclaw.json`), net only to four LINE hosts and the
80
+ bridge socket, env allowlist, `--cached-only --frozen` with a lockfile. A saved token wins over
81
+ piped credentials (`credentials = null`).
82
+ - **PIN / phone step [source]**: LINEJS `withPassword` sends a client-generated random 6-digit
83
+ pincode; LINE shows a confirmation on the primary device, and `pincall` writes the PIN to
84
+ `data/authentication.json` with status `awaiting_pin`. `confirm-phone-pin.cjs` (run on a
85
+ person's authorization) checks status `awaiting_pin` + `password_pipe`, that the Xperia
86
+ QV720B4852 foreground is `secondarylogin.legacy.DesktopLoginActivity`, that the screen matches a
87
+ saved screenshot (>= 97 % of sampled pixels), types the PIN as `adb shell input tap` over stdin,
88
+ checks the confirm button turned green, taps it once, and never replays. The QR path
89
+ (`--auth-only` without password, `render-qr.cjs`) also emits `pincall` when certificate
90
+ verification fails [source: LINEJS `base/login/mod.ts: requestSQR`].
91
+ - **History [observed, docs]**: first real login 2026-10-20 (password pipe, PIN typed via adb,
92
+ then token resume without password). Re-login 2026-11-19 used a separate `reauth-20261119/login-once.py`
93
+ (same handoff, `--auth-only`, own data dir); its status says `LoginError`, but
94
+ `docs/recovery-2026-11-19.md` records that the token was issued and the error came after
95
+ authentication (transport `/enc` 404), fixed by a release change. So password re-login is rare
96
+ (about monthly so far) and partly hand-run.
97
+
98
+ ### 2.2 Security properties of today's path
99
+
100
+ | Property | Holds? |
101
+ | ------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
102
+ | Password never in model context, argv, env, logs | yes, by construction of the launcher and the handoff tool [source] |
103
+ | Only one item and two fields can leave the store | yes for this grant [source]; but any same-uid process can call the handoff tool or Secret Service directly |
104
+ | Reader of the pipe is authenticated | **no**; the launcher is trusted to spawn the right reader, the grant says so itself [source] |
105
+ | Network destinations enforced | by Deno `--allow-net`, not by the handoff tool [source] |
106
+ | No automatic password retry | yes, exit 78 [source] |
107
+ | Isolation from Ollie (LLM agent with a shell) | **no**: same uid `ollie`, NOPASSWD sudo; accepted by Mics (§5) [observed] |
108
+ | Store unlocked without a person | `pass-secret-service` runs as "fresh unattended store" [observed unit description]; [inference] unlocked for any `ollie` process |
109
+
110
+ ## 3. What blindfill offers today
111
+
112
+ blindfill's invariant 1 is that no API returns a secret-class value; it only types into a sink whose
113
+ identity it observed: a web origin, or an Android package + signer (ARCHITECTURE §2, §3.2). There
114
+ is no local-process sink, and the pipe handoff stays out by design: a future, separately reviewed
115
+ sink would be an Actuator, not a read API.
116
+
117
+ ## 4. Options
118
+
119
+ ### 4.1 (a) blindfill "local process" actuator
120
+
121
+ Design if built: new actuator kind `process`. The item opts in with a Text field such as
122
+ `blindfill.process=<absolute path>` plus `blindfill.process_sha256=<hash>`; blindfill itself
123
+ spawns that executable (never accepts a caller FD, so it knows who reads), with fixed argv and
124
+ env from the item or a root-owned profile, stdin = anonymous pipe, writes the JSON once, closes,
125
+ reports only the exit status. Checks before the secret read: path is absolute, not a symlink,
126
+ owned by root or the service user and not writable by the caller uid, SHA-256 matches, the
127
+ running uid matches; one shot per call; MCP tool or CLI-only (MCP would let the LLM trigger it).
128
+
129
+ - **Threat model**: protects against the model receiving the value and against sending it to an
130
+ unlisted program, **only if the caller cannot change what the program does**. On the current
131
+ host it cannot: the consumer is not one file but `deno` + `pilot.ts` -> `current/sidecar/*.ts` +
132
+ the vendored LINEJS + `runtime/deno-cache`, all writable by `ollie` [observed: owned by `ollie`,
133
+ `current` is a symlink into `releases/`]. Hashing one binary proves nothing about the script
134
+ tree; hashing the tree is a release-pinning system. Same-uid `ptrace` of the Deno process
135
+ (default Yama scope 1 allows a parent; `sudo` allows anything) reads the password from memory.
136
+ - **Work**: actuator, item contract, spawn/pin/hash code, refusal tests with fake consumers,
137
+ docs, security review: **4-6 agent days**. Changes the product promise ("nothing returns a
138
+ secret" becomes "nothing returns a secret to the caller; one opted-in sink is a local program").
139
+ - **Maintenance**: every LINE release changes the hash, so every deploy edits a vault item; the
140
+ sink would be reused for other programs, which is exactly the export path blindfill avoided.
141
+
142
+ ### 4.2 (b) A login surface blindfill already supports
143
+
144
+ - LINE has no general web chat client. Its web sign-in (`access.line.me`) is LINE Login, an OAuth
145
+ provider for third-party sites; it does not yield a LINEJS/Talk session [inference, public LINE
146
+ docs]. The LINE Chrome extension signs in with email + password + phone PIN, but its session is
147
+ inside a `chrome-extension://` origin that blindfill does not support, and moving that session
148
+ into LINEJS would mean extracting the extension's tokens, i.e. a bypass [inference].
149
+ - The LINE Android app on the Xperia is the primary device, not a secondary login target; blindfill
150
+ Android fill cannot produce a desktop/LINEJS session [inference].
151
+ - **Verdict: not available.** Work: none. Do not pursue.
152
+
153
+ ### 4.3 (c) QR login (no password at all)
154
+
155
+ LINEJS already supports it: `main.ts` with `--auth-only` and no stdin password runs
156
+ `withQrCode`, writes the QR URL to `data/authentication.json`, and `render-qr.cjs` renders a private
157
+ PNG valid for 5 minutes [source]. The primary phone scans it; LINE may then ask for a PIN
158
+ (the same `pincall` and `confirm-phone-pin.cjs` path) [source].
159
+
160
+ - **Threat model**: the best of all options; no password is stored on the host, so nothing to
161
+ leak. The QR URL is a short-lived login capability and must stay out of model context, same as
162
+ today's PIN.
163
+ - **Cost**: a phone scan per re-login. The Xperia must scan a QR shown elsewhere (camera) or read
164
+ it from an image; whether LINE's scanner accepts an image pushed by adb, and whether automating
165
+ that is acceptable, is unverified [inference]. Mics or Ollie is involved at each re-login.
166
+ - **Work**: launcher change to stop calling the handoff tool and exit 78 with "QR login needed", plus a
167
+ runbook: **0.5 agent day**. Maintenance: none beyond today's PIN script.
168
+
169
+ ### 4.4 (d) Launcher reads Bitwarden itself (Mics' proposal)
170
+
171
+ The launcher (not an LLM, not blindfill) runs `bw` with the agent API key from
172
+ `~/.config/bw-agent/env`, gets the item by **id**, checks its name and the presence of `login.username`
173
+ and `login.password`, builds the same one-line JSON and writes it into the existing Deno pipe.
174
+ Implementation notes:
175
+
176
+ - `bw get item <id>` with `BW_SESSION` only in the child env, `stdout` captured into the launcher's
177
+ memory, never logged; `stderr` dropped; fixed error codes in `launcher-status.json`, as today.
178
+ Separate `BITWARDENCLI_APPDATA_DIR` so the LINE path does not log out other `bw` users (`bwu`
179
+ runs `bw logout` and re-logs in on every call [source: `~/.local/bin/bwu`]).
180
+ - Keep the handoff tool's guarantees in the launcher: item id + name pin, payload <= 4096, one write,
181
+ no retry, exit 78.
182
+ - Unlock: `bwu` derives a session from the API key alone; how an API-key login unlocks this
183
+ Vaultwarden account without a master password was not checked [inference; check `bw status`
184
+ once, which prints no secret].
185
+ - **Threat model (now, same uid)**: equal to today. The API key file is readable by every `ollie`
186
+ process; it reads every item the agent account can see, a wider scope than the handoff grant,
187
+ but Ollie can already use that same key through `bwu`. Gains: one store instead of two, the
188
+ handoff tool retired for LINE, no new blindfill surface. Loss: no per-item grant file; the item id lives in
189
+ the launcher.
190
+ - **Work: about 1 agent day** (launcher change, synthetic pipe test with a fake `bw`, one
191
+ supervised real re-login with Ollie's consent, docs). Moving the LINE item into the vault is a
192
+ Vault change and needs Ollie's/Mics' approval. Maintenance: low; `bw` CLI upgrades.
193
+
194
+ ### 4.5 Comparison
195
+
196
+ | Option | Password on host | Agent days | Ongoing cost |
197
+ | ----------------------- | -------------------- | ---------- | ----------------------------- |
198
+ | today (handoff tool) | yes (Secret Service) | 0 | second store |
199
+ | (a) process actuator | yes (vault) | 4-6 | hash per release, new surface |
200
+ | (b) web/app login | n/a | none | not available |
201
+ | (c) QR | **no** | 0.5 | phone scan per re-login |
202
+ | (d) launcher reads `bw` | yes (vault) | 1 | low |
203
+
204
+ None of (a), (d) or today's path is isolated from Ollie on this host (§5); (c) has nothing to steal
205
+ except a 5-minute QR capability.
206
+
207
+ ## 5. Host status and owner decision
208
+
209
+ **[observed]** `ollie` (uid 1000) is in groups `sudo`, `adm`, `lxd` and has `(ALL) NOPASSWD: ALL`;
210
+ `~/.config/bw-agent/env` (0600, owner `ollie`) holds `BW_CLIENTID`/`BW_CLIENTSECRET`, and
211
+ `~/.local/bin/bwu` turns it into an unlocked `bw`; OpenClaw, `linejs-pilot` and
212
+ `pass-secret-service` run as user services of `ollie`. So Ollie, which has a shell, can read any
213
+ password the agent account sees with `bwu get password`, and the LINE `data/session.json` token.
214
+ blindfill's "never returns a secret" holds for its own interfaces only; on this host it rests on
215
+ the agent not going around it. **Mics decided on 2026-11-27 to keep this as it is: no separate Unix
216
+ user for the key, blindfill or the LINE gateway, no sudo change** (recorded in `HANDOFF.md`, owner
217
+ decisions). Options above are judged under that premise. If isolation is revisited, the per-user
218
+ split is void while `ollie` keeps NOPASSWD sudo or `lxd`, and (d) would then move to its own user
219
+ with a LINE-only vault account rather than need (a).
220
+
221
+ ## 6. Decisions for Mics
222
+
223
+ 1. **Re-login method**: (d) password from the vault via the launcher (recommended, ~1 agent day),
224
+ or (c) QR only (no password on the host, phone scan each time, ~0.5 day). "LINE goes through
225
+ blindfill" read literally is (a); this document recommends against it.
226
+ 2. **Moving the LINE item into the Vault** (from the handoff tool's Secret Service): a Vault change; which
227
+ collection, and Ollie's consent.
228
+ 3. **One supervised real re-login** to verify (d) or (c): it logs the LINE gateway out and back in,
229
+ so it needs a time window and someone at the Xperia for the PIN.