Your agent's code doesn't change. Use credential names where you'd use raw secrets. The proxy handles injection, approval, and sanitization.
The problem
A prompt injection can trick an agent into leaking API keys through the target API itself.
An agent with raw keys can delete data, send messages, or make purchases with no human in the loop.
API responses can echo credentials back. Without sanitization, your agent now has the raw secret.
How it works
The agent sends X-AgentSec-Credential: slack and the target URL. It never sees the actual API key.
GET requests auto-approve. Writes go to your device for one-tap approval. You see the full request before it goes out.
The proxy injects real credentials, forwards the request, scrubs secrets from the response, and returns clean data to the agent.
Same skills, safer
Authorization: Bearer sk-live-a1b2c3d4e5f6...
X-Api-Target: slack.com/api/chat.postMessage X-AgentSec-Credential: slack
X-AgentSec-Target: slack.com/api/chat.postMessage Same skill, same API call. Swap the raw secret for a name. The proxy handles the rest.
Capabilities
Agents reference credentials by name. The proxy holds the secrets. Compromise the agent, the keys stay safe.
Auto-approve reads, require approval for writes. URL-pattern overrides for fine-grained control. Fail closed by default.
Scrubs credential values from API responses -- exact match, base64, and URL-encoded variants. Up to 10 MB.
Credentials in a tweet body or email subject? Rejected. Placeholders are only allowed in auth-position headers and fields.
Direct injection for API keys. Sidecar routing for OAuth 1.0a, OAuth 2.0, and custom protocols. One interface for the agent.
Every request logged with agent ID, credential, approval status, upstream response, and latency. JSON lines for easy ingestion.
Open source. Self-host for free, or let us run it on hardware enclaves.
$ git clone https://github.com/nanaknihal/agentsec
$ cd agentsec
$ cp local.env.example .env
$ # fill in .env with your keys
$ docker-compose -f docker-compose.yaml -f docker-compose.local.yaml up --build