console fill: never copy Google session cookies by default (device-bound); own profile in a Chrome started without automation switches
Google binds its session cookies to the device (Device Bound Session Credentials) and signs out sessions whose cookies look stolen, which can sign the owner out of their real Chrome. The default is now storebound's own profile per store; storebound starts Chrome itself (--user-data-dir, --remote-debugging-port=0, no --enable-automation, navigator.webdriver false) and attaches over CDP. --use-chrome-session google|apple is an explicit opt-in that warns. /signin/rejected is said plainly.
This commit is contained in:
parent
e0bef82b06
commit
0035931734
22 changed files with 456 additions and 156 deletions
|
|
@ -9,8 +9,10 @@
|
|||
// - visible / persistent windows (`console fill`): STOREBOUND_CHROME, Google Chrome (channel "chrome"), then
|
||||
// Playwright's full Chromium (channel "chromium"). Never the headless shell: it has no window, and it drops session
|
||||
// cookies (no --restore-last-session), so a sign-in would not survive.
|
||||
// - "chrome" (console fill's copy of the owner's Chrome sign-in: only real Google Chrome can decrypt those cookies
|
||||
// with its own Keychain key): Google Chrome only.
|
||||
// - "chrome" (console fill's opt-in copy of the owner's Chrome sign-in: only real Google Chrome can decrypt those
|
||||
// cookies with its own Keychain key): Google Chrome only.
|
||||
// `console fill` itself does not launch through Playwright: it takes the executable from `persistentExecutable` (same
|
||||
// order) and starts Chrome on its own (cli/console/session.ts), so the window carries no automation switches.
|
||||
// A candidate that is not installed is skipped; one that IS installed but fails to start stops the search with its own
|
||||
// error (an earlier "Executable doesn't exist" never hides it). A persistent profile another browser still holds (its
|
||||
// SingletonLock names a live process) is reported as such before anything is launched.
|
||||
|
|
@ -149,6 +151,22 @@ export interface LaunchDeps {
|
|||
installed?: Installed;
|
||||
}
|
||||
|
||||
/**
|
||||
* The executable `console fill` starts itself (no Playwright launch, so no automation switches): kind "visible" =
|
||||
* STOREBOUND_CHROME, Google Chrome, then Playwright's full Chromium; kind "chrome" = Google Chrome only. Never the
|
||||
* headless shell. Nothing installed: the same error as withCandidates.
|
||||
*/
|
||||
export function persistentExecutable(kind: 'visible' | 'chrome', i: Installed, env: Record<string, string | undefined> = process.env): { label: string; path: string } {
|
||||
const list: { label: string; path: string }[] = [];
|
||||
if (kind === 'visible' && i.storeboundChrome) list.push({ label: `STOREBOUND_CHROME (${i.storeboundChrome})`, path: i.storeboundChrome });
|
||||
if (i.chrome) list.push({ label: `Google Chrome (${i.chrome})`, path: i.chrome });
|
||||
if (kind === 'visible' && i.chromium) list.push({ label: `Playwright Chromium (${i.chromium})`, path: i.chromium });
|
||||
if (list[0]) return list[0];
|
||||
const skipped = env.STOREBOUND_CHROME && !i.storeboundChrome && kind !== 'chrome' ? `; STOREBOUND_CHROME ${env.STOREBOUND_CHROME}: no such file` : '';
|
||||
throw new Error(`no usable browser (looked for ${LOOKED_FOR[kind]})${skipped}. `
|
||||
+ (kind === 'chrome' ? 'Install Google Chrome.' : 'Install Google Chrome, or run `bunx playwright install chromium` in your project; `storebound doctor` lists what is missing.'));
|
||||
}
|
||||
|
||||
/** A browser for renders and captures (headless unless `headless: false`). */
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export async function launch(root: string, opts: Record<string, unknown>, deps: LaunchDeps = {}): Promise<any> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue