mirror of https://github.com/garrytan/gstack.git
Core of an opt-in layer that lets a device-trust cookie survive a headless
daemon restart. The daemon uses a non-persistent Playwright context, so a
restart drops all in-memory cookies and a __Host--bound web device identity
re-registers on the next visit.
This module (no wiring yet):
- isAutoCookiePersistEnabled: gated on BROWSE_AUTO_COOKIE_PERSIST (off by
default — auto-persisting auth cookies to plaintext-on-disk is a security
escalation from ephemeral-profile semantics, so it must be opt-in).
- filterPersistableCookies: persistent (expires !== -1, unexpired) cookies
only; drops session cookies, internal-network domains, and honors an
optional BROWSE_AUTO_COOKIE_DOMAINS allowlist. Fields (incl. __Host-
host-only domain and partitionKey) preserved verbatim.
- load/save as a Playwright storageState-shaped object ({cookies, origins:[]});
never persists localStorage/pages. Hash short-circuit skips no-op writes.
- Per-workspace state file keyed by hash(realpath(projectDir)) + a mkdir-atomic
exclusive lock with conservative dead-pid stale reclaim, so concurrent
daemons (separate worktrees) never last-writer-wins the same slot.
- Writes go through writeSecureFileAtomic; a one-time plaintext warning fires
when enabled.
Validated against Playwright 1.58.2: a persistent __Host- cookie survives the
cookies() -> JSON -> newContext({storageState}) round-trip intact.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| bin | ||
| scripts | ||
| src | ||
| test | ||
| PLAN-snapshot-dropdown-interactive.md | ||
| SKILL.md | ||
| SKILL.md.tmpl | ||