Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.
TypeScript acmeagentsai-agentscertificate-managementdevsecopsenvironment-variableskubernetesopen-sourcepampkipostgresprivate-caprivileged-access-managementsecret-managementsecret-managersecretssecrets-managementsecuritysecurity-toolsvault
fix(agent-proxy): let user tokens report proxied-service usage (#7426)
Saif Ur Rahman2466ee4fa875
diff --git a/backend/src/ee/routes/v1/proxied-service-router.ts b/backend/src/ee/routes/v1/proxied-service-router.tsindex 6bd3fa3f5b..43dd0e8c48 100644--- a/backend/src/ee/routes/v1/proxied-service-router.ts+++ b/backend/src/ee/routes/v1/proxied-service-router.ts@@ -205,7 +205,7 @@ export const registerProxiedServiceRouter = async (server: FastifyZodProvider) =method: "POST",url: "/:serviceId/report-usage",config: { rateLimit: writeLimit },- onRequest: verifyAuth([AuthMode.IDENTITY_ACCESS_TOKEN]),+ onRequest: verifyAuth([AuthMode.JWT, AuthMode.IDENTITY_ACCESS_TOKEN]),schema: {hide: true,tags: [ApiDocsTags.ProxiedServices],diff --git a/backend/src/ee/services/permission/default-roles.ts b/backend/src/ee/services/permission/default-roles.tsindex d5094c38ee..f771f3961a 100644--- a/backend/src/ee/services/permission/default-roles.ts+++ b/backend/src/ee/services/permission/default-roles.ts@@ -584,7 +584,10 @@ const buildMemberPermissionRules = () => {can([ProjectPermissionHoneyTokenActions.Read], ProjectPermissionSub.HoneyTokens);- can([ProjectPermissionProxiedServiceActions.Read], ProjectPermissionSub.ProxiedServices);+ can(+ [ProjectPermissionProxiedServiceActions.Read, ProjectPermissionProxiedServiceActions.ReportUsage],+ ProjectPermissionSub.ProxiedServices+ );can([@@ -730,7 +733,10 @@ const buildViewerPermissionRules = () => {can(ProjectPermissionIdentityActions.Read, ProjectPermissionSub.Identity);can(ProjectPermissionActions.Read, ProjectPermissionSub.ServiceTokens);can(ProjectPermissionHoneyTokenActions.Read, ProjectPermissionSub.HoneyTokens);- can(ProjectPermissionProxiedServiceActions.Read, ProjectPermissionSub.ProxiedServices);+ can(+ [ProjectPermissionProxiedServiceActions.Read, ProjectPermissionProxiedServiceActions.ReportUsage],+ ProjectPermissionSub.ProxiedServices+ );can(ProjectPermissionActions.Read, ProjectPermissionSub.Settings);can(ProjectPermissionActions.Read, ProjectPermissionSub.Environments);can(ProjectPermissionActions.Read, ProjectPermissionSub.Tags);diff --git a/docs/cli/commands/agent-proxy.mdx b/docs/cli/commands/agent-proxy.mdxindex 3d1465d024..2148de3e73 100644--- a/docs/cli/commands/agent-proxy.mdx+++ b/docs/cli/commands/agent-proxy.mdx@@ -4,39 +4,235 @@ description: "Run the Infisical Agent Proxy and connect agents to it"---<Tabs>- <Tab title="Start the agent proxy">+ <Tab title="Local proxy (run)">```bash- infisical secrets agent-proxy start [options]+ infisical secrets agent-proxy run [options] -- [agent start command]# Example- infisical secrets agent-proxy start --port 17322+ infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- claude```+ `run` on its own is the whole setup.+</Tab>- <Tab title="Connect an agent">+ <Tab title="Standalone proxy (start + connect)">```bash+ # On the proxy host+ infisical secrets agent-proxy start [options]++ # On each agent hostinfisical secrets agent-proxy connect [options] -- [agent start command]- # Example (flags)+ # Examples+ infisical secrets agent-proxy start --port 17322infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --projectId=<project-id> --env=prod --path=/ai-agents -- claude-- # Example (configuration from environment variables)- infisical secrets agent-proxy connect -- claude```+ `start` and `connect` work as a pair, on different hosts.+</Tab></Tabs>## Description-Run the [Infisical Agent Proxy](/documentation/platform/agent-proxy/overview): `start` launches the proxy that brokers real credentials onto agent traffic on the wire, and `connect` launches an agent behind it with the proxy routing, CA trust, and dummy placeholder credentials already set up.+These subcommands run the [Infisical Agent Proxy](/documentation/platform/agent-proxy/overview), which brokers real credentials onto your agents' traffic on the wire. Which you use depends on where the agent runs:++- `run` is for an agent on your own computer. It does the proxy's work and the agent's launch in one process, authenticating as your logged-in user, and sandboxes the agent. It always starts its own proxy, so `--proxy` is rejected rather than ignored. See [Local Agent Proxy](/documentation/platform/agent-proxy/local-agent-proxy).+- `start` runs the proxy as a long-running service on a host of its own, serving agents across your network.+- `connect` launches an agent behind a proxy **already running elsewhere**, setting up proxy routing, CA trust, and placeholder credentials. It needs a proxy address, which is why it goes with `start`. Both authenticate with a [machine identity](/documentation/platform/identities/machine-identities) via [Universal Auth](/documentation/platform/identities/universal-auth), and the proxy's is always separate from your agents'; see [Standalone Agent Proxy](/documentation/platform/agent-proxy/standalone-agent-proxy).-Both subcommands authenticate with a [machine identity](/documentation/platform/identities/machine-identities) via [Universal Auth](/documentation/platform/identities/universal-auth). Use separate identities for the proxy and for each agent; see the [Quickstart](/documentation/platform/agent-proxy/quickstart) for the recommended permissions.+Each arrangement stands on its own: `run` is complete by itself, and a deployed proxy pairs only with `connect`. All three read the same [proxied services](/documentation/platform/agent-proxy/proxied-services) and secrets from Infisical.## Subcommands & flags-<Accordion title="infisical secrets agent-proxy start" defaultOpen="true">+### Local proxy, on your own computer++<Accordion title="infisical secrets agent-proxy run" defaultOpen="true">+ Launch an agent on your own computer, sandboxed, with credentials brokered on the wire. Everything after `--` is the agent's own start command. `run` starts a proxy alongside the agent, authenticating as your logged-in user, and stops it when the agent exits. See [Local Agent Proxy](/documentation/platform/agent-proxy/local-agent-proxy) for the full picture.++ Because the proxy and the agent share a machine, the sandbox is the boundary: the agent cannot read your keyring, your credential files, or the proxy's CA key, and its only route to the network is the proxy. Real secret values are never placed in the agent's environment, and it gets no Infisical token, only proxy routing, CA trust, and the placeholders for [secret-substitution](/documentation/platform/agent-proxy/proxied-services#secret-substitution) services.++ Requires macOS, or Linux with `bubblewrap` installed; see [Requirements](/documentation/platform/agent-proxy/local-agent-proxy#requirements) for the per-distribution command. Where no OS sandbox is available, `run` refuses to start unless you pass `--no-sandbox`.++ <Note>+ `--proxy` is rejected: `run` always starts its own proxy. To route through a proxy on another host, use `agent-proxy connect --proxy=<host>:<port>`.+ </Note>++```bash+$ infisical secrets agent-proxy run --projectId=<project-id> --env=<env-slug> --path=<secret-path> -- [agent start command]++# Example+$ infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- claude++# Example (project, environment, and path from .infisical.json)+$ infisical secrets agent-proxy run -- claude+```++### Environment variables++ <Accordion title="INFISICAL_PROJECT_ID / INFISICAL_ENVIRONMENT / INFISICAL_SECRET_PATH">+ The project, environment slug, and secret path to fetch proxied services from. Alternatives to `--projectId`, `--env`, and `--path`, and to the `workspaceId`, `defaultEnvironment`, and `defaultSecretPath` fields in `.infisical.json`.++ ```bash+ # Example+ export INFISICAL_PROJECT_ID=<project-id>+ export INFISICAL_ENVIRONMENT=dev+ export INFISICAL_SECRET_PATH=/coding-agent+ ```+ </Accordion>++ <Accordion title="INFISICAL_AGENT_PROXY_SANDBOX">+ Set to `0`, `false`, or `off` to disable the OS sandbox, the same as `--no-sandbox`. Deliberately cannot be set from `.infisical.json`, so a committed file cannot silently disable the boundary.++ ```bash+ # Example+ export INFISICAL_AGENT_PROXY_SANDBOX=0+ ```+ </Accordion>++ <Accordion title="INFISICAL_DOMAIN">+ Point the CLI to your Infisical instance. Alternative to the `--domain` flag.++ ```bash+ # Example+ export INFISICAL_DOMAIN=https://eu.infisical.com+ ```+ </Accordion>++### Flags++ <Accordion title="--env">+ The environment slug to fetch proxied services from (for example `dev`, `staging`, `prod`). Falls back to `INFISICAL_ENVIRONMENT`, then to `defaultEnvironment` in `.infisical.json`; required otherwise.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev -- claude+ ```+ </Accordion>++ <Accordion title="--path">+ The secret path (folder) to scope to. Proxied services are fetched from this folder. Falls back to `INFISICAL_SECRET_PATH`, then to `defaultSecretPath` in `.infisical.json`.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --path=/coding-agent -- claude+ ```++ Default value: `/`+ </Accordion>++ <Accordion title="--projectId">+ The project to fetch proxied services from. Falls back to `INFISICAL_PROJECT_ID`, then to `.infisical.json`.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --projectId=<project-id> -- claude+ ```+ </Accordion>++ <Accordion title="--token">+ Broker using this token instead of your logged-in session. Also picked up from `INFISICAL_TOKEN` or `INFISICAL_UNIVERSAL_AUTH_ACCESS_TOKEN` in your own environment (these are read by the CLI and scrubbed from the agent's environment). Activity records attribute requests to `token` rather than your email.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --token=<token> -- claude+ ```+ </Accordion>++ <Accordion title="--sandbox / --no-sandbox">+ Toggle the OS sandbox around the agent. With `--no-sandbox` credentials are still brokered and the environment is still scrubbed, but the agent runs uncontained: it can read your keyring and credential files and reach the network directly, bypassing the proxy. `run` warns when it starts this way. Can also be set via `INFISICAL_AGENT_PROXY_SANDBOX`.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --no-sandbox -- claude+ ```++ Default value: `--sandbox` (the sandbox is on)+ </Accordion>++ <Accordion title="--allow-read">+ Allow the agent to read a path the sandbox denies by default, read-only. The exception is exact: naming a file inside a denied directory leaves everything else in that directory denied. Repeatable. Prefer this to `--no-sandbox` when an agent needs one config file. `run` prints what was re-opened.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --allow-read ~/.aws/config -- claude+ ```+ </Accordion>++ <Accordion title="--allow-write">+ Allow the agent to write a path, in addition to the working directory, `/tmp`, and the supported agents' own state directories. Repeatable.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --allow-write ~/scratch -- claude+ ```+ </Accordion>++ <Accordion title="--allow-host">+ Let the agent reach a host that has no proxied service, without a credential, even under `--unmatched-host=block`. Repeatable. Has no effect under the default `allow` policy, where unmatched hosts already pass through.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --unmatched-host=block --allow-host=registry.npmjs.org -- claude+ ```+ </Accordion>++ <Accordion title="--pass-env">+ Pass one of your own environment variables through to the agent. The child environment is scrubbed of credential-shaped names (anything containing `TOKEN`, `SECRET`, `PASSWORD`, `API_KEY`, and similar), Infisical's own variables, and agent-socket addresses such as `SSH_AUTH_SOCK`; this re-admits a specific one. Repeatable.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --pass-env ANTHROPIC_API_KEY -- claude+ ```+ </Accordion>++ <Accordion title="--set-env">+ Set an environment variable in the agent as `KEY=VALUE`. Applied last, so it overrides anything else `run` sets. Repeatable.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --set-env GH_CONFIG_DIR=/tmp/gh-cfg -- claude+ ```+ </Accordion>++ <Accordion title="--unmatched-host">+ Policy for requests to hosts with no matching proxied service: `allow` forwards them untouched with no credentials applied; `block` rejects them with `403`, restricting the agent to the services you have defined plus any `--allow-host` entries.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --unmatched-host=block -- claude+ ```++ Default value: `allow`+ </Accordion>++ <Accordion title="--poll-interval">+ Seconds between permission and credential refreshes. Changes to proxied services, permissions, and secret values take effect within one interval; if your authorization lapses, cached credentials are dropped on the same cycle.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --poll-interval 30 -- claude+ ```++ Default value: `60`+ </Accordion>++ <Accordion title="--log-file">+ Write the proxy's [per-request activity](/documentation/platform/agent-proxy/activity-logs) to this path. Without it nothing is logged, since the agent owns the terminal: warnings and errors still print there, but the per-request trail is dropped. The path is appended to on every run and never rotated for you, so use `logrotate` (`copytruncate`) if you keep one. `--log-level` filters which decisions are recorded, the same as on `start`.++ ```bash+ # Example+ infisical secrets agent-proxy run --env=dev --log-file=/tmp/broker.log -- claude+ ```+ </Accordion>+</Accordion>++### Standalone proxy, on a host of its own++These two are used together, on different hosts: `start` on the proxy host, `connect` on each agent host.++<Accordion title="infisical secrets agent-proxy start">Start the agent proxy, an HTTP(S) forward proxy that brokers credentials for the agents that connect to it. Requires machine identity credentials with read access to the secrets your proxied services reference.Agents reach HTTPS services through standard `CONNECT` tunnels and plain-HTTP services through regular forward-proxy requests; credentials are brokered on both. Requests for `https://` URLs sent as plain forward-proxy requests (rather than `CONNECT`) are rejected so the proxy can never be used to downgrade TLS.@@ -161,7 +357,7 @@ $ infisical secrets agent-proxy start --port 17322 --unmatched-host=blockThe client ID and client secret used to authenticate are stripped from the child environment. The wrapper forwards signals to the agent process and exits with its exit code.<Note>- Every input below resolves from the same sources, in order: **the flag → an environment variable → `.infisical.json` → the built-in default.** An explicitly-passed flag always wins. This is why, in a container or CI where the environment variables are already set, the command collapses to `infisical secrets agent-proxy connect -- claude`.+ Every input below resolves from the same sources, in order: **the flag → an environment variable → `.infisical.json` → the built-in default.** An explicitly-passed flag always wins. This is why, where the environment variables are already set on the host, the command collapses to `infisical secrets agent-proxy connect -- claude`.</Note>```bash@@ -310,7 +506,9 @@ $ infisical secrets agent-proxy connect -- claude</Accordion></Accordion>-<Accordion title="Shared flags">+### Shared++<Accordion title="Flags accepted by every subcommand"><Accordion title="--domain">Point the CLI to your Infisical instance (for example `https://eu.infisical.com` for EU Cloud, or your self-hosted URL). Can also be set via the `INFISICAL_DOMAIN` environment variable or the `domain` field in `.infisical.json`. Required for non-US Cloud users.diff --git a/docs/docs.json b/docs/docs.jsonindex d332193584..3c4342b202 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -629,12 +629,23 @@"group": "Agent Proxy","pages": ["documentation/platform/agent-proxy/overview",- "documentation/platform/agent-proxy/quickstart",- "documentation/platform/agent-proxy/proxied-services",- "documentation/platform/agent-proxy/deployment",- "documentation/platform/agent-proxy/connecting-agents",- "documentation/platform/agent-proxy/activity-logs",- "documentation/platform/agent-proxy/security"+ {+ "group": "Quickstart",+ "pages": [+ "documentation/platform/agent-proxy/quickstart/credentials",+ "documentation/platform/agent-proxy/quickstart/local-proxy",+ "documentation/platform/agent-proxy/quickstart/standalone-proxy"+ ]+ },+ {+ "group": "Reference",+ "pages": [+ "documentation/platform/agent-proxy/proxied-services",+ "documentation/platform/agent-proxy/local-agent-proxy",+ "documentation/platform/agent-proxy/standalone-agent-proxy",+ "documentation/platform/agent-proxy/activity-logs"+ ]+ }]}]@@ -4341,6 +4352,22 @@}},"redirects": [+ {+ "source": "/documentation/platform/agent-proxy/quickstart",+ "destination": "/documentation/platform/agent-proxy/quickstart/credentials"+ },+ {+ "source": "/documentation/platform/agent-proxy/security",+ "destination": "/documentation/platform/agent-proxy/standalone-agent-proxy"+ },+ {+ "source": "/documentation/platform/agent-proxy/deployment",+ "destination": "/documentation/platform/agent-proxy/standalone-agent-proxy#deployment"+ },+ {+ "source": "/documentation/platform/agent-proxy/connecting-agents",+ "destination": "/documentation/platform/agent-proxy/standalone-agent-proxy#the-two-commands"+ },{"source": "/documentation/platform/kms/hsm-integration","destination": "/self-hosting/guides/hsm-integration"diff --git a/docs/documentation/platform/agent-proxy/activity-logs.mdx b/docs/documentation/platform/agent-proxy/activity-logs.mdxindex 2587c071af..18b43d283b 100644--- a/docs/documentation/platform/agent-proxy/activity-logs.mdx+++ b/docs/documentation/platform/agent-proxy/activity-logs.mdx@@ -4,9 +4,7 @@ sidebarTitle: "Activity Logs"description: "See what the agent proxy brokered on every request."----Activity logs record what the agent proxy did with each request: which agent called which host, and which credential was applied. Together they form an audit trail of every credential your agents used, and a way to spot blocked or failed requests.--The proxy emits these records in its log output. To keep them, forward that output with a collector such as Fluent Bit or the OpenTelemetry Collector to your logging platform: Splunk, Datadog, Elastic, or anything else.+Activity logs record what the agent proxy did with each request: which agent called which host, and which credential was applied. Together they form an audit trail of every credential your agents used, and a way to spot blocked or failed requests. Both setups produce the same records; only where they are written differs, so [Where the records go](#where-the-records-go) has a section for each.<Note>Only requests that reach the forwarding stage are logged. Requests rejected earlier (malformed proxy auth, an invalid `CONNECT` target, TLS failures) never reach it and aren't logged. A request whose identity can't be resolved at forwarding is still logged as an `error`, just with an empty agent.@@ -20,13 +18,20 @@ Each request is logged with these fields (plus the standard `time`, `level`, and| --- | --- || `event` | Always `agent-proxy.request`, so activity is easy to filter from other logs || `decision` | `brokered`, `passthrough`, `blocked`, or `error` |-| `agentId` / `agentName` | The agent that made the request, read from its access token |+| `agentId` / `agentName` | Who made the request: the agent's machine identity behind a standalone proxy, or your own account (or `token`) on a local proxy || `projectId` / `environment` / `secretPath` | The folder the request was scoped to || `serviceName` / `serviceId` | The matched proxied service (omitted when none matched) || `method` / `host` / `port` / `path` | The request line, before substitution (so `path` shows the placeholder) || `status` | Upstream status on `brokered` / `passthrough`; `403` on `blocked`; `502` on `error` || `credentials` | What was injected: each entry's secret key (or, for a dynamic secret, its name and output field), and the header or surfaces it landed in |+Written out, two records look like this:++```text+2026-07-17T14:32:09 INF agent request event=agent-proxy.request decision=brokered agentName=claude-agent serviceName=github method=POST host=api.github.com path=/repos/acme/app/issues status=201 credentials=[{"key":"GITHUB_PAT","role":"header-rewrite","header":"Authorization"}]+2026-07-17T14:32:12 WRN agent request event=agent-proxy.request decision=blocked agentName=claude-agent host=evil.example.com method=GET status=403+```+<Warning>A record never contains a real secret. Requests are logged as the agent sent them, before the swap, so `path` shows only the placeholder; `credentials` lists secret **names**, not values; header values and request bodies are never logged.</Warning>@@ -42,29 +47,21 @@ Each decision is logged at a level, so `--log-level` controls how much you see:| `blocked` | warn || `error` | error |-## Log format+## Where the records go++### Local proxy-`--log-format` sets the shape of each record: `console` (the default, human-readable) or `json` for machines and SIEMs. Logs go to **stderr** (capture with `2>` or `2>&1`).+Nothing is written unless you pass `--log-file`, since the agent owns the terminal and a file you did not ask for is one you cannot find. With it, records go to that path and you can `tail -f` them:-<Tabs>- <Tab title="console">- ```text- 2026-07-17T14:32:09 INF agent request event=agent-proxy.request decision=brokered agentName=claude-agent serviceName=github method=POST host=api.github.com path=/repos/acme/app/issues status=201 credentials=[{"key":"GITHUB_PAT","role":"header-rewrite","header":"Authorization"}]- 2026-07-17T14:32:12 WRN agent request event=agent-proxy.request decision=blocked agentName=claude-agent host=evil.example.com method=GET status=403- ```- </Tab>- <Tab title="json">- ```json- {"level":"info","time":"2026-07-17T14:32:09+05:30","message":"agent request","event":"agent-proxy.request","decision":"brokered","agentId":"9c1e40cf-...","agentName":"claude-agent","projectId":"53c8b330-...","environment":"prod","secretPath":"/coding-agent","serviceName":"github","method":"POST","host":"api.github.com","port":443,"path":"/repos/acme/app/issues","status":201,"credentials":[{"key":"GITHUB_PAT","role":"header-rewrite","header":"Authorization"}]}- ```- </Tab>-</Tabs>+```bash+infisical secrets agent-proxy run -e dev --log-file=/tmp/broker.log -- claude+```-## Log file+The file is written in the human-readable format shown above, and is appended to on every run without being rotated for you, so use `logrotate` (`copytruncate`) if you keep one around. Without the flag, warnings and errors still print to your terminal; only the per-request trail is dropped.-`--log-file` writes `json` records to a file, in addition to the console output. This lets you watch a readable stream in the terminal while persisting machine-readable logs for your collector.+### Standalone proxy-## Common setups+Records go to **stderr**, so whatever supervises the proxy collects them. `--log-format` sets their shape, and `--log-file` additionally writes `json` to a file, which lets you watch a readable stream while persisting machine-readable records for a collector:```bash# Watch live, readable (default)@@ -77,7 +74,13 @@ infisical secrets agent-proxy start --log-file /var/log/infisical/agent-proxy.loinfisical secrets agent-proxy start --log-format json```-For rotation, containers let the platform rotate the stream; for `--log-file`, use `logrotate` with `copytruncate` (or restart the proxy).+In `json`, the same record looks like this:++```json+{"level":"info","time":"2026-07-17T14:32:09+05:30","message":"agent request","event":"agent-proxy.request","decision":"brokered","agentId":"9c1e40cf-...","agentName":"claude-agent","projectId":"53c8b330-...","environment":"prod","secretPath":"/coding-agent","serviceName":"github","method":"POST","host":"api.github.com","port":443,"path":"/repos/acme/app/issues","status":201,"credentials":[{"key":"GITHUB_PAT","role":"header-rewrite","header":"Authorization"}]}+```++To keep records long-term, forward that output with a collector such as Fluent Bit or the OpenTelemetry Collector to your logging platform: Splunk, Datadog, Elastic, or anything else. For rotation, containers let the platform rotate the stream; for `--log-file`, use `logrotate` with `copytruncate`.## Next stepsdiff --git a/docs/documentation/platform/agent-proxy/connecting-agents.mdx b/docs/documentation/platform/agent-proxy/connecting-agents.mdxdeleted file mode 100644index 9b78ce2e39..0000000000--- a/docs/documentation/platform/agent-proxy/connecting-agents.mdx+++ /dev/null@@ -1,48 +0,0 @@-----title: "Connecting Agents"-description: "Launch any agent behind the Agent Proxy and control what its environment contains."------You launch your agent through `infisical secrets agent-proxy connect -- <agent command>`, which sets up the agent's environment and then starts it. No code changes are needed: `connect` points the agent's HTTP clients at the Agent Proxy, so its normal outbound requests route through it. Each request carries the agent's Infisical token and folder scope, which is how the Agent Proxy knows which identity is asking and which of that folder's proxied services apply.--## What `connect` sets in the agent's environment--- **Proxy routing.** `HTTPS_PROXY` and `HTTP_PROXY` point at the Agent Proxy. `NO_PROXY` always includes `localhost,127.0.0.1`; add more hosts with `--no-proxy` or an existing `NO_PROXY`.-- **Certificate trust.** The standard trust variables point at the downloaded root CA so the agent's HTTP clients accept the Agent Proxy's certificates. See [Certificates & TLS interception](/documentation/platform/agent-proxy/security#certificates--tls-interception).-- **Placeholders.** A dummy value for each [secret-substitution](/documentation/platform/agent-proxy/proxied-services#secret-substitution) service, so the agent has something to send.-- **Real values (opt-in).** To give the agent a real secret directly, grant its identity **Read Value** on that secret; `connect` then injects the value into the agent's environment, like any secret the identity can read. This is for values the agent uses in its own code; for credentials it sends to an external API, broker them instead. An agent with only the `Proxy` permission gets no real values, just the routing and placeholders above. Brokered credentials are never injected here; the Agent Proxy adds them to each outbound request itself, so they reach the destination but never the agent.--## Connection behaviors--- Both HTTPS and plain-HTTP services are brokered. HTTPS traffic arrives as `CONNECT` tunnels; plain `http://` traffic arrives as regular forward-proxy requests (useful for internal services without TLS). An `https://` URL sent as a plain forward-proxy request is rejected, so the Agent Proxy can never be used to downgrade TLS.-- If the agent identity can already read a secret that one of its proxied services brokers, `connect` refuses to start: the agent would receive that value directly and bypass the Agent Proxy. Pass `--allow-readable-brokered-secrets` to override the guardrail.--## Configuration--Every option resolves from the same sources, in order: **the flag → an environment variable → `.infisical.json` → the built-in default.** An explicitly-passed flag always wins. In a container or CI where the environment variables are already set, the flags fall away and only your agent command remains: `infisical secrets agent-proxy connect -- claude`.--| Option | Flag | Environment variable | `.infisical.json` |-| --- | --- | --- | --- |-| Auth | `--client-id` / `--client-secret` | `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` / `_SECRET` | — |-| Instance | `--domain` | `INFISICAL_DOMAIN` | `domain` |-| Project | `--projectId` | `INFISICAL_PROJECT_ID` | `workspaceId` |-| Environment slug | `--env` | `INFISICAL_ENVIRONMENT` | `defaultEnvironment` |-| Secret path | `--path` | `INFISICAL_SECRET_PATH` | `defaultSecretPath` |-| Proxy address | `--proxy` | `INFISICAL_AGENT_PROXY_ADDRESS` | — |--<Note>- The proxy address is the one setting that cannot come from `.infisical.json`. That file is usually committed to your repository, so a wrong or malicious value would silently route every agent's traffic through the wrong host. Pass it with `--proxy` or `INFISICAL_AGENT_PROXY_ADDRESS` instead.-</Note>--See the [CLI reference](/cli/commands/agent-proxy) for the full list, including `--port`, `--unmatched-host`, and `--poll-interval` on `start`.--## Next steps--<CardGroup cols={2}>- <Card title="agent-proxy CLI reference" icon="terminal" href="/cli/commands/agent-proxy">- Every flag for `start` and `connect`, with examples.- </Card>- <Card title="Activity Logs" icon="scroll" href="/documentation/platform/agent-proxy/activity-logs">- See what the Agent Proxy brokered on every request.- </Card>-</CardGroup>diff --git a/docs/documentation/platform/agent-proxy/deployment.mdx b/docs/documentation/platform/agent-proxy/deployment.mdxdeleted file mode 100644index f2adcdcf4e..0000000000--- a/docs/documentation/platform/agent-proxy/deployment.mdx+++ /dev/null@@ -1,117 +0,0 @@-----title: "Deployment"-description: "Run the Agent Proxy in production: network placement, deployment methods, and high availability."------The Agent Proxy is a single long-running process started with `infisical secrets agent-proxy start`. This page covers where to place it in your network, how to run it, and how it behaves at scale. For a first run, the [Quickstart](/documentation/platform/agent-proxy/quickstart) is enough; read this before going to production.--## Network placement--The Agent Proxy is built for private-network deployment. A well-placed one looks like this:--```text-+---- Your private network -------------------+-| |-| +--------------+ |-| | Agent host |----+ | +------------------+-| +--------------+ | | +-->| External APIs |-| | +----------------+ | | +------------------+-| +-->| Agent Proxy |-------+-| | | its own host |-------+-| +--------------+ | +----------------+ | | +------------------+-| | Agent host |----+ | +-->| Infisical |-| +--------------+ port 17322, | +------------------+-| agents only |-+---------------------------------------------+-```--- **Inside your private network, off the public internet.** The Agent Proxy's listening port should only ever be reachable from within your network.-- **Reachable only by your agent machines.** Restrict inbound access to the Agent Proxy's port to the hosts that run agents, using your usual controls (security groups, firewall rules, network policies).-- **On its own host.** Same network as the agents for low per-request latency, but a separate machine, which keeps the real credentials fully isolated from the agents.-- **Alongside any plain-HTTP upstreams.** Internal services the Agent Proxy reaches over plain HTTP belong inside the same trusted network.-- **Credentials where they are used.** Provision the Agent Proxy identity's client credentials only on its host, and each agent identity's only on its agent machine.--Outbound, the Agent Proxy only needs to reach your Infisical instance and the APIs your proxied services define.--## Deployment methods--However you run the Agent Proxy, provide its identity's credentials, publish port `17322` to your agent machines only, and set `INFISICAL_DOMAIN` for EU Cloud or self-hosted.--<Tabs>- <Tab title="CLI (systemd, VM)">- Install the [CLI](/cli/overview) on the host and run `start` under a process supervisor so it restarts on failure:-- ```bash- export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id>- export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret>- # export INFISICAL_DOMAIN=https://eu.infisical.com # EU Cloud or self-hosted-- infisical secrets agent-proxy start- ```- </Tab>- <Tab title="Docker">- The CLI ships as the `infisical/cli` image. Pass credentials as environment variables and publish the port:-- ```bash- docker run -p 17322:17322 \- -e INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id> \- -e INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret> \- infisical/cli:latest secrets agent-proxy start- ```-- Add `-e INFISICAL_DOMAIN=https://eu.infisical.com` for EU Cloud or a self-hosted instance.- </Tab>- <Tab title="PaaS (Render, Railway, Fly)">- Deploy the `infisical/cli` image as a service:-- - **Image:** `infisical/cli:latest`- - **Start command:** `secrets agent-proxy start`- - **Environment:** `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID`, `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET`, and `INFISICAL_DOMAIN` if not on US Cloud- - **Port:** `17322`, exposed on a private network your agents can reach, not the public internet-- On Render, this is a private service pointed at the image with the start command above.- </Tab>-</Tabs>--<Note>- Keep the Agent Proxy on a private network reachable only by your agent machines (see [Network placement](#network-placement)). To run more than one instance, see [High availability](#high-availability).-</Note>--## Caching and polling--The Agent Proxy keeps everything it needs in memory, so steady-state requests involve no Infisical calls:--- **First request from an agent**: the Agent Proxy discovers all proxied services in the agent's scope and fetches the referenced secret values, then serves every subsequent request from that agent, to any host, from cache.-- **Refresh**: every 60 seconds (configurable via `--poll-interval`), the Agent Proxy re-fetches services, permissions, and secret values for active agents. Changes such as a rotated secret or an edited service take effect within one poll interval, with no agent restart. Authorization fails closed on the same cycle. If an agent's identity, role, or Proxy grant is revoked, or its token expires, the Agent Proxy drops that agent's cached credentials on the next poll and stops applying them.-- **Eviction**: an agent idle for about 10 minutes has its cache dropped and polling stopped. Its next request triggers a fresh discovery.-- **API load**: polling grows with the number of active agents. With a large fleet or a short `--poll-interval`, factor in your instance's API rate limits; a longer interval reduces load at the cost of slower propagation.--## Unmatched hosts--When an agent requests a host no proxied service matches, the `--unmatched-host` flag decides what happens:--- `allow` (default): the request is forwarded untouched, with no credentials applied. This is the normal mode, because much of an agent's traffic does not need a brokered credential at all: reading documentation, cloning public repos, installing packages, or calling services the agent legitimately authenticates to itself. All of that flows through untouched, while matched hosts still get credentials applied.-- `block`: the request is rejected with `403`. Use this to restrict agents to an allowlist of exactly the services you have defined.--<Note>- `block` applies to every host without a matching proxied service, including your Infisical instance itself. Since agent traffic routes through the Agent Proxy, Infisical CLI commands run from inside the agent (using the `INFISICAL_TOKEN` from its environment) will also be rejected in this mode.-</Note>--## High availability--Run multiple Agent Proxy instances with the same machine identity behind a TCP load balancer. Instances coordinate through Infisical rather than with each other:--- All instances chain to the same per-organization root CA, so agents trust any instance. Each instance signs its own intermediate.-- Each instance keeps its own agent cache. If the load balancer moves an agent to a new instance, that instance does one fresh discovery and then serves from cache.-- Each instance polls Infisical independently. After a secret rotation, instances may briefly apply different values until their next poll (up to one poll interval).--## Next steps--<CardGroup cols={2}>- <Card title="Connecting Agents" icon="plug" href="/documentation/platform/agent-proxy/connecting-agents">- Launch an agent behind the proxy and control what its environment holds.- </Card>- <Card title="Security" icon="shield-halved" href="/documentation/platform/agent-proxy/security">- The isolation, authentication, and trust model.- </Card>-</CardGroup>diff --git a/docs/documentation/platform/agent-proxy/local-agent-proxy.mdx b/docs/documentation/platform/agent-proxy/local-agent-proxy.mdxnew file mode 100644index 0000000000..dcf9a626be--- /dev/null+++ b/docs/documentation/platform/agent-proxy/local-agent-proxy.mdx@@ -0,0 +1,371 @@+---+title: "Local Agent Proxy"+sidebarTitle: "Local Proxy"+description: "Run an agent on your own computer, sandboxed, with a proxy that starts and stops alongside it."+---++A local proxy runs an agent on your own computer. `agent-proxy run` starts a proxy alongside your agent and stops it when the agent exits. It all happens on the one machine, with the agent sandboxed away from your credentials:++```bash+infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- claude+```++This page is the reference for that setup: what the sandbox allows and denies, how certificates work, how permissions are decided, and every flag `run` takes.++## What you set up++There are only two moving parts:++```text+ +------------------------------+ +--------------------++ | your computer | | Infisical |+ | | <------> | |+ | one command: | | your secret and |+ | agent-proxy run -- claude | | proxied service |+ +------------------------------+ +--------------------++```++That is the entire setup. There is no proxy to deploy and no machine identity to create: you log in once, `run` authenticates as you, and it starts and stops its own proxy around the agent.++For agents running on your infrastructure, see [standalone proxy](/documentation/platform/agent-proxy/standalone-agent-proxy).++## What the sandbox is for++The proxy holds real credentials, and it runs on the same machine as the agent. Something has to keep the agent away from them, and that something is an **OS-level sandbox**: the agent cannot read the proxy's files, your keyring, or your credential files, and it cannot reach the network except through the proxy.++`run` builds it for you each time you start an agent, and takes it down when the agent exits:++```mermaid+flowchart LR+ subgraph machine["Your machine"]+ direction LR+ subgraph sandbox["OS sandbox"]+ AGENT["Your agent<br/>no secrets"]+ end+ PROXY["Proxy<br/>holds your secrets"]+ end+ AGENT -->|"only route out"| PROXY+ PROXY --> INF["Infisical"]+ PROXY -->|"real credential added"| API[("api.github.com")]+```++<Warning>+ **`run` cannot be pointed at a proxy running elsewhere.** It always starts its own, so `--proxy` is rejected with an error rather than silently ignored. To route an agent through a proxy on another host, see [Standalone Agent Proxy](/documentation/platform/agent-proxy/standalone-agent-proxy).+</Warning>++## Requirements++- The [Infisical CLI](/cli/overview) installed, and `infisical login` completed.+- At least one [proxied service](/documentation/platform/agent-proxy/proxied-services) in the folder you point `run` at. Brokering only happens for hosts a service matches; if you have none, everything simply passes through uncredentialed.+- macOS, or Linux with [bubblewrap](https://github.com/containers/bubblewrap) installed. The sandbox comes from the operating system, so what you install depends on which one you are on:++<Tabs>+ <Tab title="macOS">+ Nothing to install. The sandbox is part of macOS.+ </Tab>+ <Tab title="Linux">+ Linux gets the sandbox from [bubblewrap](https://github.com/containers/bubblewrap), which provides the `bwrap` binary that `run` calls:++ <Tabs>+ <Tab title="Debian / Ubuntu">+ ```bash+ sudo apt install bubblewrap+ ```+ </Tab>+ <Tab title="Fedora / RHEL">+ ```bash+ sudo dnf install bubblewrap+ ```+ </Tab>+ <Tab title="Arch">+ ```bash+ sudo pacman -S bubblewrap+ ```+ </Tab>+ <Tab title="Alpine">+ ```bash+ apk add bubblewrap+ ```+ </Tab>+ </Tabs>++ On a distribution not listed here, look for `bubblewrap` in your package manager.+ </Tab>+</Tabs>++See [Platform support](#platform-support) for what happens where the sandbox is unavailable.++## Running an agent++Every option resolves the same way: **the flag → an environment variable → `.infisical.json` → the default.** Run it from a directory that has an `.infisical.json` (created by `infisical init`) and the project, environment, and path come from there, so most of the flags fall away:++| Option | Flag | Environment variable | `.infisical.json` |+| --- | --- | --- | --- |+| Project | `--projectId` | `INFISICAL_PROJECT_ID` | `workspaceId` |+| Environment slug | `--env` | `INFISICAL_ENVIRONMENT` | `defaultEnvironment` |+| Secret path | `--path` | `INFISICAL_SECRET_PATH` | `defaultSecretPath` |+| Instance | `--domain` | `INFISICAL_DOMAIN` | `domain` |+| Sandbox | `--sandbox` / `--no-sandbox` | `INFISICAL_AGENT_PROXY_SANDBOX` | — |++Everything after `--` is your agent's own command, run as-is. From a project directory:++```bash+infisical secrets agent-proxy run -e dev -- claude+infisical secrets agent-proxy run -e dev -- codex++# any command works: this one sends only the placeholder, and GitHub still answers as you+infisical secrets agent-proxy run -e dev -- \+ sh -c 'curl -sS https://api.github.com/user -H "Authorization: Bearer $GITHUB_TOKEN"'+```++## What a run does++1. **Resolves your identity**, from your keyring login or `--token`.+2. **Fetches your proxied services and the real secret values** into its own memory. They are never written to disk and never reach the agent.+3. **Checks the sandbox will hold on this host**, then starts the proxy and launches your agent inside it.+4. **On exit**, revokes any dynamic-secret leases, drops the cached credentials, and removes the temporary directory.++A per-run `0700` temporary directory holds the only things that touch disk:++```text+ /tmp/infisical-agent-proxy-run-XXXXXX/ mode 0700, removed on exit+ |+ |-- local-ca.pem public CA cert, the agent's HTTP clients point here+ +-- proxy.sock Linux only, how the isolated agent reaches the proxy++ never written anywhere:+ real secret values . your login token . the CA private key+```++## The sandbox++The sandbox is on by default, and it is what makes brokering safe when the proxy and the agent share a machine. Its restrictions are deliberate, and a few are surprising the first time, so this is the part worth reading before you use `run` for real work.++```text+ |+ the agent asks for ... | ... and gets+ |+ read ./src/main.go | yes reads are broadly allowed+ write ./build/output | yes the working directory is writable+ write ~/.claude/history | yes agent state directories are writable+ read /usr/lib, /etc/hosts | yes system paths are readable+ exec git, node, rg | yes subprocesses are allowed+ open a pty for its TUI | yes interactive agents work normally+ |+ read ~/.aws/credentials | no credential path+ read ~/.infisical | no your token lives here+ read the login keychain | no keychain services are blocked+ write ~/.ssh/authorized_keys | no credential paths deny writes too+ use your ssh-agent | no socket variable scrubbed+ resolve api.github.com | no no resolver inside+ connect 1.1.1.1:443 | no no route out+ |+ GET https://api.github.com | -> through the proxy,+ | real credential applied+ |+ sandbox wall+```++### Platform support++| Platform | Mechanism | Network isolation |+| --- | --- | --- |+| **macOS** | Seatbelt (`sandbox-exec`), deny-by-default profile generated per run | Enforced: outbound is permitted only to the proxy's loopback port |+| **Linux** | bubblewrap with an empty network namespace | Enforced: no network interface exists inside at all |+| **Linux**, private netns unavailable | bubblewrap sharing the host network | Advisory only, with a warning (see below) |+| **Windows** | None | `run` refuses to start unless you pass `--no-sandbox` |++On Linux, `run` checks the sandbox before starting your agent. If the private network is unavailable but the rest of the sandbox works, it falls back to shared networking and warns you. If the sandbox cannot start at all (unprivileged user namespaces restricted, as on stock Ubuntu 24.04), it stops and tells you how to fix the host rather than running your agent uncontained.++<Warning>+ On the shared-network fallback the agent can reach the network directly, so routing through the proxy depends on the agent honoring the proxy environment variables: a tool that ignores them is not brokered, and its traffic leaves unproxied. Everything else is unchanged, including the environment scrub, the keyring block, and the credential-path denies. Allow unprivileged user namespaces on the host to restore the enforced fence.+</Warning>++### Network: the proxy is the only way out++Under both enforced modes the agent has exactly one route to the outside, the proxy. Direct connections fail, including connections straight to an IP with no hostname involved. Only HTTP and HTTPS are brokered, so SSH cannot be: use HTTPS with a brokered token, which is how `git` and `gh` work.++**DNS is deliberately unavailable inside the sandbox.** The agent does not need a resolver: it hands the hostname to the proxy in a `CONNECT` or an absolute-URI request, and the proxy resolves it on the host, outside the sandbox. Blocking it buys two things. A tool that ignores the proxy variables fails loudly instead of quietly going direct, and DNS lookups cannot be used to smuggle data out. So `Could not resolve host` inside a sandboxed agent is expected, and it means the failing tool is not using the proxy.++Both letter cases of every proxy variable are set (`HTTP_PROXY` and `http_proxy`, and so on), because some tools read only one, and `NO_PROXY` always covers `localhost` and `127.0.0.1`.++Two consequences for local servers are worth knowing, since the fence applies to loopback as well as the internet:++- The agent **cannot reach a service running on your machine** outside the sandbox, such as a database on `127.0.0.1:5432`. Loopback bypasses the proxy by design, and the fence denies the direct connection, so it fails.+- A server the **agent** starts is reachable from your machine on macOS, but not on Linux: there the agent gets its own private network, so a dev server it launches is invisible from outside. Start long-lived local servers yourself, outside the agent.++### Filesystem: broad read, credentials denied++Reads are allowed nearly everywhere, which is what keeps agents useful. Writes are limited to the working directory, the per-run temporary directory, `/tmp`, and the state directories of the agents `run` knows about (`~/.claude`, `~/.claude.json`, `~/.codex`), so interactive sessions keep their history and settings. Any other directory an agent writes to needs `--allow-write`. Carved out of the broad read is everywhere credentials live:++```text+ $HOME+ |+ |-- code/my-project/ read + WRITE <- your working directory+ |-- .claude/ .claude.json read + WRITE <- agent state+ |-- .codex/ read + WRITE <- agent state+ |+ |-- .infisical/ DENIED your token, the local CA key+ |-- infisical-keyring DENIED file-vault credential store+ |-- .aws/ .azure/ DENIED+ |-- .ssh/ .gnupg/ DENIED+ |-- .kube/ .netrc DENIED+ |-- .npmrc .git-credentials DENIED+ |-- .docker/config.json DENIED+ |-- .config/gcloud/ DENIED+ |-- .config/gh/ DENIED+ |-- .config/infisical/ DENIED+ |+ +-- everything else read-only++ outside $HOME+ |-- /tmp read + WRITE+ +-- /usr, /etc, /opt, ... read-only+```++On Linux the agent gets a private `/tmp`, so files it writes there are not visible from the rest of your machine. Have it write to your working directory instead of `/tmp` if you need to open the result yourself.++Credential paths deny **writes** as well as reads. That matters when you launch an agent from `$HOME`, where the writable-working-directory rule would otherwise let it append to `~/.ssh/authorized_keys`.++If your agent genuinely needs a denied path, re-open exactly that path instead of disabling the sandbox:++```bash+infisical secrets agent-proxy run -e dev --allow-read ~/.aws/config -- claude+```++That is precise: `~/.aws/config` becomes readable, read-only, while everything else under `~/.aws` (`credentials`, `sso/`) stays denied. `run` prints what it re-opened. `--allow-write <path>` adds a writable path, and both flags can be repeated.++<Warning>+ Re-opening `~/.infisical` would hand the agent your login token and the local CA private key, which defeats the whole design. Prefer naming a single file over a directory.+</Warning>++### Environment: scrubbed++The agent inherits your environment with the credential-shaped parts removed:++- **Anything whose name looks like a secret** is dropped: names containing `TOKEN`, `SECRET`, `PASSWORD`, `PASSWD`, `CREDENTIAL`, `API_KEY`, `APIKEY`, `PRIVATE_KEY`, or `ACCESS_KEY`. The sweep is intentionally coarse and will catch variables you wanted.+- **Infisical's own variables**, including `INFISICAL_TOKEN`, `INFISICAL_DOMAIN`, and any machine identity credentials. The agent is given no Infisical token at all, so it cannot act as you against the API.+- **Agent-socket and IPC addresses**: `SSH_AUTH_SOCK`, `SSH_AGENT_PID`, `GPG_AGENT_INFO`, `DBUS_SESSION_BUS_ADDRESS`, `DBUS_SYSTEM_BUS_ADDRESS`, `XDG_RUNTIME_DIR`. An agent socket lets a program sign and authenticate as you without ever reading a key file, which would sidestep the `~/.ssh` deny entirely.++In their place `run` sets the proxy variables, the CA trust variables, and a placeholder for each [secret-substitution](/documentation/platform/agent-proxy/proxied-services#secret-substitution) credential in the folder. Services that use a [header rewrite](/documentation/platform/agent-proxy/proxied-services#header-rewrites) need nothing in the environment; the proxy sets the header itself.++<Note>+ `run` never injects real secret values into the agent's environment, even for secrets you can read. If the agent needs a literal value, pass it yourself with `--set-env`.+</Note>++Add back what the sweep took, one variable at a time:++```bash+--pass-env ANTHROPIC_API_KEY # let one of your real variables through+--set-env GH_CONFIG_DIR=/tmp/gh # set a literal value in the agent+```++A placeholder wins over a variable of the same name from your own environment, and `--set-env` wins over everything, including a placeholder.++## Certificates and the macOS keychain prompt++For the proxy to apply credentials to HTTPS requests it terminates TLS, so the agent has to trust the certificates it presents. `run` uses a **self-signed local root**, generated on your machine; it never involves your organization's root CA, and the private key stays on the parent side of the sandbox. Leaf certificates are minted per hostname from it.++Tools split into two groups by how they decide what to trust:++- **Environment-variable trust** (Claude Code, Codex, `curl`, Python, Node, Deno). `run` points `SSL_CERT_FILE`, `NODE_EXTRA_CA_CERTS`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE`, `GIT_SSL_CAINFO`, and `DENO_CERT` at the local root. Nothing to do.+- **System trust** (`gh` and most Go-based tools). These ignore those variables and consult the OS trust store.++To serve the second group on macOS, `run` keeps the local root under `~/.infisical/agent-proxy` (a sandbox-denied path, so the agent cannot read the key) and adds it to your **login keychain** once. That is the one password prompt you see on the first run; later runs are silent because the root persists. It grants **certificate trust only**: keychain secret access stays blocked inside the sandbox, so your Infisical login token remains unreadable. Decline it and everything still works except natively-trusting tools, and `run` says so instead of failing.++On Linux the root is generated fresh in memory for each run and the environment variables are sufficient, so there is no trust-store step.++## Permissions: it all runs as you++Every API call is made with your own token, and it needs three permissions: **`Read` on proxied services** to find them, **`Read Value` on the secrets** they reference to broker them, and **`Lease`** to mint a dynamic one. A default project member already has all three.++That is deliberate. You are running an agent as yourself, on your own machine, against secrets you could already read; a permission boundary between you and yourself would be theater. The sandbox is the security boundary here. The only question `run` asks is whether you can read the value.++[Activity records](/documentation/platform/agent-proxy/activity-logs) attribute requests to your email (or `token` when you pass `--token`), since the run is authenticated as you, and a brokered service's **last used** time is reported under your own account.++### Dynamic secrets++[Dynamic secrets](/documentation/platform/agent-proxy/proxied-services#using-dynamic-secrets) are brokered like any other credential, with one thing to know about who mints them. The proxy leases lazily on the first request that needs the credential, caches the output fields in memory, renews before expiry, and revokes on a clean exit. With `run` it mints using **your** token, so your own `Lease` permission on that dynamic secret is the gate. A dynamic credential you cannot lease is skipped up front, with a single warning in the log file naming the secret, rather than failing every request that needs it.++<Note>+ You are the minter here, so `Lease` on the dynamic secret is a permission you need yourself. The agent still cannot mint for itself: it has no token and no route to Infisical.+</Note>++## Watching what it does++Nothing is logged unless you ask for it. Pass `--log-file` and the proxy writes a record per request to that path, which you can follow in another terminal:++```bash+infisical secrets agent-proxy run -e dev --log-file=/tmp/broker.log -- claude++# in another terminal+tail -f /tmp/broker.log+```++Every request records a decision: `brokered` (a service matched and a credential was applied), `passthrough` (no service matched, forwarded untouched), `blocked` (rejected by `--unmatched-host=block`), or `error`. Records carry the same fields as in [Activity Logs](/documentation/platform/agent-proxy/activity-logs), written in the human-readable console format.++Without `--log-file` you still see problems: warnings and errors print to your terminal, including a credential the proxy had to skip and a dropped authorization. What you lose is the per-request trail, so reach for `--log-file` when you need to see what happened on a specific request.++`passthrough` is the one decision left out by default, and it is usually the bulk of an agent's traffic, so a log stays small. `--log-level debug` adds it, which is useful when you are working out why a host is not being brokered and noisy the rest of the time.++<Note>+ A path you pass to `--log-file` is appended to on every run and never rotated for you, so rotate it with `logrotate` (`copytruncate`) if you keep one around.+</Note>++## Troubleshooting++<AccordionGroup>+ <Accordion title="Could not resolve host">+ Expected: DNS is blocked inside the sandbox on purpose. It means the tool that failed is not routing through the proxy. Check whether it reads `HTTP_PROXY` / `HTTPS_PROXY`.+ </Accordion>+ <Accordion title="Certificate errors">+ The tool is not reading the injected CA. Most honor one of the six trust variables; Go-based tools on macOS use the system trust store, which is what the one-time keychain prompt covers. If you declined that prompt, those tools fail here.+ </Accordion>+ <Accordion title="A tool refuses to start, complaining it cannot read its own config">+ For example `failed to read configuration: open ~/.config/gh/hosts.yml: operation not permitted`. The file exists but is unreadable, and many tools treat that as fatal rather than falling back to "no config". Re-opening it with `--allow-read` is usually the wrong fix, because for `gh` that file *is* the GitHub token.++ Point the tool at a throwaway config location so it never touches the denied path and picks up the placeholder from the environment instead:++ ```bash+ infisical secrets agent-proxy run -e dev --set-env GH_CONFIG_DIR=/tmp/gh-cfg -- claude+ ```++ The same pattern applies to any tool with a config-directory override.+ </Accordion>+ <Accordion title="Everything is passthrough, nothing is brokered">+ No proxied service matched the host. Check the [host pattern](/documentation/platform/agent-proxy/proxied-services#host-patterns) against the exact hostname the agent calls, that the service is enabled, and that you are pointed at the folder the service lives in.+ </Accordion>+ <Accordion title="A 401 from the upstream API">+ The credential was not applied and the request was forwarded as the agent sent it; the proxy does not block the call. Check the activity log for the decision, and that you have `Read Value` on the secret the service references.+ </Accordion>+ <Accordion title="The sandbox will not start on Linux">+ Either bubblewrap is missing (install it as shown in [Requirements](#requirements)) or unprivileged user namespaces are restricted on the host. The error says which. `run` refuses to start rather than running your agent uncontained.+ </Accordion>+ <Accordion title="A tool cannot prompt for a password">+ On Linux the agent runs in its own session, which is what stops a sandboxed process from pushing keystrokes into your terminal. Its stdin and stdout are still terminals, so TUIs behave normally, but a tool that opens `/dev/tty` directly to prompt, `sudo` for instance, cannot. Run that step yourself, outside the agent.+ </Accordion>+ <Accordion title="The agent cannot read a file it needs">+ It is probably in a denied credential path. Re-open just that file with `--allow-read <path>`. Reach for `--no-sandbox` last, not first.+ </Accordion>+</AccordionGroup>++## Turning the sandbox off++```bash+infisical secrets agent-proxy run -e dev --no-sandbox -- claude+```++Brokering still works and the environment is still scrubbed, but the agent is uncontained: it can read your keyring and credential files and reach the network directly, bypassing the proxy. `run` prints a warning saying so. This is a debugging tool, and the only option on Windows.++`INFISICAL_AGENT_PROXY_SANDBOX=0` does the same thing. Neither can be set from `.infisical.json`, deliberately, so a committed file cannot quietly disable the boundary for everyone who runs the agent.++## Next steps++<CardGroup cols={2}>+ <Card title="agent-proxy CLI reference" icon="terminal" href="/cli/commands/agent-proxy">+ Every flag for `run`, `start`, and `connect`, with examples.+ </Card>+ <Card title="Proxied Services" icon="right-left" href="/documentation/platform/agent-proxy/proxied-services">+ Host patterns, header rewrites, and secret substitution in depth.+ </Card>+</CardGroup>diff --git a/docs/documentation/platform/agent-proxy/overview.mdx b/docs/documentation/platform/agent-proxy/overview.mdxindex 84e040cf87..f5eeaa8b86 100644--- a/docs/documentation/platform/agent-proxy/overview.mdx+++ b/docs/documentation/platform/agent-proxy/overview.mdx@@ -32,32 +32,28 @@ This is not suitable for AI agents because they are vulnerable to credential exfEnter Infisical Agent Proxy - a proxy service backed by Infisical that prevents credential exfiltration by brokering access to credentials stored in Infisical at the network boundary.-## How it works+## What you configure in Infisical-Start by configuring the resources Agent Proxy needs within Infisical to broker your agent access to an external service.+Two things, and they are the same no matter where your agent runs:-1. Add a credential as a secret in Infisical; this can be a static secret or a [dynamic secret](/documentation/platform/dynamic-secrets/overview).+1. Add the credential as a secret in Infisical; this can be a static secret or a [dynamic secret](/documentation/platform/dynamic-secrets/overview).-2. Configure a [proxied service](/documentation/platform/agent-proxy/proxied-services) in Infisical. This defines the external service (e.g. `api.anthropic.com`, `api.github.com`, `slack.com`, etc.) that Agent Proxy can broker access to using the credential.+2. Configure a [proxied service](/documentation/platform/agent-proxy/proxied-services). This defines the external service (`api.anthropic.com`, `api.github.com`, `slack.com`, and so on) that Agent Proxy brokers access to, and how the credential is applied to requests bound for it.-3. Configure a [machine identity](/documentation/platform/identities/machine-identities) for Agent Proxy and another one for your agent, each with [Universal Auth](/documentation/platform/identities/universal-auth). When creating them, grant their permissions in one step with the built-in **Agent Proxy Policies** and **Agent Policies** templates under Additional Privileges.+Then you route your agent's traffic through Agent Proxy. The agent needs no code changes: the [Infisical CLI](/cli/overview) launches it with its HTTP clients pointed at the proxy, and the proxy applies the real credential to matching requests on the way out.-Next, set up an instance of Agent Proxy on a separate host machine:+## Where the proxy runs-4. Start up an Agent Proxy server using the [Infisical CLI](/cli/overview) with the `infisical secrets agent-proxy start` command [here](/cli/commands/agent-proxy) with `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` and `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET` set in the environment.+The proxy has to sit between your agent and the internet, so where it runs follows from where your agent runs. A **local proxy** is for agents that live as long as your terminal session: it starts and stops with the agent on your own computer, sandboxed away from your credentials. A **standalone proxy** is for agents running on your infrastructure: it runs on a host of its own and serves agents across your network.-Finally, configure your AI agent to route requests through Agent Proxy:--5. Bootstrap your AI agent’s environment to automatically route all outbound HTTP and HTTPS traffic through Agent Proxy. This can be done with the [Infisical CLI](/cli/overview) and setting `INFISICAL_PROJECT_ID`, `INFISICAL_ENVIRONMENT`, `INFISICAL_SECRET_PATH`, and `INFISICAL_AGENT_PROXY_ADDRESS` in the agent’s environment.--6. Launch your agent with the `infisical secrets agent-proxy connect` command to start routing requests through Agent Proxy.+The Quickstart starts with the parts both need, then hands you this choice at the point you have to make it.## What you work with| Object | What it is || ------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- || **Proxied service** | A config that maps a host to the secret the proxy applies, static or [dynamic](/documentation/platform/agent-proxy/proxied-services#using-dynamic-secrets). Defined next to your secrets in the dashboard. |-| **Agent proxy** | The forward proxy in the [Infisical CLI](/cli/overview) that runs in your network and attaches credentials to outbound requests. |+| **Agent proxy** | The forward proxy in the [Infisical CLI](/cli/overview) that attaches credentials to outbound requests. Runs on a host in your network, or on your own machine for the duration of a local run. || **Agent** | Any program that respects `HTTPS_PROXY`: Claude Code, Codex, OpenClaw, Hermes, or any other untrusted workload. |<Warning>@@ -71,19 +67,6 @@ Finally, configure your AI agent to route requests through Agent Proxy:## Next steps-<CardGroup cols={2}>- <Card- title="Quickstart"- icon="rocket"- href="/documentation/platform/agent-proxy/quickstart"- >- Broker your first credential to an agent.- </Card>- <Card- title="Security"- icon="shield-halved"- href="/documentation/platform/agent-proxy/security"- >- Isolation, authentication, certificates, and permissions.- </Card>-</CardGroup>+<Card title="Set Up Credentials" icon="rocket" href="/documentation/platform/agent-proxy/quickstart/credentials">+ Start the quickstart: add the secret and the proxied service, then pick where the proxy runs.+</Card>diff --git a/docs/documentation/platform/agent-proxy/proxied-services.mdx b/docs/documentation/platform/agent-proxy/proxied-services.mdxindex e5227d6959..43bc946fd9 100644--- a/docs/documentation/platform/agent-proxy/proxied-services.mdx+++ b/docs/documentation/platform/agent-proxy/proxied-services.mdx@@ -3,7 +3,7 @@ title: "Proxied Services"description: "Define how the agent proxy applies credentials to traffic bound for an external service."----A proxied service tells the agent proxy how to apply credentials to traffic bound for an external service. It lives in a folder alongside your secrets and defines which hosts it covers.+A proxied service tells the agent proxy how to apply credentials to traffic bound for an external service. It lives in a folder alongside your secrets, defines which hosts it covers, and applies wherever your agent runs: on your own computer, or behind a proxy you deploy.To create one, open a folder in the secrets dashboard, click the dropdown arrow next to **Add Secret**, and select **Add Proxied Service**.@@ -24,7 +24,7 @@ Every service has these core fields, plus one or more credential rules described</ParamField><ParamField path="Enabled" type="boolean" optional default="true">- Toggle a service off without deleting it. A disabled service is skipped entirely: its placeholder environment variables are not set, no credentials are applied, and traffic to its hosts falls back to the [unmatched host policy](/documentation/platform/agent-proxy/deployment#unmatched-hosts).+ Toggle a service off without deleting it. A disabled service is skipped entirely: its placeholder environment variables are not set, no credentials are applied, and traffic to its hosts falls back to the [unmatched host policy](/documentation/platform/agent-proxy/standalone-agent-proxy#unmatched-hosts).</ParamField>@@ -83,12 +83,12 @@ With secret substitution, the agent is handed a dummy placeholder value. The age- The API carries the credential somewhere other than a header. Telegram, for example, puts the bot token in the URL path: `api.telegram.org/bot<token>/sendMessage`.- The agent has to see a value before it will make the call at all, headers included. Some HTTP clients validate that a credential is set, and agents often refuse to attempt a request without a real-looking key. The placeholder satisfies them, and the proxy swaps in the real value on the way out.-The placeholder is also delivered for you: [`infisical secrets agent-proxy connect`](/documentation/platform/agent-proxy/connecting-agents) sets it as an environment variable in the agent's environment, so there is nothing to hand out.+The placeholder is also delivered for you: both [`agent-proxy connect`](/documentation/platform/agent-proxy/standalone-agent-proxy) and [`agent-proxy run`](/documentation/platform/agent-proxy/local-agent-proxy) set it as an environment variable in the agent's environment, so there is nothing to hand out.<ParamField path="Environment Variable" type="string" required>- The environment variable name the agent receives, such as `TELEGRAM_BOT_TOKEN`. When an agent connects, `infisical secrets agent-proxy connect` sets this variable to the placeholder, so the agent uses it like a normal credential.+ The environment variable name the agent receives, such as `TELEGRAM_BOT_TOKEN`. When the agent starts, the CLI sets this variable to the placeholder, so the agent uses it like a normal credential.</ParamField><ParamField path="Placeholder Value" type="string" required>@@ -127,6 +127,8 @@ How the agent proxy handles the lease:<Note>Give **Manage Leases** on the dynamic secret to the proxy identity only. If the agent identity also has it, it could mint the credential itself and skip the proxy, so `connect` refuses to start by default.++ This reads the other way around for [local runs](/documentation/platform/agent-proxy/local-agent-proxy#dynamic-secrets), where the proxy mints as you: there, **you** need Manage Leases on the dynamic secret, and the sandbox is what stops the agent minting for itself.</Note>## Example: API request@@ -172,10 +174,10 @@ To reference a dynamic secret, replace `secretKey` on a credential with `dynamic## Next steps<CardGroup cols={2}>- <Card title="Connecting Agents" icon="plug" href="/documentation/platform/agent-proxy/connecting-agents">- Launch an agent and have it use the services you defined.+ <Card title="Standalone Agent Proxy" icon="server" href="/documentation/platform/agent-proxy/standalone-agent-proxy">+ For agents running on your infrastructure.</Card>- <Card title="Security" icon="shield-halved" href="/documentation/platform/agent-proxy/security">- The Proxy permission and the isolation model behind these services.+ <Card title="Local Agent Proxy" icon="laptop-code" href="/documentation/platform/agent-proxy/local-agent-proxy">+ For agents that live as long as your terminal session.</Card></CardGroup>diff --git a/docs/documentation/platform/agent-proxy/quickstart.mdx b/docs/documentation/platform/agent-proxy/quickstart.mdxdeleted file mode 100644index 4919caf992..0000000000--- a/docs/documentation/platform/agent-proxy/quickstart.mdx+++ /dev/null@@ -1,328 +0,0 @@-----title: "Agent Proxy quickstart"-sidebarTitle: "Quickstart"-description: "Broker your first credential to an agent through the Infisical Agent Proxy."------This tutorial takes you from an Infisical project to an agent making authenticated API calls through the Agent Proxy, with real credentials it never sees.--## Before you begin--To follow along, you'll need:--- An Infisical Secrets Management project.-- A GitHub account (this guide's running example) or any other API you'd rather broker. The steps are the same either way.-- Two hosts in the same private network: one for the agent proxy and one for the agent. The agent host must be able to reach the proxy on its port (`17322` by default).-- The [Infisical CLI](/cli/overview) installed on both the proxy host and the agent host.-- Optional: [GitHub's `gh` CLI](https://cli.github.com/) on the agent host, for the recommended verification in step 7. A `curl` fallback is provided, so this is not required.--## 1. Add a secret--First, get a GitHub personal access token to broker:--1. Go to [GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens](https://github.com/settings/personal-access-tokens).-2. Click **Generate new token**, give it a name, set an expiration, and choose the resource owner.-3. Leave the permissions at their defaults. The verification in step 7 calls `GET /user`, which any valid token can reach, so no permissions are needed here; later, grant only what your agent actually does.-4. Click **Generate token** and copy the `github_pat_…` value. GitHub only shows it once.--Then, in your Infisical project, create a folder for the agent (for example `/coding-agent` in the `dev` environment) and add a secret named `GITHUB_PAT` with that token as its value. It is a regular Infisical secret.----## 2. Create a proxied service--A proxied service maps a host to the secret the proxy applies. In the same folder, open the **Add Secret** dropdown and select **Add Proxied Service**, then work through the steps:----<Steps>- <Step title="Pick the GitHub template">- The template fills everything in for you: the host `api.github.com` and a **Secret Substitution** rule that hands the agent a realistic `ghp_…` placeholder and swaps in the real token on the way out.-- - </Step>- <Step title="Details">- Keep the service name `github` and the host pattern `api.github.com`.-- - </Step>- <Step title="Header Rewrites">- This step is skipped automatically for GitHub. The token does travel in the `Authorization` header, but this template handles that with **Secret Substitution** (next step): the agent itself puts a placeholder in the header, and the proxy swaps it for the real token.- </Step>- <Step title="Secret Substitution">- Select `GITHUB_PAT` as the secret holding the real value.-- Here is how the pieces fit together. When your agent connects, it gets an environment variable `GITHUB_TOKEN` (the placeholder name the GitHub template uses) set to the fake `ghp_…` placeholder. The agent uses it like any GitHub token and sends `Authorization: Bearer <placeholder>`. As the request passes through the proxy, the placeholder is replaced with the real value of your `GITHUB_PAT` secret. The template scopes this swap to headers, since that is where GitHub expects the token; a substitution can also target the URL path, query, or body.-- - </Step>- <Step title="Review and create">- Double-check the host pattern and the substitution rule, then click **Create Proxied Service**.-- - </Step>-</Steps>--<Note>- Not on the template list? Pick **Custom** and configure a [header rewrite or secret substitution](/documentation/platform/agent-proxy/proxied-services) by hand.-</Note>--## 3. Create the proxy identity--The proxy and the agent authenticate as **two separate machine identities with opposite access**. That split is the whole security model: the proxy can read your secrets, the agent never can.--<Note>- The two templates have similar names but are for different identities: use **Agent Proxy Policies** for the proxy (this step) and **Agent Policies** for the agent (next step). Pick the one that matches the identity you are creating.-</Note>--**The proxy identity reads the secrets.**--<Steps>- <Step title="Create the identity">- In your project, go to **Access Control → Machine Identities** and click **Add Machine Identity to Project → Create New**. Name it (for example `agent-proxy`), leave the **Role** as **No Access**, select the **Agent Proxy Policies** template under **Additional Privileges**, and create it.-- -- <Note>- **Agent Proxy Policies** grants the proxy these permissions, project-wide:-- - `Read Value` and `Describe Secret` on **Secrets**: fetch real secret values- - `Lease` on **Dynamic Secrets**: mint credentials for brokered [dynamic secrets](/documentation/platform/agent-proxy/proxied-services#using-dynamic-secrets)- - `Report Usage` on **Proxied Services**: report service usage back to Infisical-- This template is the identity's entire access, so its project **Role** stays **No Access**. For a production deployment, grant these scoped to your services' environments and paths with a [custom role](/documentation/platform/access-controls/role-based-access-controls) or a conditional [additional privilege](/documentation/platform/access-controls/additional-privileges). See [Permissions](/documentation/platform/agent-proxy/security#permissions).- </Note>- </Step>- <Step title="Generate a Client Secret">- Open the identity and go to its [Universal Auth](/documentation/platform/identities/universal-auth) authentication method.-- -- Click **Add Client Secret**.-- -- Save the **Client ID** and the **Client Secret**; you will pass both to the proxy in step 5.- </Step>-</Steps>--## 4. Create the agent identity--**The agent identity routes traffic but reads no secrets.** It needs the `Proxy` permission and nothing else.--<Steps>- <Step title="Create the identity">- In your project, go to **Access Control → Machine Identities** and click **Add Machine Identity to Project → Create New**. Name it (for example `agent`), leave the **Role** as **No Access**, select the **Agent Policies** template under **Additional Privileges**, and create it.-- -- <Note>- **Agent Policies** grants the agent one permission, project-wide:-- - `Proxy` on **Proxied Services**: route traffic and have credentials applied, with no secret read access-- This template is the identity's entire access, so its project **Role** stays **No Access**. For a production deployment, grant it scoped to your services' environments and paths with a [custom role](/documentation/platform/access-controls/role-based-access-controls) or a conditional [additional privilege](/documentation/platform/access-controls/additional-privileges). See [Permissions](/documentation/platform/agent-proxy/security#permissions).- </Note>- </Step>- <Step title="Generate a Client Secret">- Open the identity and add a **Client Secret** under Universal Auth, exactly as in the previous step. Save the **Client ID** and the **Client Secret**; you will pass both to the agent in step 6.- </Step>-</Steps>--## 5. Start the agent proxy--<Steps>- <Step title="Install the Infisical CLI">- On the proxy host, a separate machine in your agent's private network, install the [Infisical CLI](/cli/overview). Or use Docker for the container option below.- </Step>- <Step title="Authenticate as the proxy identity">- Set `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` and `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET` to the Client ID and Client Secret you saved in step 3.--<Tabs>- <Tab title="Infisical Cloud (US)">- ```bash- # Authenticate as the proxy identity (from step 3)- export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id>- export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret>- ```- </Tab>- <Tab title="Infisical Cloud (EU)">- ```bash- # Authenticate as the proxy identity (from step 3), pointed at EU Cloud- export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id>- export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret>- export INFISICAL_DOMAIN=https://eu.infisical.com- ```- </Tab>- <Tab title="Self-Hosted">- ```bash- # Authenticate as the proxy identity (from step 3), pointed at your instance- export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id>- export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret>- export INFISICAL_DOMAIN=https://infisical.your-domain.com- ```- </Tab>-</Tabs>-- </Step>- <Step title="Start the proxy">- The proxy listens on port `17322` by default. Use the CLI or Docker:--<Tabs>- <Tab title="CLI">- ```bash- infisical secrets agent-proxy start- ```- </Tab>- <Tab title="Docker">- ```bash- # -e without a value passes through the variables you exported above- docker run -p 17322:17322 \- -e INFISICAL_UNIVERSAL_AUTH_CLIENT_ID \- -e INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET \- -e INFISICAL_DOMAIN \- infisical/cli:latest secrets agent-proxy start- ```- </Tab>-</Tabs>--Remember this host's address; the next step points `INFISICAL_AGENT_PROXY_ADDRESS` at it. For production deployment, see [Deployment](/documentation/platform/agent-proxy/deployment).-- </Step>-</Steps>--## 6. Connect your agent--<Steps>- <Step title="Install the Infisical CLI">- On the agent host, install the [Infisical CLI](/cli/overview); `connect` is a CLI command.- </Step>- <Step title="Set the connection details">- Set the agent's authentication and connection details as environment variables:--<Tabs>- <Tab title="Infisical Cloud (US)">- ```bash- # Authenticate as the agent identity (from step 4)- export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-client-id>- export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-client-secret>-- # Scope: your project, plus the environment and folder from step 1- export INFISICAL_PROJECT_ID=<project-id>- export INFISICAL_ENVIRONMENT=dev- export INFISICAL_SECRET_PATH=/coding-agent-- # The agent proxy to route through (from step 5)- export INFISICAL_AGENT_PROXY_ADDRESS=<proxy-host>:17322- ```- </Tab>- <Tab title="Infisical Cloud (EU)">- ```bash- # Authenticate as the agent identity (from step 4), pointed at EU Cloud- export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-client-id>- export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-client-secret>- export INFISICAL_DOMAIN=https://eu.infisical.com-- # Scope: your project, plus the environment and folder from step 1- export INFISICAL_PROJECT_ID=<project-id>- export INFISICAL_ENVIRONMENT=dev- export INFISICAL_SECRET_PATH=/coding-agent-- # The agent proxy to route through (from step 5)- export INFISICAL_AGENT_PROXY_ADDRESS=<proxy-host>:17322- ```- </Tab>- <Tab title="Self-Hosted">- ```bash- # Authenticate as the agent identity (from step 4), pointed at your instance- export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-client-id>- export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-client-secret>- export INFISICAL_DOMAIN=https://infisical.your-domain.com-- # Scope: your project, plus the environment and folder from step 1- export INFISICAL_PROJECT_ID=<project-id>- export INFISICAL_ENVIRONMENT=dev- export INFISICAL_SECRET_PATH=/coding-agent-- # The agent proxy to route through (from step 5)- export INFISICAL_AGENT_PROXY_ADDRESS=<proxy-host>:17322- ```- </Tab>-</Tabs>-- </Step>- <Step title="Launch the agent">- Launch the agent through `connect`. Everything after `--` is the agent's own command:--<Tabs>- <Tab title="Claude Code">- ```bash- infisical secrets agent-proxy connect -- claude- ```- </Tab>- <Tab title="Codex">- ```bash- infisical secrets agent-proxy connect -- codex- ```- </Tab>- <Tab title="Any command">- ```bash- infisical secrets agent-proxy connect -- <your-agent-command>- ```- </Tab>-</Tabs>--The agent starts and behaves exactly as if you had launched it directly; nothing about it looks different. In its environment it finds `GITHUB_TOKEN`, set by `connect` to the fake placeholder, and uses it like a normal token. Its traffic now routes through the proxy: on calls to `api.github.com` the placeholder is swapped for the real token, and everything else passes through untouched. The next step makes that visible.--<Note>- Every setting here can also be passed as a flag or set in `.infisical.json`. See [Connecting Agents](/documentation/platform/agent-proxy/connecting-agents) for how `connect` works and what it puts in the agent's environment.-</Note>-- </Step>-</Steps>--## 7. Verify it works--Each method below makes the same `GET /user` call to `api.github.com`. The client sends only the `ghp_…` placeholder that `connect` put in the environment; as the request passes through the proxy, the placeholder is swapped for the real value of your `GITHUB_PAT` secret. GitHub returns your account profile even though the real token never reached the client. That is the whole point: real authenticated work without the caller ever holding the credential.--<Tabs>- <Tab title="Through your agent">- The agent you launched in step 6 is already brokering. In its session, send:-- > Run `gh api user` and show me the output.-- [GitHub's `gh` CLI](https://cli.github.com/) reads `GITHUB_TOKEN` from the environment on its own, so the agent needs no token wiring; it just runs the command and GitHub returns your profile. Requires `gh` on the host where the agent runs.- </Tab>- <Tab title="gh CLI">- Not driving an interactive agent? Run the check through `connect` directly, in the shell where you set the step 6 variables:-- ```bash- infisical secrets agent-proxy connect -- gh api user- ```-- `gh` reads `GITHUB_TOKEN` automatically, so there is nothing else to pass. Requires `gh` on the host where you run this.- </Tab>- <Tab title="curl">- No `gh`? Any HTTP client works the same way. `curl` sends the placeholder in the header and the proxy swaps it:-- ```bash- infisical secrets agent-proxy connect -- \- sh -c 'curl -sS https://api.github.com/user -H "Authorization: Bearer $GITHUB_TOKEN"'- ```- </Tab>-</Tabs>--<Note>- Getting a `401`? The proxy could not apply the credential and forwarded the placeholder unchanged (it does not block the call). Check the proxy's logs, and confirm the agent identity has `Proxy` on the service and the proxy identity has `Read Value` on `GITHUB_PAT`.-</Note>--## Next steps--<CardGroup cols={2}>- <Card title="Proxied Services" icon="right-left" href="/documentation/platform/agent-proxy/proxied-services">- Host patterns, header rewrites, and secret substitution in depth.- </Card>- <Card title="Deployment" icon="server" href="/documentation/platform/agent-proxy/deployment">- Take the Agent Proxy to production: placement, deployment methods, and HA.- </Card>-</CardGroup>diff --git a/docs/documentation/platform/agent-proxy/quickstart/credentials.mdx b/docs/documentation/platform/agent-proxy/quickstart/credentials.mdxnew file mode 100644index 0000000000..73475459fb--- /dev/null+++ b/docs/documentation/platform/agent-proxy/quickstart/credentials.mdx@@ -0,0 +1,78 @@+---+title: "Set up credentials"+sidebarTitle: "Set Up Credentials"+description: "Add the secret and the proxied service the Agent Proxy brokers, then pick where the proxy runs."+---++Every Agent Proxy setup starts with the same two things in Infisical: a secret holding the real credential, and a proxied service saying which host that credential is applied to. This page creates both, then points you at the setup that matches where your agent runs.++GitHub is this guide's running example. Any other API works the same way, and the steps are identical.++## Before you begin++- An Infisical Secrets Management project.+- A GitHub account, to create the token you will broker.++## 1. Add a secret++First, get a GitHub personal access token to broker:++1. Go to [GitHub → Settings → Developer settings → Personal access tokens → Fine-grained tokens](https://github.com/settings/personal-access-tokens).+2. Click **Generate new token**, give it a name, set an expiration, and choose the resource owner.+3. Leave the permissions at their defaults. The check at the end of this guide calls `GET /user`, which any valid token can reach, so no permissions are needed here; later, grant only what your agent actually does.+4. Click **Generate token** and copy the `github_pat_…` value. GitHub only shows it once.++Then, in your Infisical project, create a folder for the agent (for example `/coding-agent` in the `dev` environment) and add a secret named `GITHUB_PAT` with that token as its value. It is a regular Infisical secret.++++## 2. Create a proxied service++A proxied service maps a host to the secret the proxy applies. In the same folder, open the **Add Secret** dropdown and select **Add Proxied Service**, then work through the steps:++++<Steps>+ <Step title="Pick the GitHub template">+ The template fills everything in for you: the host `api.github.com` and a **Secret Substitution** rule that hands the agent a realistic `ghp_…` placeholder and swaps in the real token on the way out.++ + </Step>+ <Step title="Details">+ Keep the service name `github` and the host pattern `api.github.com`.++ + </Step>+ <Step title="Header Rewrites">+ This step is skipped automatically for GitHub. The token does travel in the `Authorization` header, but this template handles that with **Secret Substitution** (next step): the agent itself puts a placeholder in the header, and the proxy swaps it for the real token.+ </Step>+ <Step title="Secret Substitution">+ Select `GITHUB_PAT` as the secret holding the real value.++ Here is how the pieces fit together. When your agent connects, it gets an environment variable `GITHUB_TOKEN` (the placeholder name the GitHub template uses) set to the fake `ghp_…` placeholder. The agent uses it like any GitHub token and sends `Authorization: Bearer <placeholder>`. As the request passes through the proxy, the placeholder is replaced with the real value of your `GITHUB_PAT` secret. The template scopes this swap to headers, since that is where GitHub expects the token; a substitution can also target the URL path, query, or body.++ + </Step>+ <Step title="Review and create">+ Double-check the host pattern and the substitution rule, then click **Create Proxied Service**.++ + </Step>+</Steps>++<Note>+ Not on the template list? Pick **Custom** and configure a [header rewrite or secret substitution](/documentation/platform/agent-proxy/proxied-services) by hand.+</Note>++## 3. Pick where the proxy runs++The proxy has to sit between your agent and the internet, so where it runs follows from where your agent runs. Pick the one that matches yours and follow it to the end; each is a complete walkthrough that continues from here.++<CardGroup cols={2}>+ <Card title="Local Proxy" icon="laptop-code" href="/documentation/platform/agent-proxy/quickstart/local-proxy">+ For agents that live as long as your terminal session: Claude Code, Codex, or a script you are iterating on.+ </Card>+ <Card title="Standalone Proxy" icon="server" href="/documentation/platform/agent-proxy/quickstart/standalone-proxy">+ For agents running on your infrastructure, unattended or shared across your team.+ </Card>+</CardGroup>diff --git a/docs/documentation/platform/agent-proxy/quickstart/local-proxy.mdx b/docs/documentation/platform/agent-proxy/quickstart/local-proxy.mdxnew file mode 100644index 0000000000..eedbda02ff--- /dev/null+++ b/docs/documentation/platform/agent-proxy/quickstart/local-proxy.mdx@@ -0,0 +1,129 @@+---+title: "Local proxy quickstart"+sidebarTitle: "Local Proxy"+description: "Run an agent on your own computer, sandboxed, with a proxy that starts and stops alongside it."+---++With a local proxy, everything happens on the computer you are already working on. The proxy starts alongside your agent, hands it placeholder credentials, swaps in the real ones as its requests leave, and stops when the agent exits. There is nothing to deploy and no machine identity to create: the proxy brokers as your logged-in user, against secrets you can already read.++Because the proxy and the agent share a machine, an **OS sandbox** is what keeps them apart. The agent cannot read your keyring or your credential files, and its only route to the network is the proxy.++```text+ +- your computer ------------------------++ | +- sandbox ----+ +--------------+ | +----------------++ | | your agent |--->| proxy | |----->| api.github.com |+ | +--------------+ +--------------+ | +----------------++ +----------------------------------------++```++By the end of this page an agent on your machine makes authenticated GitHub calls with a token it never sees.++## Before you begin++- [Set up credentials](/documentation/platform/agent-proxy/quickstart/credentials) finished, so you have a `GITHUB_PAT` secret and a `github` proxied service in `/coding-agent`.+- The [Infisical CLI](/cli/overview) installed.+- macOS, or Linux with [bubblewrap](https://github.com/containers/bubblewrap) installed.+- Optional: [GitHub's `gh` CLI](https://cli.github.com/), used for the check at the end. A `curl` fallback is provided, so this is not required.++The sandbox comes from the operating system, so what you install depends on which one you are on:++<Tabs>+ <Tab title="macOS">+ Nothing to install. The sandbox is part of macOS.+ </Tab>+ <Tab title="Linux">+ Linux gets the sandbox from [bubblewrap](https://github.com/containers/bubblewrap), which provides the `bwrap` binary that `run` calls:++ <Tabs>+ <Tab title="Debian / Ubuntu">+ ```bash+ sudo apt install bubblewrap+ ```+ </Tab>+ <Tab title="Fedora / RHEL">+ ```bash+ sudo dnf install bubblewrap+ ```+ </Tab>+ <Tab title="Arch">+ ```bash+ sudo pacman -S bubblewrap+ ```+ </Tab>+ <Tab title="Alpine">+ ```bash+ apk add bubblewrap+ ```+ </Tab>+ </Tabs>++ On a distribution not listed here, look for `bubblewrap` in your package manager.+ </Tab>+</Tabs>++## 1. Log in++```bash+infisical login+```++`run` brokers as you, so this is the only credential involved.++## 2. Launch your agent++Everything after `--` is your agent's own command. Run it from the directory you want the agent to work in:++```bash+infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- claude+```++This one command starts the proxy and your agent together, and shuts the proxy down when the agent exits. The agent behaves exactly as if you had launched it directly. In its environment it finds `GITHUB_TOKEN`, set to the fake `ghp_…` placeholder, and uses it like a normal token. Calls to `api.github.com` get the real token swapped in as they pass through; everything else goes out untouched. Meanwhile the agent is sandboxed: it cannot read your keyring, your `~/.aws` or `~/.ssh`, or your Infisical token.++<Note>+ In a directory with an `.infisical.json` (from `infisical init`) you can drop `--projectId`. `--env` and `--path` fall back to environment variables too, so in a configured shell this is just `agent-proxy run -- claude`.+</Note>++<Note>+ **On macOS the first run asks for your password once.** It adds the proxy's local CA to your login keychain, which is what lets tools like `gh` accept its certificates.+</Note>++## 3. Verify it works++Each check below makes the same `GET /user` call to `api.github.com`, and the client only ever sends the fake `ghp_…` placeholder. As the request passes through the proxy the placeholder is swapped for the real value of your `GITHUB_PAT`, so GitHub returns your account profile even though the real token never reached the client. That is the whole point: real authenticated work without the caller ever holding the credential.++<Tabs>+ <Tab title="Ask your agent">+ The agent you just launched is already brokering. In its session, send:++ > Run `gh api user` and show me the output.++ [GitHub's `gh` CLI](https://cli.github.com/) reads `GITHUB_TOKEN` from the environment on its own, so the agent needs no token wiring: it runs the command and GitHub answers with your profile. Requires `gh` on your machine.+ </Tab>+ <Tab title="gh CLI">+ Not driving an interactive agent? Run the check in place of the agent command:++ ```bash+ infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- gh api user+ ```++ `gh` reads `GITHUB_TOKEN` automatically, so there is nothing else to pass.+ </Tab>+ <Tab title="curl">+ No `gh`? Any HTTP client works the same way. `curl` sends the placeholder in the header and the proxy swaps it:++ ```bash+ infisical secrets agent-proxy run --projectId=<project-id> --env=dev --path=/coding-agent -- \+ sh -c 'curl -sS https://api.github.com/user -H "Authorization: Bearer $GITHUB_TOKEN"'+ ```+ </Tab>+</Tabs>++<Note>+ Getting a `401`? The proxy could not apply the credential and forwarded the placeholder unchanged. Confirm you have **Read Value** on `GITHUB_PAT`, since `run` brokers as you, and that the host pattern matches `api.github.com`. Add `--log-file=/tmp/broker.log` and `tail -f` it to see the decision for each request.+</Note>++For more depth, the [Local Agent Proxy](/documentation/platform/agent-proxy/local-agent-proxy) reference covers what the sandbox allows and denies, how certificates work, and every flag `run` takes.++<Info>+ For agents running on your infrastructure, follow the [Standalone Proxy](/documentation/platform/agent-proxy/quickstart/standalone-proxy) quickstart instead.+</Info>diff --git a/docs/documentation/platform/agent-proxy/quickstart/standalone-proxy.mdx b/docs/documentation/platform/agent-proxy/quickstart/standalone-proxy.mdxnew file mode 100644index 0000000000..b862fa025b--- /dev/null+++ b/docs/documentation/platform/agent-proxy/quickstart/standalone-proxy.mdx@@ -0,0 +1,139 @@+---+title: "Standalone proxy quickstart"+sidebarTitle: "Standalone Proxy"+description: "Run an Agent Proxy on a host of its own and launch agents behind it."+---++A standalone proxy runs as a long-lived process on a machine of its own, and your agents run elsewhere. Each agent is launched so that its outbound requests route through the proxy, which applies the real credentials on the way out and leaves everything else untouched. This is the setup for agents that run unattended, and for one proxy shared across a team.++The agent is on a different host from the proxy, so it has no access at all to the process holding the real credentials. The two authenticate as **two separate machine identities with opposite access**: the proxy can read your secrets, the agent never can. That split is the security model, and it is why this page creates two identities rather than one.++```text+ agent host proxy host+ +--------------+ +--------------+ +----------------++ | your agent |--->| proxy |-------->| api.github.com |+ +--------------+ +--------------+ +----------------++```++By the end of this page an agent on one host makes authenticated GitHub calls through a proxy on another, with a token it never sees.++## Before you begin++- [Set up credentials](/documentation/platform/agent-proxy/quickstart/credentials) finished, so you have a `GITHUB_PAT` secret and a `github` proxied service in `/coding-agent`.+- **Two hosts in the same private network**, one for the proxy and one for the agent, with the agent host able to reach the proxy on port `17322`.+- The [Infisical CLI](/cli/overview) installed on both hosts.+- Optional: [GitHub's `gh` CLI](https://cli.github.com/), used for the check at the end. A `curl` fallback is provided, so this is not required.++## 1. Create the proxy identity++**This identity reads the secrets.** In your project, go to **Access Control → Machine Identities** and click **Add Machine Identity to Project → Create New**. Name it `agent-proxy`, leave the **Role** as **No Access**, select the **Agent Proxy Policies** template under **Additional Privileges**, and create it.++++<Note>+ The template grants exactly what a proxy needs: read access to secret values, leases for dynamic secrets, and usage reporting. That is the identity's entire access, which is why its **Role** stays **No Access**. For production, scope the same permissions to specific environments and paths: see [Permissions](/documentation/platform/agent-proxy/standalone-agent-proxy#permissions).+</Note>++Now open the identity and go to its [Universal Auth](/documentation/platform/identities/universal-auth) authentication method.++++Click **Add Client Secret**.++++Save the **Client ID** and the **Client Secret**. You will pass both to the proxy in a moment.++## 2. Create the agent identity++**This identity routes traffic but reads no secrets.** Create a second identity the same way, named `agent`, again with **Role** as **No Access**, this time selecting the **Agent Policies** template.++++<Note>+ This template grants one permission, `Proxy` on proxied services: route traffic and have credentials applied, with no ability to read a secret.+</Note>++Add a **Client Secret** under Universal Auth exactly as before, and save this identity's **Client ID** and **Client Secret** too. You now have four values, two per identity.++<Warning>+ Keep the two pairs apart: the proxy's credentials belong only on the proxy host, the agent's only on the agent host. Putting the proxy's on an agent machine would let that machine read your secrets directly, which is what this setup exists to prevent.+</Warning>++## 3. Start the proxy on its own host++On the proxy machine, authenticate as the proxy identity from step 1 and start it. It listens on port `17322`:++```bash+export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id>+export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret>+# export INFISICAL_DOMAIN=https://eu.infisical.com # EU Cloud, or your self-hosted URL++infisical secrets agent-proxy start+```++Leave it running and note this host's address; the next step points the agent at it.++<Note>+ Fine for trying it out, but this dies with your terminal. [Deployment](/documentation/platform/agent-proxy/standalone-agent-proxy#deployment) covers systemd, Docker, and PaaS.+</Note>++## 4. Launch your agent on its host++On the agent machine, authenticate as the agent identity from step 2, point it at the proxy, and scope it to the folder holding your secret and proxied service:++```bash+export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-client-id>+export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-client-secret>+# export INFISICAL_DOMAIN=https://eu.infisical.com # EU Cloud, or your self-hosted URL++export INFISICAL_PROJECT_ID=<project-id>+export INFISICAL_ENVIRONMENT=dev+export INFISICAL_SECRET_PATH=/coding-agent+export INFISICAL_AGENT_PROXY_ADDRESS=<proxy-host>:17322++infisical secrets agent-proxy connect -- claude+```++Everything after `--` is the agent's own command. It starts as if you had launched it directly, finds `GITHUB_TOKEN` set to the fake `ghp_…` placeholder, and uses it like a normal token; the proxy swaps in the real value on calls to `api.github.com`.++## 5. Verify it works++Each check below makes the same `GET /user` call to `api.github.com`, and the client only ever sends the fake `ghp_…` placeholder. As the request passes through the proxy, on its own host, the placeholder is swapped for the real value of your `GITHUB_PAT`, so GitHub returns your account profile even though the real token never reached the client. That is the whole point: real authenticated work without the caller ever holding the credential.++<Tabs>+ <Tab title="Ask your agent">+ The agent you just launched is already brokering. In its session, send:++ > Run `gh api user` and show me the output.++ [GitHub's `gh` CLI](https://cli.github.com/) reads `GITHUB_TOKEN` from the environment on its own, so the agent needs no token wiring: it runs the command and GitHub answers with your profile. Requires `gh` on the agent host.+ </Tab>+ <Tab title="gh CLI">+ Not driving an interactive agent? Run the check directly, in the shell where you set the variables above:++ ```bash+ infisical secrets agent-proxy connect -- gh api user+ ```++ The proxy logs the request as `brokered`.+ </Tab>+ <Tab title="curl">+ No `gh`? Any HTTP client works the same way:++ ```bash+ infisical secrets agent-proxy connect -- \+ sh -c 'curl -sS https://api.github.com/user -H "Authorization: Bearer $GITHUB_TOKEN"'+ ```+ </Tab>+</Tabs>++<Note>+ Getting a `401`? The credential was not applied and the placeholder went out unchanged. Confirm the agent identity has `Proxy` on the service and the proxy identity has `Read Value` on `GITHUB_PAT`. A `407` or `403` from the proxy itself means the agent's token was missing, invalid, or revoked.+</Note>++For more depth, the [Standalone Agent Proxy](/documentation/platform/agent-proxy/standalone-agent-proxy) reference covers deployment, network placement, high availability, and how each agent is authorized on every request.++<Info>+ For agents that live as long as your terminal session, follow the [Local Proxy](/documentation/platform/agent-proxy/quickstart/local-proxy) quickstart instead.+</Info>diff --git a/docs/documentation/platform/agent-proxy/security.mdx b/docs/documentation/platform/agent-proxy/security.mdxdeleted file mode 100644index b9ce512623..0000000000--- a/docs/documentation/platform/agent-proxy/security.mdx+++ /dev/null@@ -1,67 +0,0 @@-----title: "Security"-description: "Understand how the Agent Proxy isolates agents, authenticates requests, and manages trust."------This page covers the Agent Proxy's security model: how agents stay isolated from each other and from real credentials, how requests are authenticated and authorized, how TLS interception works, and what access each identity needs. None of this is required to get started (see the [Quickstart](/documentation/platform/agent-proxy/quickstart)), but it is worth reading before running the Agent Proxy in production.--## Isolation model--The Agent Proxy is pinned to one organization, the one its own [machine identity](/documentation/platform/identities/machine-identities) belongs to, but nothing narrower: no project, environment, path, or services are configured on it. It discovers those per agent. When an agent connects, the Agent Proxy uses the agent's token to look up which proxied services that agent may use in the agent's folder scope. It then fetches the real secret values with its own machine identity. One Agent Proxy instance can serve many agents across projects and environments in the org while keeping them isolated: an agent can never receive credentials it was not granted **Proxy** access to, even on a shared instance.--## Agent authentication--The Agent Proxy's security boundary is machine **identity**: what an agent can reach is decided entirely by its permissions:--- Every proxied request carries the agent's short-lived machine identity token in the proxy-authentication header. A request that arrives with no proxy-authentication header is challenged with `407` and a `Proxy-Authenticate: Basic` response. A request whose token is present but invalid, expired, or revoked is rejected with `403`. Both checks happen before anything else.-- The Agent Proxy grants nothing on its own. For each agent it asks Infisical which proxied services that agent's identity holds the **Proxy** permission on, within the agent's exact project, environment, and folder scope. Credentials are applied only for those services; everything else does not exist as far as that agent is concerned.-- The agent's identity cannot read secret values. Only the Agent Proxy's own identity can, and it lives on a separate machine. Even if an agent is tricked into leaking its token, that token grants no ability to fetch a secret; it can only route traffic through the same services the agent could already reach.-- Authorization is re-checked, not granted once. The Agent Proxy re-validates each active agent's permissions on every poll and fails closed. See [Caching and polling](/documentation/platform/agent-proxy/deployment#caching-and-polling) for the interval and exactly what happens when a grant is revoked.--## Certificates & TLS interception--For the Agent Proxy to read and modify HTTPS requests, agents must trust the certificates it presents. The chain has three tiers, and the sensitive part never leaves Infisical:--```mermaid-flowchart LR- A["Root CA<br/>(in Infisical, per org)"] -->|signs| B["Intermediate CA<br/>(in Agent Proxy memory)"]- B -->|signs| C["Leaf certificates<br/>(one per hostname)"]-```--The root CA is generated automatically per organization and stored encrypted in Infisical; its private key never leaves the server, and all signing happens server-side. At startup, the Agent Proxy generates a keypair locally and has Infisical sign it into a short-lived intermediate certificate (7 days, re-signed automatically before expiry). This certificate can mint leaf certificates but no further CAs. Leaf certificates (valid 24 hours, cached in memory) are minted locally per hostname, for the exact hostname the agent requested, with no Infisical round-trip.--On the agent machine, the `connect` wrapper downloads the root CA to `~/.infisical/agent-proxy/mitm-ca.pem` and points the standard trust environment variables (`SSL_CERT_FILE`, `NODE_EXTRA_CA_CERTS`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE`, `GIT_SSL_CAINFO`, `DENO_CERT`) at it. The Agent Proxy's connection to the real service is standard HTTPS with normal certificate verification, so real credentials always travel encrypted.--## Permissions--Proxied services have their own project-level permission subject. Alongside the usual **Read**, **Create**, **Modify**, and **Remove** actions for managing services, it adds the one that defines the security model: **Proxy**. An identity with **Proxy** has a service's secrets applied to its traffic without ever being able to read the values, which is why it is the permission you grant agent machine identities.--### Roles--Grant each identity the minimum permissions it needs with a [custom role](/documentation/platform/access-controls/role-based-access-controls) or an [additional privilege](/documentation/platform/access-controls/additional-privileges), scoped to the environments and paths its services live in. The **Agent Proxy Policies** and **Agent Policies** templates (offered under Additional Privileges when creating an identity) apply these permissions in a single step and are the fastest way to get started, but they grant them project-wide. For production use, prefer a custom role or additional privilege scoped with conditions to the environments and paths your services occupy. This is the minimum each identity needs:--| Identity | Minimum permissions | Notes |-| --- | --- | --- |-| **Agent** | `Proxy` on **Proxied Services**, scoped to the environments and paths where its services live | This alone lets it route traffic and have credentials applied. It does not need to read any secret. |-| **Agent Proxy** | `Read Value` and `Describe Secret` on **Secrets**, covering every secret the services reference; `Manage Leases` on **Dynamic Secrets** for any dynamic secret a service brokers; and `Report Usage` on **Proxied Services** | This is the identity that fetches the real values, mints leases, and records service usage. `Describe Secret` determines whether a secret is visible to the identity at all, `Read Value` reveals its value, `Manage Leases` lets it mint a brokered dynamic secret, and `Report Usage` lets it stamp a service's "last used" time. It never holds `Proxy`; routing traffic is the agent's job alone. |--<Note>- An agent identity should be scoped to just the **Proxy** permission, with no secret read access. If an agent also needs real values in its environment, grant its identity **Read Value** on those specific secrets. Avoid granting folder-wide read access to an agent identity: that would also expose the brokered secrets and defeat the purpose of brokering them.-</Note>--The key thing to get right for the Agent Proxy: it needs **Read Value on every secret referenced by every service any of its agents use**, across the relevant environments and paths. If a referenced secret comes from a [secret import](/documentation/platform/agent-proxy/proxied-services#using-secrets-from-other-folders-and-environments), the read permission has to cover the secret's real location (the import source), not just the folder it is imported into. If a grant is missing, that credential is skipped.--For a service that brokers a [dynamic secret](/documentation/platform/agent-proxy/proxied-services#using-dynamic-secrets), the Agent Proxy identity needs `Manage Leases` on that dynamic secret. The agent identity must **not** have `Manage Leases` on it, or `agent-proxy connect` refuses to start.--The Agent Proxy also records each time it brokers a service, which surfaces as a "last used" time on the proxied service. This is why it needs `Report Usage`. Usage is always reported by the Agent Proxy identity, never the agent's: the agent runs in an untrusted environment, so letting it report would allow a compromised agent to forge usage. The proxy is the trusted observer.--## Next steps--<CardGroup cols={2}>- <Card title="Deployment" icon="server" href="/documentation/platform/agent-proxy/deployment">- Take the Agent Proxy to production: placement, deployment methods, and HA.- </Card>- <Card title="Connecting Agents" icon="plug" href="/documentation/platform/agent-proxy/connecting-agents">- Launch an agent behind the proxy and control what its environment holds.- </Card>-</CardGroup>diff --git a/docs/documentation/platform/agent-proxy/standalone-agent-proxy.mdx b/docs/documentation/platform/agent-proxy/standalone-agent-proxy.mdxnew file mode 100644index 0000000000..240089189c--- /dev/null+++ b/docs/documentation/platform/agent-proxy/standalone-agent-proxy.mdx@@ -0,0 +1,240 @@+---+title: "Standalone Agent Proxy"+sidebarTitle: "Standalone Proxy"+description: "Run an Agent Proxy on a host of its own, serving agents across your network."+---++A standalone proxy serves agents that run somewhere other than your own computer, and is the setup to use when a team shares one proxy. `agent-proxy start` runs it as one long-lived process on a machine of its own, and `agent-proxy connect` launches each agent behind it. Because the agent is on a different host, it has no access at all to the process holding the real credentials; that separation is the security boundary, and most of what follows exists to keep it intact.++```text++---- Your private network -------------------++| |+| +--------------+ |+| | Agent host |----+ | +------------------++| +--------------+ | | +-->| External APIs |+| | +----------------+ | | +------------------++| +-->| Agent Proxy |-------++| | | its own host |-------++| +--------------+ | +----------------+ | | +------------------++| | Agent host |----+ | +-->| Infisical |+| +--------------+ port 17322, | +------------------++| agents only |++---------------------------------------------++```++This page is the reference behind that arrangement: how an agent is authorized on every request, how to deploy it, where it belongs in your network, and what it keeps in memory.++## Isolation model++The Agent Proxy is pinned to one organization, the one its own [machine identity](/documentation/platform/identities/machine-identities) belongs to, but nothing narrower: no project, environment, path, or services are configured on it. It discovers those per agent. When an agent connects, the Agent Proxy uses the agent's token to look up which proxied services that agent may use in the agent's folder scope. It then fetches the real secret values with its own machine identity. One Agent Proxy instance can serve many agents across projects and environments in the org while keeping them isolated: an agent can never receive credentials it was not granted **Proxy** access to, even on a shared instance.++## Agent authentication++The Agent Proxy's security boundary is machine **identity**: what an agent can reach is decided entirely by its permissions:++- Every proxied request carries the agent's short-lived machine identity token in the proxy-authentication header. A request that arrives with no proxy-authentication header is challenged with `407` and a `Proxy-Authenticate: Basic` response. A request whose token is present but invalid, expired, or revoked is rejected with `403`. Both checks happen before anything else.+- The Agent Proxy grants nothing on its own. For each agent it asks Infisical which proxied services that agent's identity holds the **Proxy** permission on, within the agent's exact project, environment, and folder scope. Credentials are applied only for those services; everything else does not exist as far as that agent is concerned.+- The agent's identity cannot read secret values. Only the Agent Proxy's own identity can, and it lives on a separate machine. Even if an agent is tricked into leaking its token, that token grants no ability to fetch a secret; it can only route traffic through the same services the agent could already reach.+- Authorization is re-checked, not granted once. The Agent Proxy re-validates each active agent's permissions on every poll and fails closed. See [Caching and polling](#caching-and-polling) for the interval and exactly what happens when a grant is revoked.++## The two commands++`start` runs the proxy, `connect` launches an agent behind it. They live on different hosts and are always used as a pair:++```bash+# On the proxy host+infisical secrets agent-proxy start++# On each agent host; everything after -- is the agent's own command+infisical secrets agent-proxy connect --proxy=<proxy-host>:17322 --projectId=<project-id> --env=dev --path=/coding-agent -- claude+```++Each authenticates as its own [machine identity](/documentation/platform/identities/machine-identities) via [Universal Auth](/documentation/platform/identities/universal-auth), and the proxy's is always separate from the agents'. The proxy needs read access to the secrets its services reference; an agent needs only **Proxy** on the services it uses. [Permissions](#permissions) covers both in full.++## What `connect` puts in the agent's environment++`connect` requires no code changes in the agent: it points the agent's HTTP clients at the proxy, so the agent's normal outbound requests route through it. Each request carries the agent's Infisical token and folder scope, which is how the proxy knows which identity is asking and which of that folder's proxied services apply. Concretely, it sets:++- **Proxy routing.** `HTTPS_PROXY` and `HTTP_PROXY` point at the Agent Proxy. `NO_PROXY` always includes `localhost,127.0.0.1`; add more hosts with `--no-proxy` or an existing `NO_PROXY`.+- **Certificate trust.** The standard trust variables point at the downloaded root CA so the agent's HTTP clients accept the Agent Proxy's certificates. See [Certificates & TLS interception](#certificates-and-tls-interception).+- **Placeholders.** A dummy value for each [secret-substitution](/documentation/platform/agent-proxy/proxied-services#secret-substitution) service, so the agent has something to send.+- **Real values (opt-in).** To give the agent a real secret directly, grant its identity **Read Value** on that secret; `connect` then injects the value into the agent's environment, like any secret the identity can read. This is for values the agent uses in its own code; for credentials it sends to an external API, broker them instead. An agent with only the `Proxy` permission gets no real values, just the routing and placeholders above. Brokered credentials are never injected here; the Agent Proxy adds them to each outbound request itself, so they reach the destination but never the agent.++## Configuration++Every option resolves from the same sources, in order: **the flag → an environment variable → `.infisical.json` → the built-in default.** An explicitly-passed flag always wins. Where the environment variables are already set on the host, the flags fall away and only your agent command remains: `infisical secrets agent-proxy connect -- claude`.++| Option | Flag | Environment variable | `.infisical.json` |+| --- | --- | --- | --- |+| Auth | `--client-id` / `--client-secret` | `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID` / `_SECRET` | — |+| Instance | `--domain` | `INFISICAL_DOMAIN` | `domain` |+| Project | `--projectId` | `INFISICAL_PROJECT_ID` | `workspaceId` |+| Environment slug | `--env` | `INFISICAL_ENVIRONMENT` | `defaultEnvironment` |+| Secret path | `--path` | `INFISICAL_SECRET_PATH` | `defaultSecretPath` |+| Proxy address | `--proxy` | `INFISICAL_AGENT_PROXY_ADDRESS` | — |++<Note>+ The proxy address is the one setting that cannot come from `.infisical.json`. That file is usually committed to your repository, so a wrong or malicious value would silently route every agent's traffic through the wrong host. Pass it with `--proxy` or `INFISICAL_AGENT_PROXY_ADDRESS` instead.+</Note>++See the [CLI reference](/cli/commands/agent-proxy) for every flag on both subcommands.++## Deployment++Starting the proxy in a shell is fine while you are trying it out, but it dies with the terminal. Pick one of these instead. Whichever you choose, provide the identity's credentials, publish port `17322` to your agent machines only, and set `INFISICAL_DOMAIN` for EU Cloud or self-hosted.++<Tabs>+ <Tab title="CLI (systemd, VM)">+ Install the [CLI](/cli/overview) on the host and run `start` under a process supervisor so it restarts on failure:++ ```bash+ export INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id>+ export INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret>+ # export INFISICAL_DOMAIN=https://eu.infisical.com # EU Cloud or self-hosted++ infisical secrets agent-proxy start+ ```+ </Tab>+ <Tab title="Docker">+ The CLI ships as the `infisical/cli` image. Pass credentials as environment variables and publish the port:++ ```bash+ docker run -p 17322:17322 \+ -e INFISICAL_UNIVERSAL_AUTH_CLIENT_ID=<agent-proxy-client-id> \+ -e INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET=<agent-proxy-client-secret> \+ infisical/cli:latest secrets agent-proxy start+ ```++ Add `-e INFISICAL_DOMAIN=https://eu.infisical.com` for EU Cloud or a self-hosted instance.+ </Tab>+ <Tab title="PaaS (Render, Railway, Fly)">+ Deploy the `infisical/cli` image as a service:++ - **Image:** `infisical/cli:latest`+ - **Start command:** `secrets agent-proxy start`+ - **Environment:** `INFISICAL_UNIVERSAL_AUTH_CLIENT_ID`, `INFISICAL_UNIVERSAL_AUTH_CLIENT_SECRET`, and `INFISICAL_DOMAIN` if not on US Cloud+ - **Port:** `17322`, exposed on a private network your agents can reach, not the public internet++ On Render, this is a private service pointed at the image with the start command above.+ </Tab>+</Tabs>++<Note>+ Keep the Agent Proxy on a private network reachable only by your agent machines (see [Network placement](#network-placement)). To run more than one instance, see [High availability](#high-availability).+</Note>++## Network placement++Check that the proxy sits where the diagram above shows it:++- **Inside your private network, off the public internet.** The Agent Proxy's listening port should only ever be reachable from within your network.+- **Reachable only by your agent machines.** Restrict inbound access to the Agent Proxy's port to the hosts that run agents, using your usual controls (security groups, firewall rules, network policies).+- **On its own host.** Same network as the agents for low per-request latency, but a separate machine, which keeps the real credentials fully isolated from the agents.+- **Alongside any plain-HTTP upstreams.** Internal services the Agent Proxy reaches over plain HTTP belong inside the same trusted network.+- **Credentials where they are used.** Provision the Agent Proxy identity's client credentials only on its host, and each agent identity's only on its agent machine.++Outbound, the Agent Proxy only needs to reach your Infisical instance and the APIs your proxied services define.++## High availability++Run multiple Agent Proxy instances with the same machine identity behind a TCP load balancer. Instances coordinate through Infisical rather than with each other:++- All instances chain to the same per-organization root CA, so agents trust any instance. Each instance signs its own intermediate.+- Each instance keeps its own agent cache. If the load balancer moves an agent to a new instance, that instance does one fresh discovery and then serves from cache.+- Each instance polls Infisical independently. After a secret rotation, instances may briefly apply different values until their next poll (up to one poll interval).++## Caching and polling++The Agent Proxy keeps everything it needs in memory, so steady-state requests involve no Infisical calls:++- **First request from an agent**: the Agent Proxy discovers all proxied services in the agent's scope and fetches the referenced secret values, then serves every subsequent request from that agent, to any host, from cache.+- **Refresh**: every 60 seconds (configurable via `--poll-interval`), the Agent Proxy re-fetches services, permissions, and secret values for active agents. Changes such as a rotated secret or an edited service take effect within one poll interval, with no agent restart. Authorization fails closed on the same cycle. If an agent's identity, role, or Proxy grant is revoked, or its token expires, the Agent Proxy drops that agent's cached credentials on the next poll and stops applying them.+- **Eviction**: an agent idle for about 10 minutes has its cache dropped and polling stopped. Its next request triggers a fresh discovery.+- **API load**: polling grows with the number of active agents. With a large fleet or a short `--poll-interval`, factor in your instance's API rate limits; a longer interval reduces load at the cost of slower propagation.++## Unmatched hosts++When an agent requests a host no proxied service matches, the `--unmatched-host` flag decides what happens:++- `allow` (default): the request is forwarded untouched, with no credentials applied. This is the normal mode, because much of an agent's traffic does not need a brokered credential at all: reading documentation, cloning public repos, installing packages, or calling services the agent legitimately authenticates to itself. All of that flows through untouched, while matched hosts still get credentials applied.+- `block`: the request is rejected with `403`. Use this to restrict agents to an allowlist of exactly the services you have defined.++<Note>+ `block` applies to every host without a matching proxied service, including your Infisical instance itself. Since agent traffic routes through the Agent Proxy, Infisical CLI commands run from inside the agent (using the `INFISICAL_TOKEN` from its environment) will also be rejected in this mode.+</Note>++## Connection behaviors++- Both HTTPS and plain-HTTP services are brokered. HTTPS traffic arrives as `CONNECT` tunnels; plain `http://` traffic arrives as regular forward-proxy requests (useful for internal services without TLS). An `https://` URL sent as a plain forward-proxy request is rejected, so the Agent Proxy can never be used to downgrade TLS.+- Only HTTP and HTTPS are brokered, so SSH cannot be: use HTTPS with a brokered token instead. A tool that ignores the proxy variables is not brokered either; nothing forces its traffic through the proxy.+- If the agent identity can already read a secret that one of its proxied services brokers, `connect` refuses to start: the agent would receive that value directly and bypass the Agent Proxy. Pass `--allow-readable-brokered-secrets` to override the guardrail.++## Certificates and TLS interception++For the Agent Proxy to read and modify HTTPS requests, agents must trust the certificates it presents. The chain has three tiers, and the sensitive part never leaves Infisical:++```mermaid+flowchart LR+ A["Root CA<br/>(in Infisical, per org)"] -->|signs| B["Intermediate CA<br/>(in Agent Proxy memory)"]+ B -->|signs| C["Leaf certificates<br/>(one per hostname)"]+```++The root CA is generated automatically per organization and stored encrypted in Infisical; its private key never leaves the server, and all signing happens server-side. At startup, the Agent Proxy generates a keypair locally and has Infisical sign it into a short-lived intermediate certificate (7 days, re-signed automatically before expiry). This certificate can mint leaf certificates but no further CAs. Leaf certificates (valid 24 hours, cached in memory) are minted locally per hostname, for the exact hostname the agent requested, with no Infisical round-trip.++On the agent machine, the `connect` wrapper downloads the root CA to `~/.infisical/agent-proxy/mitm-ca.pem` and points the standard trust environment variables (`SSL_CERT_FILE`, `NODE_EXTRA_CA_CERTS`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE`, `GIT_SSL_CAINFO`, `DENO_CERT`) at it. The Agent Proxy's connection to the real service is standard HTTPS with normal certificate verification, so real credentials always travel encrypted.++## Permissions++Proxied services have their own project-level permission subject. Alongside the usual **Read**, **Create**, **Modify**, and **Remove** actions for managing services, it adds the one that defines the security model: **Proxy**. An identity with **Proxy** has a service's secrets applied to its traffic without ever being able to read the values, which is why it is the permission you grant agent machine identities.++**Roles.** Grant each identity the minimum permissions it needs with a [custom role](/documentation/platform/access-controls/role-based-access-controls) or an [additional privilege](/documentation/platform/access-controls/additional-privileges), scoped to the environments and paths its services live in. The **Agent Proxy Policies** and **Agent Policies** templates (offered under Additional Privileges when creating an identity) apply these permissions in a single step and are the fastest way to get started, but they grant them project-wide. For production use, prefer a custom role or additional privilege scoped with conditions to the environments and paths your services occupy. This is the minimum each identity needs:++| Identity | Minimum permissions | Notes |+| --- | --- | --- |+| **Agent** | `Proxy` on **Proxied Services**, scoped to the environments and paths where its services live | This alone lets it route traffic and have credentials applied. It does not need to read any secret. |+| **Agent Proxy** | `Read Value` and `Describe Secret` on **Secrets**, covering every secret the services reference; `Manage Leases` on **Dynamic Secrets** for any dynamic secret a service brokers; and `Report Usage` on **Proxied Services** | This is the identity that fetches the real values, mints leases, and records service usage. `Describe Secret` determines whether a secret is visible to the identity at all, `Read Value` reveals its value, `Manage Leases` lets it mint a brokered dynamic secret, and `Report Usage` lets it stamp a service's "last used" time. It never holds `Proxy`; routing traffic is the agent's job alone. |++<Note>+ An agent identity should be scoped to just the **Proxy** permission, with no secret read access. If an agent also needs real values in its environment, grant its identity **Read Value** on those specific secrets. Avoid granting folder-wide read access to an agent identity: that would also expose the brokered secrets and defeat the purpose of brokering them.+</Note>++The key thing to get right for the Agent Proxy: it needs **Read Value on every secret referenced by every service any of its agents use**, across the relevant environments and paths. If a referenced secret comes from a [secret import](/documentation/platform/agent-proxy/proxied-services#using-secrets-from-other-folders-and-environments), the read permission has to cover the secret's real location (the import source), not just the folder it is imported into. If a grant is missing, that credential is skipped.++For a service that brokers a [dynamic secret](/documentation/platform/agent-proxy/proxied-services#using-dynamic-secrets), the Agent Proxy identity needs `Manage Leases` on that dynamic secret. The agent identity must **not** have `Manage Leases` on it, or `agent-proxy connect` refuses to start.++The Agent Proxy also records each time it brokers a service, which surfaces as a "last used" time on the proxied service. This is why it needs `Report Usage`. Usage is always reported by the Agent Proxy identity, never the agent's: the agent runs in an untrusted environment, so letting it report would allow a compromised agent to forge usage. The proxy is the trusted observer.++## Watching what it does++Records go to **stderr**, so whatever supervises the proxy collects them, and `--log-file` additionally writes `json` for a collector to pick up. [Activity Logs](/documentation/platform/agent-proxy/activity-logs) covers the fields, the decisions, and how `--log-level` filters them.++## Troubleshooting++<AccordionGroup>+ <Accordion title="A 401 from the upstream API">+ The credential was not applied and the request went out as the agent sent it; the proxy does not block the call. Check the agent identity holds `Proxy` on the service, and that the proxy identity has `Read Value` on the secret the service references. The [activity log](/documentation/platform/agent-proxy/activity-logs) shows which decision each request got.+ </Accordion>+ <Accordion title="A 407 or 403 from the proxy itself">+ A `407` means the request arrived with no proxy-authentication header, a `403` means the agent's token was invalid, expired, or revoked. Both come from the proxy before anything is forwarded. Relaunch the agent through `connect` so it gets a fresh token.+ </Accordion>+ <Accordion title="Everything is passthrough, nothing is brokered">+ No proxied service matched the host. Check the [host pattern](/documentation/platform/agent-proxy/proxied-services#host-patterns) against the exact hostname the agent calls, that the service is enabled, and that the agent's `--env` and `--path` point at the folder the service lives in.+ </Accordion>+ <Accordion title="The agent cannot reach the proxy">+ The proxy's port (`17322` by default) has to be reachable from every agent host. Check your security groups, firewall rules, or network policies, and see [Network placement](#network-placement).+ </Accordion>+ <Accordion title="Certificate errors on the agent">+ `connect` downloads your organization's root CA and points the standard trust variables at it, so a tool that reads none of them will reject the proxy's certificates. See [Certificates & TLS interception](#certificates-and-tls-interception).+ </Accordion>+</AccordionGroup>++## Next steps++<CardGroup cols={2}>+ <Card title="Proxied Services" icon="right-left" href="/documentation/platform/agent-proxy/proxied-services">+ Host patterns, header rewrites, and secret substitution in depth.+ </Card>+ <Card title="agent-proxy CLI reference" icon="terminal" href="/cli/commands/agent-proxy">+ Every flag for `start` and `connect`, with examples.+ </Card>+</CardGroup>diff --git a/frontend/src/components/proxied-services/ProxiedServiceTemplateSelect.tsx b/frontend/src/components/proxied-services/ProxiedServiceTemplateSelect.tsxindex d2cde476a3..801589a5b7 100644--- a/frontend/src/components/proxied-services/ProxiedServiceTemplateSelect.tsx+++ b/frontend/src/components/proxied-services/ProxiedServiceTemplateSelect.tsx@@ -1,16 +1,7 @@import { useMemo, useState } from "react";import { GlobeIcon, PlusIcon, SearchIcon } from "lucide-react";-import {- Empty,- EmptyDescription,- EmptyHeader,- EmptyMedia,- EmptyTitle,- InputGroup,- InputGroupAddon,- InputGroupInput-} from "@app/components/v3";+import { InputGroup, InputGroupAddon, InputGroupInput } from "@app/components/v3";import {POPULAR_PROXIED_SERVICE_TEMPLATES,PROXIED_SERVICE_TEMPLATES,@@ -136,35 +127,16 @@ export const ProxiedServiceTemplateSelect = ({ onSelect }: Props) => {{isSearching ? (<section>- {filtered.length ? (- <Grid>- <CustomCard onClick={() => onSelect(null)} />- {filtered.map((template) => (- <TemplateCard- key={template.key}- template={template}- onClick={() => onSelect(template)}- />- ))}- </Grid>- ) : (- <Grid>- <CustomCard onClick={() => onSelect(null)} />- </Grid>- )}- {!filtered.length && (- <Empty className="mt-3 border">- <EmptyHeader>- <EmptyMedia variant="icon">- <SearchIcon />- </EmptyMedia>- <EmptyTitle>No matching services</EmptyTitle>- <EmptyDescription>- Try a different search term, or start from a custom service.- </EmptyDescription>- </EmptyHeader>- </Empty>- )}+ <Grid>+ <CustomCard onClick={() => onSelect(null)} />+ {filtered.map((template) => (+ <TemplateCard+ key={template.key}+ template={template}+ onClick={() => onSelect(template)}+ />+ ))}+ </Grid></section>) : (<>@@ -200,6 +172,28 @@ export const ProxiedServiceTemplateSelect = ({ onSelect }: Props) => {)}</>)}++ <p className="text-xs text-muted">+ Don't see the service you're looking for, or using a protocol other than HTTP?{" "}+ <a+ target="_blank"+ rel="noopener noreferrer"+ href="https://infisical.com/slack"+ className="underline underline-offset-2 hover:text-foreground"+ >+ Let us know on Slack+ </a>{" "}+ or{" "}+ <a+ target="_blank"+ rel="noopener noreferrer"+ href="https://github.com/Infisical/infisical/discussions"+ className="underline underline-offset-2 hover:text-foreground"+ >+ request it on GitHub+ </a>+ .+ </p></div>);};diff --git a/frontend/src/components/proxied-services/forms/CreateSecretModal.tsx b/frontend/src/components/proxied-services/forms/CreateSecretModal.tsxnew file mode 100644index 0000000000..a3ac53b772--- /dev/null+++ b/frontend/src/components/proxied-services/forms/CreateSecretModal.tsx@@ -0,0 +1,183 @@+import { useEffect } from "react";+import { Controller, useForm } from "react-hook-form";+import { zodResolver } from "@hookform/resolvers/zod";+import { useQueryClient } from "@tanstack/react-query";+import { z } from "zod";++import { createNotification } from "@app/components/notifications";+import {+ Button,+ Dialog,+ DialogClose,+ DialogContent,+ DialogDescription,+ DialogFooter,+ DialogHeader,+ DialogTitle,+ Field,+ FieldError,+ FieldLabel,+ Input,+ SecretInput+} from "@app/components/v3";+import { useCreateSecretV3 } from "@app/hooks/api";+import { secretKeys } from "@app/hooks/api/secrets/queries";+import { SecretType } from "@app/hooks/api/types";++type Props = {+ isOpen: boolean;+ onOpenChange: (isOpen: boolean) => void;+ projectId: string;+ environment: string;+ secretPath: string;+ onComplete: (secretKey: string) => void;+ suggestedKey?: string;+};++// value is required here, unlike the dashboard: this secret exists to be brokered as a credential,+// so an empty one would only fail later as a 401 from the upstream service+const schema = z.object({+ key: z.string().trim().min(1, { message: "Secret key is required" }),+ value: z.string().min(1, { message: "Secret value is required" })+});++type TFormSchema = z.infer<typeof schema>;++export const CreateSecretModal = ({+ isOpen,+ onOpenChange,+ projectId,+ environment,+ secretPath,+ onComplete,+ suggestedKey+}: Props) => {+ const queryClient = useQueryClient();+ const { mutateAsync, isPending } = useCreateSecretV3();++ const {+ control,+ handleSubmit,+ reset,+ setFocus,+ formState: { isSubmitting }+ } = useForm<TFormSchema>({+ resolver: zodResolver(schema),+ defaultValues: { key: "", value: "" }+ });++ // the modal stays mounted, so seed the key each time it opens rather than once at mount+ useEffect(() => {+ if (isOpen) reset({ key: suggestedKey?.trim() ?? "", value: "" });+ }, [isOpen, suggestedKey, reset]);++ const onFormSubmit = async ({ key, value }: TFormSchema) => {+ const res = await mutateAsync({+ projectId,+ environment,+ secretPath,+ secretKey: key,+ secretValue: value,+ secretComment: "",+ type: SecretType.Shared+ });++ // the picker reads secrets with viewSecretValue: true, which the mutation's own invalidation+ // does not match+ await queryClient.invalidateQueries({+ queryKey: secretKeys.getProjectSecret({+ projectId,+ environment,+ secretPath,+ viewSecretValue: true+ })+ });++ // an approval policy on this path turns the create into a change request, so there is nothing+ // to select yet+ if ("approval" in res) {+ createNotification({+ type: "info",+ text: "Change request submitted for review. You can use this secret once it is approved."+ });+ } else {+ createNotification({ text: "Successfully created secret", type: "success" });+ onComplete(key);+ }++ onOpenChange(false);+ reset();+ };++ return (+ <Dialog+ open={isOpen}+ onOpenChange={(open) => {+ onOpenChange(open);+ if (!open) reset();+ }}+ >+ <DialogContent+ className="sm:max-w-md"+ onOpenAutoFocus={(e) => {+ // land on the field that still needs typing+ e.preventDefault();+ setFocus(suggestedKey?.trim() ? "value" : "key");+ }}+ >+ <DialogHeader>+ <DialogTitle>Create Secret</DialogTitle>+ <DialogDescription>+ The secret will be created at the current secret path.+ </DialogDescription>+ </DialogHeader>+ <form onSubmit={handleSubmit(onFormSubmit)} className="flex flex-col gap-6">+ <Controller+ control={control}+ name="key"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="key">Key</FieldLabel>+ <Input+ id="key"+ autoComplete="off"+ placeholder="API_KEY"+ className="font-mono"+ isError={Boolean(error)}+ {...field}+ />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <Controller+ control={control}+ name="value"+ render={({ field, fieldState: { error } }) => (+ <Field>+ <FieldLabel htmlFor="value">Value</FieldLabel>+ <SecretInput id="value" {...field} />+ <FieldError>{error?.message}</FieldError>+ </Field>+ )}+ />+ <DialogFooter>+ <DialogClose asChild>+ <Button variant="ghost" type="button">+ Cancel+ </Button>+ </DialogClose>+ <Button+ type="submit"+ variant="project"+ isPending={isPending || isSubmitting}+ isDisabled={isPending || isSubmitting}+ >+ Create and Use+ </Button>+ </DialogFooter>+ </form>+ </DialogContent>+ </Dialog>+ );+};diff --git a/frontend/src/components/proxied-services/forms/CredentialSourceFields.tsx b/frontend/src/components/proxied-services/forms/CredentialSourceFields.tsxindex ae7f4a9646..b3602da9f2 100644--- a/frontend/src/components/proxied-services/forms/CredentialSourceFields.tsx+++ b/frontend/src/components/proxied-services/forms/CredentialSourceFields.tsx@@ -6,6 +6,7 @@ import {ChevronRightIcon,FingerprintIcon,KeyIcon,+ PlusIcon,SearchIcon} from "lucide-react";@@ -29,13 +30,16 @@ import {ProjectPermissionSecretActions,ProjectPermissionSub} from "@app/context/ProjectPermissionContext/types";+import { usePopUp } from "@app/hooks";import { useGetDynamicSecrets } from "@app/hooks/api/dynamicSecret/queries";import { DynamicSecretProviders } from "@app/hooks/api/dynamicSecret/types";+import { useGetSecretApprovalPolicyOfABoard } from "@app/hooks/api/secretApproval";import { fetchProjectSecrets, secretKeys } from "@app/hooks/api/secrets/queries";import { SecretV3RawResponse } from "@app/hooks/api/secrets/types";import { hasSecretReadValueOrDescribePermission } from "@app/lib/fn/permission";import { BROKERABLE_DYNAMIC_SECRETS } from "./brokerableDynamicSecrets";+import { CreateSecretModal } from "./CreateSecretModal";export type TCredentialSource = {secretKey?: string;@@ -51,6 +55,7 @@ type Props = {onChange: (value: TCredentialSource) => void;isSecretError?: boolean;isFieldError?: boolean;+ suggestedSecretKey?: string;};type SecretOption = {@@ -105,7 +110,8 @@ export const CredentialSourceFields = ({value,onChange,isSecretError,- isFieldError+ isFieldError,+ suggestedSecretKey}: Props) => {const { permission } = useProjectPermission();const { currentProject } = useProject();@@ -202,6 +208,34 @@ export const CredentialSourceFields = ({return dynamicSecrets.find((ds) => ds.name === value.dynamicSecretName)?.type;}, [value.dynamicSecretName, dynamicSecrets]);+ const { popUp, handlePopUpToggle, handlePopUpOpen } = usePopUp(["createSecret"] as const);++ const { data: boardPolicy } = useGetSecretApprovalPolicyOfABoard({+ projectId,+ environment,+ secretPath+ });+ const isProtectedBranch = Boolean(boardPolicy);++ // needs Create to make one and ReadValue to then pick it, otherwise they'd create a secret that+ // lands in the list greyed out+ const canCreateSecret =+ permission.can(+ ProjectPermissionSecretActions.Create,+ subject(ProjectPermissionSub.Secrets, {+ environment,+ secretPath,+ secretName: "*",+ secretTags: ["*"]+ })+ ) &&+ hasSecretReadValueOrDescribePermission(permission, ProjectPermissionSecretActions.ReadValue, {+ environment,+ secretPath,+ secretName: "*",+ secretTags: ["*"]+ });+const [open, setOpen] = useState(false);const [search, setSearch] = useState("");const searchRef = useRef<HTMLInputElement>(null);@@ -294,6 +328,29 @@ export const CredentialSourceFields = ({</div><div className="p-1">+ {canCreateSecret && (+ <>+ {isProtectedBranch ? (+ <GreyedRow+ icon={<PlusIcon className="size-4 shrink-0 text-muted" />}+ label="Create new secret"+ reason="This path requires approval, so a new secret would go to review before you could use it here."+ />+ ) : (+ <DropdownMenuItem+ onSelect={() => {+ setOpen(false);+ handlePopUpOpen("createSecret");+ }}+ >+ <PlusIcon className="size-4 shrink-0 text-muted" />+ <span className="truncate">Create new secret</span>+ </DropdownMenuItem>+ )}+ <DropdownMenuSeparator />+ </>+ )}+{hasSelection && !query && (<><DropdownMenuItem className="text-muted" onSelect={() => commit({})}>@@ -372,6 +429,16 @@ export const CredentialSourceFields = ({</div></DropdownMenuContent></DropdownMenu>++ <CreateSecretModal+ isOpen={popUp.createSecret.isOpen}+ onOpenChange={(isOpen) => handlePopUpToggle("createSecret", isOpen)}+ projectId={projectId}+ environment={environment}+ secretPath={secretPath}+ suggestedKey={suggestedSecretKey}+ onComplete={(secretKey) => commit({ secretKey })}+ /></div>);};diff --git a/frontend/src/components/proxied-services/forms/ProxiedServiceSubstitutionFields.tsx b/frontend/src/components/proxied-services/forms/ProxiedServiceSubstitutionFields.tsxindex 727f4ce3a3..819afbd7a8 100644--- a/frontend/src/components/proxied-services/forms/ProxiedServiceSubstitutionFields.tsx+++ b/frontend/src/components/proxied-services/forms/ProxiedServiceSubstitutionFields.tsx@@ -133,7 +133,11 @@ export const ProxiedServiceSubstitutionFields = ({control={control}name={`substitutions.${i}.surfaces`}render={({ field }) => (- <SurfaceSelect value={field.value} onChange={field.onChange} />+ <SurfaceSelect+ value={field.value}+ onChange={field.onChange}+ isError={Boolean(errors.substitutions?.[i]?.surfaces)}+ />)}/><FieldError errors={[errors.substitutions?.[i]?.surfaces]} />@@ -152,6 +156,7 @@ export const ProxiedServiceSubstitutionFields = ({dynamicSecretName: watchedSubstitutions?.[i]?.dynamicSecretName,dynamicSecretField: watchedSubstitutions?.[i]?.dynamicSecretField}}+ suggestedSecretKey={watchedSubstitutions?.[i]?.placeholderKey}onChange={(v) => setSubstitutionSource(i, v)}isSecretError={Boolean(errors.substitutions?.[i]?.secretKey)}isFieldError={Boolean(errors.substitutions?.[i]?.dynamicSecretField)}diff --git a/frontend/src/components/proxied-services/forms/SurfaceSelect.tsx b/frontend/src/components/proxied-services/forms/SurfaceSelect.tsxindex cbfbbe2600..57c50bdd1e 100644--- a/frontend/src/components/proxied-services/forms/SurfaceSelect.tsx+++ b/frontend/src/components/proxied-services/forms/SurfaceSelect.tsx@@ -1,13 +1,6 @@-import { ChevronDownIcon, XIcon } from "lucide-react";+import { MultiValue } from "react-select";-import {- Badge,- Button,- DropdownMenu,- DropdownMenuCheckboxItem,- DropdownMenuContent,- DropdownMenuTrigger-} from "@app/components/v3";+import { FilterableSelect } from "@app/components/v3";import { ProxiedServiceSubstitutionSurface } from "@app/hooks/api/proxiedServices/enums";const SURFACE_LABELS: Record<ProxiedServiceSubstitutionSurface, string> = {@@ -17,56 +10,34 @@ const SURFACE_LABELS: Record<ProxiedServiceSubstitutionSurface, string> = {[ProxiedServiceSubstitutionSurface.Header]: "Header"};-const ALL_SURFACES = Object.values(ProxiedServiceSubstitutionSurface);+type SurfaceOption = {+ value: ProxiedServiceSubstitutionSurface;+ label: string;+};++const SURFACE_OPTIONS: SurfaceOption[] = Object.values(ProxiedServiceSubstitutionSurface).map(+ (surface) => ({ value: surface, label: SURFACE_LABELS[surface] })+);type Props = {value: ProxiedServiceSubstitutionSurface[];onChange: (value: ProxiedServiceSubstitutionSurface[]) => void;isDisabled?: boolean;+ isError?: boolean;};-export const SurfaceSelect = ({ value, onChange, isDisabled }: Props) => {- const toggle = (surface: ProxiedServiceSubstitutionSurface) => {- onChange(value.includes(surface) ? value.filter((s) => s !== surface) : [...value, surface]);- };-- return (- <DropdownMenu>- <DropdownMenuTrigger asChild disabled={isDisabled}>- <Button variant="outline" className="w-full justify-between font-normal">- <div className="flex flex-wrap items-center gap-1">- {value.length ? (- value.map((surface) => (- <Badge key={surface} variant="neutral" className="gap-1">- {SURFACE_LABELS[surface]}- <XIcon- className="size-3 cursor-pointer"- onClick={(e) => {- e.stopPropagation();- if (!isDisabled) toggle(surface);- }}- />- </Badge>- ))- ) : (- <span className="text-muted">Select surfaces</span>- )}- </div>- <ChevronDownIcon className="size-4 opacity-50" />- </Button>- </DropdownMenuTrigger>- <DropdownMenuContent className="w-[var(--radix-dropdown-menu-trigger-width)]">- {ALL_SURFACES.map((surface) => (- <DropdownMenuCheckboxItem- key={surface}- checked={value.includes(surface)}- onCheckedChange={() => toggle(surface)}- onSelect={(e) => e.preventDefault()}- >- {SURFACE_LABELS[surface]}- </DropdownMenuCheckboxItem>- ))}- </DropdownMenuContent>- </DropdownMenu>- );-};+export const SurfaceSelect = ({ value, onChange, isDisabled, isError }: Props) => (+ <FilterableSelect+ isMulti+ value={SURFACE_OPTIONS.filter((option) => value.includes(option.value))}+ options={SURFACE_OPTIONS}+ onChange={(newValue) =>+ onChange((newValue as MultiValue<SurfaceOption>).map((option) => option.value))+ }+ placeholder="Select surfaces"+ getOptionValue={(option) => option.value}+ getOptionLabel={(option) => option.label}+ isDisabled={isDisabled}+ isError={isError}+ />+);diff --git a/frontend/src/components/proxied-services/forms/stepMeta.ts b/frontend/src/components/proxied-services/forms/stepMeta.tsindex 1985d3f72e..56285bca6f 100644--- a/frontend/src/components/proxied-services/forms/stepMeta.ts+++ b/frontend/src/components/proxied-services/forms/stepMeta.ts@@ -1,7 +1,7 @@import { ProxiedServiceStep } from "./schema";export const PROXIED_SERVICE_QUICKSTART_URL =- "https://infisical.com/docs/documentation/platform/agent-proxy/quickstart";+ "https://infisical.com/docs/documentation/platform/agent-proxy/quickstart/credentials";type StepMeta = {step: ProxiedServiceStep;