{"slug": "ai-agents-ask-for-passwords-i-made-sure-they-never-see-them", "title": "AI agents ask for passwords. I made sure they never see them", "summary": "A developer built AgentVault, an \"Agents\" tab inside the TenVault password manager for Windows (written in Rust with a Tauri GUI), which lets AI agents request secrets through an MCP server without ever seeing the master password. The MCP server (tenvault-mcp) communicates with the running app over a local HTTP bridge using a token file, and secret values are released only after user approval in the UI, under a lease with a default 3600-second TTL, with per-record sharing flags, daily request limits, process allowlists and an encrypted audit log. The developer argues this fixes a flaw in typical MCP secrets servers, which hold full access and can be exploited via prompt injection.", "body_md": "# \n  \n  \n  AI agents ask for passwords. I made sure they never see them\n\n*How to give an AI agent access to secrets without leaking them. Based on a real product: TenVault 1.0 / AgentVault (Windows, Rust + Tauri).*\n\n## \n  \n  \n  The problem that arrived quietly\n\nA year ago an \"AI agent\" was a toy: it wrote code and sometimes hallucinated. Today agents (Claude Desktop, Cursor, VS Code extensions, custom bots) work on real projects — which means they need **keys and passwords**: OpenAI, Stripe, databases, staging environments.\n\nThe usual workarounds are bad:\n\n1. \n**`.env` in the project.** The agent reads it. Best case it does not decide to \"improve\" the config or paste it into a 100k-token context.\n2. \n**Copy the key into a prompt.** It lands in logs, chat history and the provider's cache. Game over.\n3. \n**A cloud secrets manager.** Overkill for a personal project, and in some countries a data-residency and payment question.\n4. \n**Do nothing.** The agent simply cannot work with real secrets, and you paste keys manually every time.\n\nI wanted a third way: **secrets stay local, the agent gets them only with my consent and only for a while**. That is how AgentVault appeared — the \"Agents\" tab inside my password manager TenVault.\n\n## \n  \n  \n  What a regular MCP setup gets wrong\n\nMCP (Model Context Protocol) is the standard that connects tools to models. There are already servers that serve secrets from Vault/1Password/Bitwarden. Typical flow:\n\nThe problem: **the MCP server usually holds full access**. If it is compromised (or prompt-injected), the agent gets everything the token allows, without you noticing.\n\nWhat I wanted instead:\n\n- the agent sees **only the names** of the records you explicitly shared;\n- the value is released **after your approval in the UI** , not on request;\n- access is a **lease with a TTL** (one hour by default), not a permanent grant;\n- everything is written to an **audit log** you can read;\n- the master password is **never passed to the agent** and never sits in an env variable.\n\n## \n  \n  \n  How it works\n\nComponents:\n\n1. \n**TenVault desktop** — a Rust password manager (XChaCha20-Poly1305 + SQLCipher), GUI as a local HTTP server, tray icon.\n2. \n**tenvault-mcp** — an MCP server (stdio JSON-RPC). It talks to the running app over a**local bridge** (HTTP + token file), not through the master password.\n3. \n**Agents tab** — approvals, leases, limits, policies, audit.\n4. \n**Encrypted audit** — a separate file, key derived from user + machine + vault path.\n\nRequest flow:\n\nKey decisions:\n\n- \n**MCP never knows the master password.** It gets a bridge token from the running app. No app — no access (or an explicit \"agent key\" you can create and revoke).\n- \n**Per-record granularity.** A record has an \"Available to agents\" flag. Only those records appear in`list_secrets` .\n- \n**Categories.** Policies: API keys allowed, website passwords denied, records with notes separate.\n- \n**Leases.** A grant lives for a TTL (3600 seconds), the number of leases per record is limited (3), and \"revoke all leases\" is one click.\n- \n**Limits.** A daily request limit per agent; after exceeding it — denial and an audit entry. A denial starts a 10-minute cooldown to prevent request spam.\n- \n**Process checks.** off/warn/strict: in strict mode the agent only gets access if its parent process is on the allowlist (e.g.`cursor.exe` ).\n\n## \n  \n  \n  Setup, in practice\n\n1. Install TenVault (no admin rights needed).\n2. Optionally generate an \"agent key\" if the MCP server must work while the vault is locked.\n3. Point your client at the MCP server:\n\n1. The agent calls `get_secret(\"STRIPE_SECRET\")` and receives`-32003 confirmation required` until you press**Allow** .\n2. Then the agent repeats the call and receives the value, under a lease.\n3. Everything lands in the audit log: who asked, when, what, and how it ended.\n\n## \n  \n  \n  What is actually protected — and what is not\n\n**Protected:**\n\n- secret values never leave the machine;\n- the agent sees only shared records;\n- nothing is released without approval (or an explicit auto-grant);\n- access is time- and count-limited;\n- the audit is encrypted and accessible only to the user.\n\n**Not protected (being honest):**\n\n- if the agent is compromised and already has the value, it can use it until the lease expires;\n- prompt injection can make the agent *ask* for a secret — but it still needs your approval;\n- unsigned Windows binary: SmartScreen complains (code signing is planned);\n- no mobile approvals yet (in progress); meanwhile Telegram/VK notifications with buttons.\n\nIt is not a silver bullet — it is **surface reduction**: the agent has no standing access, and you have a log.\n\n## \n  \n  \n  Implementation notes\n\n- \n**Rust** for the core and the local GUI server: small binary, no C dependencies.\n- \n**Tauri + WebView2** for the window: the UI is plain HTML over a local server (easy to test).\n- \n**SQLCipher** for the database,**XChaCha20-Poly1305** for fields.\n- A **custom NSIS installer** (the Tauri bundler had to be bypassed), per-user install, start menu shortcut, clean uninstall.\n- \n**Updates:** download exe → verify SHA256 → install or swap → restart; rollback keeps the previous installer.\n- \n**Notifications:** local toast + sound; Telegram through a small PHP relay on our domain (in some regions`api.telegram.org` is not directly reachable), with**Allow/Deny buttons right in the message** .\n\n## \n  \n  \n  What is next\n\n- mobile approvals (the Android app exists; an \"Agents\" screen is being added);\n- ready-to-use configs for Claude Desktop and Cursor;\n- code signing and macOS (when resources allow);\n- more integrations: custom MCP clients, CI secrets.\n\n## \n  \n  \n  Links\n\n*How do you give secrets to your agents: `.env`, a password manager, cloud, or manually? Tell us in the comments.*", "url": "https://wpnews.pro/news/ai-agents-ask-for-passwords-i-made-sure-they-never-see-them", "canonical_source": "https://dev.to/cjdarklord/ai-agents-ask-for-passwords-i-made-sure-they-never-see-them-3p97", "published_at": "2026-11-22 01:06:11+00:00", "updated_at": "2026-11-22 01:12:27.198125+00:00", "lang": "en", "topics": ["ai-agents", "agent-protocols", "ai-safety", "developer-tools", "ai-tools"], "entities": ["TenVault", "AgentVault", "tenvault-mcp", "Model Context Protocol", "Claude Desktop", "Cursor", "VS Code", "Rust"], "also_reported_by": [], "takeaway": "Gating MCP secret access behind UI approval, per-record sharing flags and 3600-second leases keeps the master password out of the agent's reach and limits prompt-injection blast radius.", "recommendation": {"advice": "Route agent secret requests through an MCP server that holds only a bridge token, requires UI approval per record, and issues short-TTL leases with audit logging instead of permanent full-access grants.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/ai-agents-ask-for-passwords-i-made-sure-they-never-see-them", "markdown": "https://wpnews.pro/news/ai-agents-ask-for-passwords-i-made-sure-they-never-see-them.md", "text": "https://wpnews.pro/news/ai-agents-ask-for-passwords-i-made-sure-they-never-see-them.txt", "jsonld": "https://wpnews.pro/news/ai-agents-ask-for-passwords-i-made-sure-they-never-see-them.jsonld"}}