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
improvement(agent-proxy): remove agent and agent-proxy default roles
Saif263fe732ff2f
diff --git a/backend/src/db/schemas/models.ts b/backend/src/db/schemas/models.tsindex 916e9b114b..153f6abc07 100644--- a/backend/src/db/schemas/models.ts+++ b/backend/src/db/schemas/models.ts@@ -374,10 +374,7 @@ export enum ProjectMembershipRole {// sshSshHostBootstrapper = "ssh-host-bootstrapper",// kms- KmsCryptographicOperator = "cryptographic-operator",- // secrets brokering (agent proxy)- Agent = "agent",- AgentProxy = "agent-proxy"+ KmsCryptographicOperator = "cryptographic-operator"}export enum ResourceMembershipRole {diff --git a/backend/src/ee/services/permission/default-roles.ts b/backend/src/ee/services/permission/default-roles.tsindex 90cf31fc4d..4e8a75e872 100644--- a/backend/src/ee/services/permission/default-roles.ts+++ b/backend/src/ee/services/permission/default-roles.ts@@ -813,25 +813,6 @@ const buildCryptographicOperatorPermissionRules = () => {return rules;};-const buildAgentPermissionRules = () => {- const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);-- can(ProjectPermissionProxiedServiceActions.Proxy, ProjectPermissionSub.ProxiedServices);-- return rules;-};--const buildAgentProxyPermissionRules = () => {- const { can, rules } = new AbilityBuilder<MongoAbility<ProjectPermissionSet>>(createMongoAbility);-- can(- [ProjectPermissionSecretActions.DescribeSecret, ProjectPermissionSecretActions.ReadValue],- ProjectPermissionSub.Secrets- );-- return rules;-};-// Generalexport const projectAdminPermissions = buildAdminPermissionRules();export const projectMemberPermissions = buildMemberPermissionRules();@@ -844,10 +825,6 @@ export const sshHostBootstrapPermissions = buildSshHostBootstrapPermissionRules(// KMSexport const cryptographicOperatorPermissions = buildCryptographicOperatorPermissionRules();-// Secrets Brokering (Agent Proxy)-export const agentPermissions = buildAgentPermissionRules();-export const agentProxyPermissions = buildAgentProxyPermissionRules();-const buildApplicationAdminPermissionRules = () => {const { can, rules } = new AbilityBuilder<MongoAbility<ResourcePermissionSet>>(createMongoAbility);diff --git a/backend/src/ee/services/permission/permission-service.ts b/backend/src/ee/services/permission/permission-service.tsindex e59a17541e..6a8031a867 100644--- a/backend/src/ee/services/permission/permission-service.ts+++ b/backend/src/ee/services/permission/permission-service.ts@@ -16,8 +16,6 @@ import {import { TGroupDALFactory } from "@app/ee/services/group/group-dal";import { PamResourceRole } from "@app/ee/services/pam/pam-enums";import {- agentPermissions,- agentProxyPermissions,applicationAdminPermissions,applicationAuditorPermissions,applicationOperatorPermissions,@@ -139,10 +137,6 @@ const buildProjectPermissionRules = (projectUserRoles: TBuildProjectPermissionDTreturn sshHostBootstrapPermissions;case ProjectMembershipRole.KmsCryptographicOperator:return cryptographicOperatorPermissions;- case ProjectMembershipRole.Agent:- return agentPermissions;- case ProjectMembershipRole.AgentProxy:- return agentProxyPermissions;case ProjectMembershipRole.Custom: {return unpackRules<RawRuleOf<MongoAbility<ProjectPermissionSet>>>(permissions as PackRule<RawRuleOf<MongoAbility<ProjectPermissionSet>>>[]diff --git a/backend/src/services/project-role/project-role-fns.ts b/backend/src/services/project-role/project-role-fns.tsindex 4a63bf688b..f8157acbe1 100644--- a/backend/src/services/project-role/project-role-fns.ts+++ b/backend/src/services/project-role/project-role-fns.ts@@ -2,8 +2,6 @@ import { v4 as uuidv4 } from "uuid";import { ProjectMembershipRole, ProjectType } from "@app/db/schemas";import {- agentPermissions,- agentProxyPermissions,cryptographicOperatorPermissions,projectAdminPermissions,projectMemberPermissions,@@ -57,28 +55,6 @@ export const getPredefinedRoles = ({ projectId, projectType, roleFilter }: TGetPupdatedAt: new Date(),type: ProjectType.KMS},- {- id: uuidv4(),- projectId,- name: "Agent",- slug: ProjectMembershipRole.Agent,- permissions: agentPermissions,- description: "Proxy traffic through all proxied services in a project",- createdAt: new Date(),- updatedAt: new Date(),- type: ProjectType.SecretManager- },- {- id: uuidv4(),- projectId,- name: "Agent Proxy",- slug: ProjectMembershipRole.AgentProxy,- permissions: agentProxyPermissions,- description: "Read all secret values in a project. Intended for the agent proxy",- createdAt: new Date(),- updatedAt: new Date(),- type: ProjectType.SecretManager- },{id: uuidv4(),projectId,diff --git a/backend/src/services/role/project/project-role-factory.ts b/backend/src/services/role/project/project-role-factory.tsindex d8c58d2fee..ce74c47fdb 100644--- a/backend/src/services/role/project/project-role-factory.ts+++ b/backend/src/services/role/project/project-role-factory.ts@@ -3,8 +3,6 @@ import { v4 as uuidv4 } from "uuid";import { AccessScope, ActionProjectType, ProjectMembershipRole, ProjectType } from "@app/db/schemas";import {- agentPermissions,- agentProxyPermissions,cryptographicOperatorPermissions,projectAdminPermissions,projectMemberPermissions,@@ -172,28 +170,6 @@ export const newProjectRoleFactory = ({projectId,type: ProjectType.KMS},- {- id: uuidv4(),- name: "Agent",- slug: ProjectMembershipRole.Agent,- permissions: agentPermissions,- description: "Proxy traffic through all proxied services in a project",- createdAt: new Date(),- updatedAt: new Date(),- projectId,- type: ProjectType.SecretManager- },- {- id: uuidv4(),- name: "Agent Proxy",- slug: ProjectMembershipRole.AgentProxy,- permissions: agentProxyPermissions,- description: "Read all secret values in a project. Intended for the agent proxy",- createdAt: new Date(),- updatedAt: new Date(),- projectId,- type: ProjectType.SecretManager- },{id: uuidv4(),name: "Viewer",diff --git a/docs/cli/commands/agent-proxy.mdx b/docs/cli/commands/agent-proxy.mdxindex 488032d41e..97d07ab08b 100644--- a/docs/cli/commands/agent-proxy.mdx+++ b/docs/cli/commands/agent-proxy.mdx@@ -29,12 +29,12 @@ description: "Run the Infisical Agent Proxy and connect agents to it"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.-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 roles.+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.## Subcommands & flags<Accordion title="infisical secrets agent-proxy start" defaultOpen="true">- 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 (the built-in **Agent Proxy** role).+ 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.@@ -121,7 +121,7 @@ $ infisical secrets agent-proxy start --port 17322 --unmatched-host=block- `HTTPS_PROXY` / `HTTP_PROXY` pointing at the agent proxy, plus `NO_PROXY` (always includes `localhost,127.0.0.1`, merged with any `NO_PROXY` already in your environment and the `--no-proxy` flag).- The organization's root CA written to `~/.infisical/agent-proxy/mitm-ca.pem` and trusted via `SSL_CERT_FILE`, `NODE_EXTRA_CA_CERTS`, `REQUESTS_CA_BUNDLE`, `CURL_CA_BUNDLE`, `GIT_SSL_CAINFO`, and `DENO_CERT`.- Dummy placeholder environment variables for credential-substitution services the agent has **Proxy** access to.- - Real values for regular secrets the agent has **Read Value** on in the scoped folder, including secrets imported into it (similar to `infisical run`). This is opt-in; the built-in Agent role grants no read access, and brokered credentials never appear in the agent's environment. If the agent can read a secret that a proxied service brokers to it, `connect` refuses to start, since the agent would receive the real value directly and bypass the proxy; fix the permissions or pass `--allow-readable-brokered-secrets` to override.+ - Real values for regular secrets the agent has **Read Value** on in the scoped folder, including secrets imported into it (similar to `infisical run`). This is opt-in; an agent identity scoped to just the proxy permission has no read access, and brokered credentials never appear in the agent's environment. If the agent can read a secret that a proxied service brokers to it, `connect` refuses to start, since the agent would receive the real value directly and bypass the proxy; fix the permissions or pass `--allow-readable-brokered-secrets` to override.- `INFISICAL_TOKEN` set to the agent's access token, so the agent can run Infisical CLI commands itself.The 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.diff --git a/docs/documentation/platform/agent-proxy/quickstart.mdx b/docs/documentation/platform/agent-proxy/quickstart.mdxindex 75e7619ec8..5cf1a32783 100644--- a/docs/documentation/platform/agent-proxy/quickstart.mdx+++ b/docs/documentation/platform/agent-proxy/quickstart.mdx@@ -32,11 +32,11 @@ This guide walks through brokering a credential end to end: you will create a pr<Step title="Create two machine identities">Create two [machine identities](/documentation/platform/identities/machine-identities) with [Universal Auth](/documentation/platform/identities/universal-auth) and add both to your project:- 1. **Agent proxy identity**: assign it the built-in **Agent Proxy** role. It fetches the real credential values, so it needs read access to the referenced secrets.- 2. **Agent identity**: assign it the built-in **Agent** role. It can route traffic through proxied services but cannot read any secret values.+ 1. **Agent proxy identity**: it fetches the real credential values, so give it read access (describe and read value) to the referenced secrets.+ 2. **Agent identity**: it routes traffic through proxied services but should not read any secret values, so give it only the proxy permission on proxied services.<Note>- The built-in roles grant broad access across all environments and paths for a quick start. For production, consider [custom roles](/documentation/platform/access-controls/role-based-access-controls) scoped to specific environments and paths. Running more than one agent? See [how many machine identities you need](/documentation/platform/agent-proxy/security#how-many-machine-identities-do-you-need).+ Grant these permissions with a [custom role](/documentation/platform/access-controls/role-based-access-controls) or an [additional privilege](/documentation/platform/access-controls/additional-privileges) on each identity, scoped to the specific environments and paths you need. Running more than one agent? See [how many machine identities you need](/documentation/platform/agent-proxy/security#how-many-machine-identities-do-you-need).</Note></Step><Step title="Start the agent proxy">@@ -92,7 +92,7 @@ This guide walks through brokering a credential end to end: you will create a pr- Sets environment variables with real values for regular secrets the agent identity has **Read Value** on in the folder (including secrets imported into it), similar to `infisical run`.<Note>- Real values in the agent's environment are deliberate and opt-in. The built-in Agent role grants no secret read access, so nothing real lands in the environment unless an admin explicitly grants **Read Value** on specific secrets. Brokered credentials never appear in the agent's environment; the proxy only attaches them on the wire.+ Real values in the agent's environment are deliberate and opt-in. When the agent identity has only the proxy permission and no secret read access, nothing real lands in the environment unless an admin explicitly grants **Read Value** on specific secrets. Brokered credentials never appear in the agent's environment; the proxy only attaches them on the wire.</Note>The project can also be set via `INFISICAL_PROJECT_ID` or an `.infisical.json` file (created by `infisical init`) instead of `--projectId`.diff --git a/docs/documentation/platform/agent-proxy/security.mdx b/docs/documentation/platform/agent-proxy/security.mdxindex 02d9a9b5e1..f5cca9c1fc 100644--- a/docs/documentation/platform/agent-proxy/security.mdx+++ b/docs/documentation/platform/agent-proxy/security.mdx@@ -72,28 +72,19 @@ Proxied services have their own project-level permission subject, with five acti**Proxy** is meant for agent machine identities: an identity with Proxy gets a service's secrets applied to its traffic without ever being able to read the values.-### Built-in Roles+### Roles-Two built-in project roles make setup quick. Both grant broad access across all environments and paths; create a [custom role](/documentation/platform/access-controls/role-based-access-controls) instead if you need tighter scoping.--| Role | Slug | Intended for | What it grants |-| --- | --- | --- | --- |-| **Agent** | `agent` | The agent machine identity | Proxy on all proxied services. No secret read access. |-| **Agent Proxy** | `agent-proxy` | The agent proxy machine identity | Read access to all secret values, so it can fetch the real credentials it applies. No proxied service permissions. |--<Note>- The Agent role intentionally has 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>--### Custom Roles--The built-in roles grant the right permissions but across all environments and paths. To scope tighter, build a [custom role](/documentation/platform/access-controls/role-based-access-controls) instead. This is the minimum each identity needs:+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. 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. Add `Read Value` on **Secrets** only for values the agent uses directly (not brokered ones). || **Agent Proxy** | `Read Value` and `Describe Secret` on **Secrets**, covering every secret the services reference | This is the identity that actually fetches the real values. Both actions are required: `Describe Secret` determines whether a secret is visible to the identity at all, and `Read Value` reveals its value. It needs no proxied-service permission. |+<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), 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.### How Many Machine Identities Do You Need?diff --git a/frontend/src/helpers/roles.ts b/frontend/src/helpers/roles.tsindex b7700cf6d0..56872d04a3 100644--- a/frontend/src/helpers/roles.ts+++ b/frontend/src/helpers/roles.ts@@ -33,10 +33,6 @@ export const formatProjectRoleName = (role: string, customRoleName?: string) =>return "SSH Host Bootstrapper";case ProjectMembershipRole.KmsCryptographicOperator:return "Cryptographic Operator";- case ProjectMembershipRole.Agent:- return "Agent";- case ProjectMembershipRole.AgentProxy:- return "Agent Proxy";default:return role;}diff --git a/frontend/src/hooks/api/roles/types.ts b/frontend/src/hooks/api/roles/types.tsindex ac48b77431..3a6f72ff0b 100644--- a/frontend/src/hooks/api/roles/types.ts+++ b/frontend/src/hooks/api/roles/types.ts@@ -5,9 +5,7 @@ export enum ProjectMembershipRole {Viewer = "viewer",NoAccess = "no-access",SshHostBootstrapper = "ssh-host-bootstrapper",- KmsCryptographicOperator = "cryptographic-operator",- Agent = "agent",- AgentProxy = "agent-proxy"+ KmsCryptographicOperator = "cryptographic-operator"}export type TGetProjectRolesDTO = {