TL;DR: When autonomous AI agents need to interact with modern web dashboards, handing them passwords or session tokens in prompts is a security disaster. I built Lightpanda Session Bridge — an open-source MV3 Chrome extension and a hardened loopback relay that safely replicates your live browser session into a local Lightpanda headless runtime via CDP. Zero credentials typed, zero secrets exposed to LLMs.
If you build AI agents that do real work on the modern web, you know the exact wall every developer hits: authentication.
The moment your agent needs to check an AWS billing console, inspect private logs on a SaaS dashboard, or pull data from an internal portal, the demo breaks down. Modern apps don’t live on basic auth; they sit behind Google OAuth, SSO federations, hardware passkeys, and biometric 2FA prompts.
A headless browser cannot tap your security key, answer your phone's authenticator app, or blink at a FaceID prompt.
Faced with this, most builders resort to terrible compromises: Hardcoding passwords into agent prompts or .env files (which leak into LLM context logs, chat histories, and traces). Copy-pasting session cookies manually into configs (which expire quickly and offer zero scoping or SSRF protection). Driving the user’s primary browser via raw CDP (which disrupts real work, risks hijacking other tabs, and introduces scary blast radiuses).
The Lightpanda Session Bridge is built on a different philosophy: keep the authentication ritual with the human, and hand the agent an isolated, authenticated runtime.
Passwords and API tokens are the wrong unit of trust for agents. They grant permanent, unrestricted access. Once an LLM agent has your password, you have zero guarantee where that string will travel — subagent handoffs, external telemetry, debug dumps, or third-party inference providers.
A session cookie is fundamentally safer: It is ephemeral and expires automatically. It can be instantly revoked from your main browser simply by logging out. It is strictly scoped to a single target origin.
With the bridge, you authenticate once in your familiar browser. When you click Sync, the extension packages only the cookies relevant to that specific origin and pushes them into an isolated headless browser instance.
The LLM never sees your credentials. The relay never logs a cookie value. The machine gets straight to work.
The architecture is purposely minimal, robust, and audit-friendly: The Chrome Extension (Manifest V3) Designed with a clean, dark Quota Glass interface. It requires only standard scoped permissions (activeTab, cookies, storage). When clicked, it captures cookies for the active domain, normalizes them, and prepares a transfer envelope.
On first launch, it executes an auto-pairing handshake (/v1/bootstrap) with the local relay, storing a shared cryptographic token in local isolated storage without requiring manual copy-pasting. The Hardened Loopback Relay (relay/server.py) Listening exclusively on 127.0.0.1:8765, the relay is the security gateway. It: Enforces strict origin matching. Translates browser cookie structures into Lightpanda-compliant DevTools protocol messages (including converting lowercase sameSite tags like lax to Lightpanda's PascalCase Lax to avoid -31998 InvalidEnumTag CDP crashes). Normalizes Host- and Secure- cookie prefixes per RFC 6265bis. Forwards cookies over CDP WebSockets to the headless engine. Lightpanda Headless Engine Lightpanda is an ultra-fast, open-source headless browser built in Zig with V8, purpose-built for AI automation. Running Lightpanda in WSL2 isolates it from your Windows host environment while keeping execution blindingly fast with tiny memory footprints compared to full Chromium.
Treating a local HTTP relay as a trusted boundary is how local privilege escalation happens. Because the relay accepts cookies, I designed it as an adversarial SSRF surface from day one: 🛡️ Zero Logging: Cookie names and values are never printed to stdout, logged to disk, or saved in history. 🔒 Loopback Only: Hardcoded binding to 127.0.0.1. No routable network interfaces exposed. 🚫 Strict Identity-Provider (IdP) Blacklisting: The relay automatically rejects transfers intended for identity roots — accounts.google.com, login.microsoftonline.com, appleid.apple.com, github.com, and auth0.com cannot be targeted. 🛑 SSRF IP & DNS Verification: Target domains must resolve to valid public IPv4/IPv6 addresses. Localhost aliases, 127.0.0.0/8, private subnets (10.0.0.0/8, 192.168.0.0/16), and wildcard DNS tools like nip.io are categorically dropped. DNS lookups are pinned with a 60-second cache to prevent time-of-check to time-of-use (TOCTOU) rebinding. 🔑 Origin-Restricted Handshake: Web pages or rogue local CLI scripts attempting to query /v1/bootstrap receive an immediate 403 Forbidden. Only callers presenting a legitimate chrome-extension:// Origin header can receive the pairing secret. 🧪 Live Verified: Backed by 9 automated security test suites, validating private IP rejections, CDP payload structures, and token enforcement.
Once the session is synced into Lightpanda, your agent script uses the bundled lightweight Python SDK (lightpanda_client.py):
Quickstart (Under 3 Minutes) Clone & Install Dependencies Launch Lightpanda & The Bridge Relay In two PowerShell terminals: Load the Extension Open chrome://extensions in Chrome, Comet, or Edge. Toggle Developer Mode on. Click Load unpacked and select the repository's extension/ folder. Open the popup once while the relay runs — it auto-pairs instantly. Navigate to any authenticated site, click the 🐼 icon, and hit Sync Session.
Honest Limitations Human-in-the-loop: You must click Sync once per session. This is an intentional security design choice, but it means this is built for supervised agent workflows, not headless server farms starting from scratch. Local machine only: The relay strictly refuses remote connections. Your agent script and your browser must reside on the same workstation or dev environment. Zig / WSL2 dependency: Lightpanda currently runs most smoothly on Linux/WSL2; the PowerShell scripts manage this automatically for Windows setups.
The project is fully open-source under the MIT license: 📦 GitHub Repository: Raknaos/lightpanda-session-bridge 🌐 Project Landing Page: raknaos.github.io/lightpanda-session-bridge 🏷️ Release v0.3.4 (Zip Packaged): GitHub Releases
If you're building autonomous agents that need to navigate authenticated environments safely, take it for a spin and star the repo! Feedback, issues, and PRs are warmly welcome.
