What is AgentSecrets?
The Zero-Knowledge Difference
How AgentSecrets Works
Installation
Quick Start
Migrating from .env Files
Migrating from Vault / AWS
Migrating from dotenv-vault
Production Checklist
Credential Exposure
What Zero-Knowledge Means
The Proxy Model
The Three-Layer Model
Environments
Agent Identity
Storage Modes
The No get() Principle
Secret-Level Policies
Cloud Overview & Architecture
The Dual-Engine Model
Cloud Resolver Data Plane
Workload & Agent Tokens
Egress Allowlists & Audit Streams
Cloud REST API Reference
Account (init / login)
Server & Self-Hosting (server)
Docs
Shell Autocompletion
Keychain Auth
Secrets
Environments
Credential Proxy
env Injection
Workspaces & Teams
Projects
Agent Identity
Audit & Governance
Integrations Overview
Claude Desktop
Cursor
OpenClaw
HTTP Proxy (Any)
LangChain (Soon)
CrewAI (Soon)
CI/CD Pipeline
SDK Overview
Python SDK
Python API Reference
Python SDK Manual Testing
JavaScript SDK (Soon)
Ecosystem Overview
Zero-Knowledge MCP Server
Server Overview
5-Layer Architecture
Self-Hosting Guide
Authentication & Keys
Workspaces & Teams
Projects & Scope
Environments
Secrets & Sync Protocol
Agent Identity Resolution
Telemetry & Metrics Engine
Audit Log Sync
API Endpoint Reference
Security Overview
Anti-Impersonation & Process Verification
Encryption Model
Zero-Knowledge Sync
Proxy Security Layers
Threat Model
OWASP Top 10 Mitigation
Security FAQ
Third-Party Audit
Reporting Vulnerabilities
Guides Overview
Building on the SDK
Stripe Integration
OpenAI Integration
Multi-Agent Setup
Onboarding Team
CI/CD Pipeline
Publishing ZK MCP
Rotating Credentials
Auditing Team Activity
Dev to Production
Kubernetes Deployment
Monorepo Setup
Production Proxy Hardening
vs .env Files
vs HashiCorp Vault
vs AWS Secrets Manager
vs dotenv-vault
vs Infisical
When Not to Use
Proxy Not Starting
Proxy Not Resolving
Domain Blocked
Sync Conflicts
MCP Not Connecting
Session Token Errors
Proxy Session Authorization
Keychain Storage & Backends
SSRF & Destination Rules
Installation Issues
Error Codes Reference
Frequently Asked Questions
v3.1.x
v3.0.0
v2.1.0
v2.0.0
v1.4.0
v1.3.x
v1.2.0
v1.1.x
v1.0.x
CLI ReferenceProxy vs env Injection

Proxy Injection vs. Environment Injection

AgentSecrets supports two primary integration models for securing credentials: Local Proxy Interception and Startup Environment Injection. While both models store secrets securely in the local OS Keychain and sync them via end-to-end encryption, they enforce different security boundaries at runtime.


Side-by-Side Comparison

FeatureLocal Proxy Interception (Mode 1)Startup Environment Injection (Mode 2)
MechanismIntercepts HTTP/HTTPS requests at the network transport layerSpawns a child process with temporary environment variables in RAM
Plaintext in RAMStructurally absent from the target process memoryExists in process environment variables (process.env / os.environ)
Prompt Injection ProtectionComplete (agent has no access to the credential value)None (agent can inspect environment variables)
Integration ComplexityRequires routing requests through the proxy (via SDK or proxy port)Zero code changes required (prefix execution command)
Outgoing Domain AllowlistEnforced at the network boundaryEnforced only if proxy routing is also configured
Client Code CompatibilityRequires HTTP clients to support proxy configuration or headersWorks natively with all existing tools and libraries

Zero-Knowledge Tradeoffs

The Proxy Model (Mode 1)

In the proxy model, secrets never touch your application process memory. Your code refers to credentials by their name reference (e.g. STRIPE_KEY or OPENAI_KEY).

The proxy intercepts outbound network calls, validates that the target domain is on the allowlist, retrieves the value from the keychain in its own isolated process space, injects the key into the HTTP headers, and forwards the call.

  • Advantage: Absolute security boundary. Even if the application process is compromised or hijacked by malicious code, the plaintext secrets cannot be read because they do not exist within that process.
  • Tradeoff: Outbound HTTP traffic must be configured to pass through the local proxy endpoint (localhost:8765).

The Environment Model (Mode 2)

Using agentsecrets env -- <command>, AgentSecrets reads requested keys from the OS Keychain, resolves their values, and injects them as standard system environment variables when launching the target process.

  • Advantage: Perfect compatibility. Any legacy CLI, tool, or server can run immediately without code changes.
  • Tradeoff: Secrets live in the target process RAM for the duration of the execution. If an AI agent has the ability to run shell scripts, read system environment blocks, or execute arbitrary code, it can extract the plaintext keys.

When Environment Injection is Appropriate

Use agentsecrets env when:

  1. Running legacy CLI tools: Traditional scripts and services that require environment variables and cannot be configured to use HTTP proxies.
  2. Local test execution: Running tests via agentsecrets env -- npm test or agentsecrets env -- pytest where prompt injection is not a risk.
  3. Internal developer workflows: Securing database passwords and credentials on developer machines without writing plaintext .env files to disk.

When the Proxy is Required

Use the local proxy or SDK when:

  1. Running autonomous AI agents: Any agent that processes user-generated queries, handles files, or uses tools dynamically.
  2. Handling untrusted code or plugins: If your application loads third-party plugins, packages, or LLM-assisted runtimes.
  3. Enforcing network egress policies: Restricting outgoing requests to allowed domains, preventing compromised packages from exfiltrating data.
Was this helpful?
Thanks for your feedback!
Your feedback helps us improve the platform.