/credentials — never see the secret
Any task mentioning login / credentials / password / sign-in / token fires this. Secrets never pass through the model. Anything asked in chat round-trips through the LLM and lands in session logs — so never ask in chat.
Protocol (stop, pick ONE channel)
- Detect login/creds intent in the task. Pause the happy path.
- Tell the user which channel to use. Never request the value in chat
(no
vscode_askQuestions, no "please provide your password"). - Use the value, never print it; redact it if it ever shows up in args/output.
Channel A — user types into the real browser (preferred, mcp_webrain-*)
webrain launch <service> <profile> <url> — real Chrome opens headed on a
persistent profile, the user types the creds into the site's login window,
the session is saved to the profile, and webrain re-attaches to the same CDP
session. You get the authenticated session, never the password.
Channel B — env vars (no browser, or --creds)
User sets the secret in the terminal (never in chat):
$env:WEBRAIN_USER = "..." # typed by user
$env:WEBRAIN_PASS = Read-Host "password" # typed by user
Then webrain login <service> <profile> (or webrain_session(op=login)) reads
them by name — never inline the values, never echo them.
Channel C — local vault (fully automatic, preferred for repeat logins)
One-time enroll, then the LLM logs in with zero user typing:
webrain vault set <service> <profile> --username <user> # hidden prompt, once
webrain_session(op="profiles")→ returns ids/usernames only — never secrets.webrain_session(op="login", service=…, profile=…, url=…)→ the server decrypts in-process and fills the browser via CDP (selector overrides optional); the reply is status-only. The value never leaves the server process.- Storage:
~/.config/webrain/vault.json(AES-256-GCM) +vault.key(0600). Two files — copy both to any Windows/macOS/Linux/Docker box, no OS daemon.
Rules
- Never call any chat/ask tool for a secret value; the answer is logged.
- Never paste a credential into a command, tool arg, or file visible in the conversation.
- Never pass a secret as a tool argument — pass a vault reference (profile id) and let the server resolve it.
- Redact immediately if a credential appears in output.
- Same rule for every MCP server (webrain, codebase-memo, …), not just webrain.
