Secrets infrastructure for apps and AI agents
Surroga gives every app a handle instead of an API key. The real key stays in one place, and Surroga puts it on the request only on its way to the host you approved. A stolen handle is worthless.
Self-hosted and open source under AGPL-3.0. Runs on Docker Compose or any Kubernetes cluster.
How it works
Your code keeps reading the same variable and calling the same API. Only the value in its environment changes.
It calls the API as before, with Surroga as its HTTPS proxy. The handle looks like a key: gk_ and 32 characters.
Who is calling is proven by the platform, such as a Kubernetes service account. If this app may use this key for this host, the handle becomes the real key.
Before a byte reaches your app, every key it holds is cut from the answer, also URL-encoded, HTML-escaped, JSON-escaped or base64.
Why Surroga
No API, page, log or error returns a stored secret. Not to your app, not to the dashboard, not to the admin. There is no “reveal” button to steal.
Giving a key to a new app or host needs a passkey tap on a page Surroga serves on its own domain. A hacked dashboard or AI agent can only propose.
An agent sees handles only. It can list them, request a secret or propose a grant through a CLI and an MCP server, but never read a value or approve.
A handle used from the wrong app is refused and raises an alarm within a minute, with one tap to block a key or freeze everything.
Coverage
Header, Basic and query keys, AWS SigV4 re-signing, OAuth client tokens.
A wire proxy: the app logs in with a handle, the database sees the real password.
An SMTP relay that sends mail without your app holding the mail password.
Sign and verify JWTs and data through an API. Private keys never leave.
Webhooks verified, cookies wrapped and tokens re-signed for software you host.
gate-run wraps any program: fresh identity per connection, stand-ins in its settings.
21 provider recipes (Stripe, AWS S3, GitHub, OpenAI, Anthropic, Mollie and more) know where each key may go and which calls to deny.
Security
Before release, five adversarial reviews tried to break the rules as a hacked app, a hacked dashboard, a database admin, an AI agent and an outsider. Every finding came with working exploit code, and every exploit now runs on every commit.
Every API answer, page, log, audit entry, alarm and error is tested for it.
A passkey on Surroga’s own approval page signs exactly what the page showed.
Install
Run it on one machine with Docker Compose, or on any Kubernetes cluster with Helm. Start with test keys.
| Platform | How | Status |
|---|---|---|
| Linux server (any cloud or VM) | Docker Compose, server mode, Let’s Encrypt | Tested |
| macOS or Linux laptop | Docker Compose, local mode on 127.0.0.1 | Tested |
| Windows | Docker Desktop with WSL 2, local mode | Untested |
| Kubernetes (k3s, EKS, GKE, AKS, Talos…) | Helm chart with NetworkPolicies | Preview |
Early access. The source and the console image open with the first public release. Until then, access is by invitation.
You need Docker with Compose v2, git, and a browser that can create passkeys. Ports 8080 and 8443 must be free. Chrome and Firefox resolve gate.localhost and approve.localhost on their own; elsewhere add them to /etc/hosts.
Get the source and generate the configuration. init.sh writes .env and the master key, and prints a login and a one-time setup token.
git clone <repository> surroga cd surroga/deploy/compose ./init.sh local
Set GATE_CONSOLE_IMAGE in .env to the console image you were given, then start everything.
docker compose up -d --build
docker compose ps # postgres, core, console, caddy: runningOpen http://gate.localhost:8080, log in, click Open the core’s setup page, paste the setup token and register your passkey. From then on the setup token is refused. Register a second passkey on another device.
Try the demo: a secret, a grant for the demo app, and a call that arrives with the real key while the app only held a handle.
docker compose --profile demo up -d echo
# add secret + grant in the console, copy the handle, then:
HANDLE=gk_your_handle docker compose --profile demo run --rm demoTwo names, on purpose. Passkeys are bound to the approval host’s name. The console lives on another name, so a hacked console cannot use your passkeys.
Point two DNS names at the server, for example surroga.example.com and surroga-approve.example.com, and open ports 80 and 443.
Generate the configuration for those names. Caddy gets the certificates from Let’s Encrypt.
git clone <repository> surroga cd surroga/deploy/compose ./init.sh server surroga.example.com surroga-approve.example.com
Set the console image in .env, start, and register your first passkey as on a laptop.
docker compose up -d --build
Back up secrets/master.key separately from the database. Without it every secret is lost; with it and a database backup, every secret is exposed.
Preview. The chart passes helm lint and renders cleanly; it has not been installed on a customer cluster yet. Your cluster must enforce NetworkPolicy (Calico, Cilium, k3s, GKE Dataplane V2): the policies are what keep apps away from the console.
Create the secret the chart expects. The chart never generates keys, so an upgrade cannot replace them.
kubectl create namespace surroga kubectl -n surroga create secret generic gate-core \ --from-literal=master.key="$(head -c 32 /dev/urandom | base64)" \ --from-literal=setup-token="$(head -c 24 /dev/urandom | base64 | tr '+/' '-_' | tr -d '=')" \ --from-literal=database-url='postgres://gate:<password>@<host>:5432/gate?sslmode=verify-full'
Install the chart. ingressFrom selects your ingress controller; only it reaches the console and the approval port.
helm install surroga deploy/helm/gate -n surroga \
--set core.image.repository=<core image> --set core.image.tag=<tag> \
--set console.image.repository=<console image> --set console.image.tag=<tag> \
--set console.host=surroga.example.com \
--set approve.host=surroga-approve.example.com \
--set-json 'networkPolicy.ingressFrom=[{"namespaceSelector":{"matchLabels":{"kubernetes.io/metadata.name":"ingress-nginx"}}}]'Apps prove who they are with a projected service-account token (audience gate). Their workload is k8s:<namespace>/<service account>; no extra secret to hand out.
An app uses Surroga as its HTTPS proxy and trusts Surroga’s CA, because Surroga opens the TLS connection to find the handle. Put the handle where the app expects its key.
Any language or curl. Set the proxy and the CA, then call the API as usual.
curl -s http://core:8080/v1/ca.pem > surroga-ca.pem export HTTPS_PROXY=http://x:$WORKLOAD_TOKEN@core:8443 export SSL_CERT_FILE=surroga-ca.pem # Python, Go, curl export NODE_EXTRA_CA_CERTS=surroga-ca.pem # Node.js export STRIPE_KEY=gk_your_handle
Programs that read the proxy once. On Kubernetes the identity token rotates hourly. gate-run starts a local proxy that reads a fresh token for every connection and sets the proxy and CA variables for the program it starts.
gate-run -proxy http://gate-core:80 -core http://gate-core:80 -- node server.js
Postgres and mail. Connect to core:5432 or core:2525 with the password <handle>:<workload token>. Surroga logs in upstream with the real password.
Pricing
One unit: a protected app, meaning one workload that holds handles instead of keys. No per-request meter, no per-secret fee.
€0
forever
Early access
€0
up to 3 protected apps
Waitlist
€12
per protected app per month
Waitlist
€400
per month, from
Contact us
Why per app. Every call of a protected app passes through Surroga. Charging per request would punish that design and make your bill unpredictable.
Why not per secret. Per-secret pricing nudges teams to share one key between apps, which weakens the per-app alarms that make a stolen handle loud.
Questions
Usually not. The app reads the same environment variable and calls the same API. You set a proxy, trust Surroga’s CA, and replace the key with a handle.
Calls that need a key fail closed: nothing goes out with a wrong or missing key. Run two replicas; the core keeps no state outside its database.
In Postgres, each value encrypted with its own data key, wrapped by a master key you hold. Every row that decides where a value may go is signed and checked before use.
No. There is no read path, for anyone. To use a key somewhere new, you grant it, and you approve that with your passkey.
A secrets manager delivers the key to your app, where anything that can read the app can read the key. Surroga never delivers it; your app only ever holds a handle.