diff --git a/site/content/docs/concepts/identity.md b/site/content/docs/concepts/identity.md index 318c157c..add2b2fa 100644 --- a/site/content/docs/concepts/identity.md +++ b/site/content/docs/concepts/identity.md @@ -124,7 +124,10 @@ contains: The node does not set any of these facts. For an OIDC enrollment, roles come from the bindings in the mesh policy, never from the identity provider. -A bootstrap enrollment gets only the role of its bootstrap token. An +A bootstrap enrollment gets only the component role of its bootstrap token +(`mesh:role:node` or `mesh:role:router`). Custom access roles are granted +afterwards through policy bindings on `node:` (see +[custom node roles](../../guides/custom-node-roles/)). An issuer's `roles` claim is stored as `idp_role()`, which grants nothing by itself. Labels are the ones the node asked for and the policy allowed. Grants come from the policy. diff --git a/site/content/docs/guides/_index.md b/site/content/docs/guides/_index.md index 788ed0f2..67358d2e 100644 --- a/site/content/docs/guides/_index.md +++ b/site/content/docs/guides/_index.md @@ -8,10 +8,10 @@ aliases: --- Step-by-step pages for common tasks: publish a service, connect an agent -client, enroll machines that cannot log in, use Keycloak as the identity -provider, put agentgateway, kgateway, or Google Cloud Agent Gateway in front of -the mesh, enforce IdP-attested device posture and workload isolation, put an -agent in an OpenShell sandbox, a Substrate actor, a Wasmtime sandbox, or -`a2a-serve` on the mesh, and deploy a control plane on Kubernetes, Cloud Run, -SkyPilot or a GitHub codespace. Each page assumes that you have read the -[quick start](../getting-started/quickstart/). +client, enroll machines that cannot log in, grant custom access roles to a +node, use Keycloak as the identity provider, put agentgateway, kgateway, or +Google Cloud Agent Gateway in front of the mesh, enforce IdP-attested device +posture and workload isolation, put an agent in an OpenShell sandbox, a +Substrate actor, a Wasmtime sandbox, or `a2a-serve` on the mesh, and deploy a +control plane on Kubernetes, Cloud Run, SkyPilot or a GitHub codespace. Each +page assumes that you have read the [quick start](../getting-started/quickstart/). diff --git a/site/content/docs/guides/custom-node-roles.md b/site/content/docs/guides/custom-node-roles.md new file mode 100644 index 00000000..ea23a5cf --- /dev/null +++ b/site/content/docs/guides/custom-node-roles.md @@ -0,0 +1,373 @@ +--- +title: "Granting custom access roles to a node" +linkTitle: "Custom node roles" +weight: 3 +aliases: + - /docs/guides/custom-access-roles/ +--- + +In Agent Mesh, the word "role" is used across two distinct architectural layers: +**component roles** and **access roles**. Confusing the two is a common source +of enrollment and authorization issues. + +This guide clarifies the distinction between component roles and access roles, +explains why bootstrap tokens only enroll component identities, and walks +through a step-by-step recipe to enroll a node and grant it a custom access role +via policy bindings. + +## Component roles vs. access roles + +Agent Mesh enforces a strict two-layer role model: + +| Layer | Roles | Purpose | Lifecycle | +|---|---|---|---| +| **Component roles** | `mesh:role:node`, `mesh:role:router` | Identify the infrastructure binary type. A router must hold `mesh:role:router` before the control plane grants it a lease and peers trust it to relay traffic. A node must hold `mesh:role:node` before peers admit it as an enrolled mesh member. | Fixed at enrollment. Baked into the node's Biscuit credential (`role("mesh:role:node")`). Stays fixed for the life of the enrollment so a configuration mistake can never accidentally promote a node into a router. | +| **Access roles** | Custom names such as `caller`, `developer`, `analyst` | Describe what services a node or user may call (`allowed_services`), serve (`allowed_publish`), or expose on ingress (`allowed_ingress`), and which targets they may reach (`allowed_targets`). | Dynamic. Attached through policy bindings (`user:`, `group:`, `email:`, or `node:`). Take effect live via `POST /policies` without re-enrolling or restarting binaries. | + +### Why bootstrap tokens enroll component identities only + +When an operator runs: + +```bash +agentmesh-one token create --role caller # Do not do this for enrollment! +``` + +`agentmesh-one` or `POST /admin/bootstrap-tokens` generates a bootstrap token +carrying `role: "caller"`. However, when you pass that token to `agentmesh-node`: + +```bash +agentmesh-node join https://mesh.example.com --bootstrap-token-path ./tok +``` + +The enrollment fails with an error: + +```text +enrolled biscuit token lacks required role "mesh:role:node" +``` + +This is by design: `agentmesh-node` always requests `mesh:role:node` +(`RequiredRole: api.RoleNode`), and the control plane requires the requested role +to match the bootstrap token's role. A bootstrap token is strictly a mechanism to +enroll a component identity (`mesh:role:node` or `mesh:role:router`), not to grant +application-level access roles. + +To give a bootstrap-enrolled node a custom access role, you enroll the node with +`mesh:role:node`, get its PeerID, and bind the custom role to `node:` +in the mesh policy. + +--- + +## Step-by-step recipe + +### 1. Create a node bootstrap token + +Mint a bootstrap token with the component role `mesh:role:node`. + +Using `agentmesh-one`: + +```bash +agentmesh-one token create --role mesh:role:node --description "worker-node-1" > node-token +``` + +Or using the control plane admin API with `$AGENTMESH_ADMIN_TOKEN`: + +```bash +curl -fsS -X POST https://mesh.example.com/admin/bootstrap-tokens \ + -H "Authorization: Bearer $AGENTMESH_ADMIN_TOKEN" \ + -H "Content-Type: application/json" \ + -d '{"role":"mesh:role:node","ttl_hours":24,"max_usages":1,"description":"worker-node-1"}' \ + | jq -r .token > node-token +``` + +(The same action is available in the web console under **Bootstrap Tokens** $\rightarrow$ +**+ New Token** by selecting the **Node** role.) + +Save the token to a file on the target machine (here `./node-token`). Reading +the token from a file prevents credentials from lingering in shell history or +process tables (`ps`). + +### 2. Enroll and start `agentmesh-node` + +Enroll the node into a dedicated data directory (`./n1`): + +```bash +agentmesh-node join https://mesh.example.com \ + --bootstrap-token-path ./node-token \ + --data-dir ./n1 +``` + +When running `agentmesh-node run` in the foreground with a TCP listener (`--bind-addr`), +the node requires an API token file for local client authentication (`--api-token-path`). +Create this token file before starting the node: + +```bash +openssl rand -hex 16 > ./n1/api-token +chmod 0600 ./n1/api-token +``` + +(Alternatively, starting with `--daemonize` generates `api-token` automatically if one is not configured.) + +Once the token file is in place, start the node: + +```bash +agentmesh-node run \ + --control-plane https://mesh.example.com \ + --data-dir ./n1 \ + --bind-addr 127.0.0.1:8080 \ + --api-token-path ./n1/api-token +``` + +The node stores its cryptographic key and enrolled credential in +`/agent.db`. The bootstrap token file is no longer needed after +enrollment (though keeping `--bootstrap-token-path` configured allows autonomous +re-enrollment if the control plane database is ever recreated). + +### 3. Obtain the node's PeerID + +Every node has a unique **PeerID** (a string starting with `12D3KooW...`) derived +from its Ed25519 public key. You need this PeerID to bind policies to this +specific node. + +You can obtain the PeerID in any of three ways: + +1. **From startup logs**: When `agentmesh-node run` starts, it prints: + ```text + Agent Mesh Node Online. + PeerID: 12D3KooWFaBcD1234567890abcdefghijklmnopqrstuv + Listening on: [/ip4/127.0.0.1/tcp/5002 ...] + ``` + +2. **Via the debug CLI**: Using the node's local Unix socket: + ```bash + agentmesh-node debug mesh-info --socket-path ./n1/agentmesh.sock + ``` + +3. **Via the local HTTP API**: Querying the `/debug/mesh-info` route over TCP + with the node's API token: + ```bash + curl -s -H "Authorization: Bearer $(cat ./n1/api-token)" http://127.0.0.1:8080/debug/mesh-info | jq -r .peer_id + ``` + +> [!NOTE] +> `/mesh/identity` answers only over the Unix socket or mTLS (it rejects plain +> TCP to protect credentials from untrusted local clients). For general PeerID +> queries, `/debug/mesh-info` is available over both the Unix socket and +> authenticated TCP. + +### 4. Grant the custom access role through policy bindings + +Fetch the current mesh policy using `GET /admin/policy` with the admin token: + +```bash +curl -fsS https://mesh.example.com/admin/policy \ + -H "Authorization: Bearer $AGENTMESH_ADMIN_TOKEN" > policy.json +``` + +> [!WARNING] +> `POST /policies` replaces the entire mesh policy document rather than patching +> it. Always merge new roles and bindings into your existing `policy.json` +> fetched above. Replacing the policy entirely with a standalone snippet will drop +> other existing roles (such as `mesh:role:router`) and bindings, breaking +> router leases and other mesh services. + +Merge your custom access role into `roles` and add a binding to the node's PeerID +in `bindings`. For example, using `jq` to append a role named `caller` that allows +invoking `mcp://calculator` and any inference model: + +```bash +PEER_ID="12D3KooWFaBcD1234567890abcdefghijklmnopqrstuv" + +jq --arg pid "$PEER_ID" ' + .roles += [{ + "name": "caller", + "allowed_services": ["mcp://calculator", "inference://*"], + "allowed_targets": ["*"] + }] | + .bindings += [{ + "role": "caller", + "members": ["node:" + $pid] + }] +' policy.json > policy-updated.json +``` + +The resulting `policy-updated.json` contains your existing policy plus the new +role and binding: + +```json +{ + "roles": [ + { + "name": "mesh:role:router", + "allowed_publish": ["*"], + "allowed_targets": ["*"] + }, + { + "name": "mesh:role:node", + "allowed_services": ["system://mesh.catalog"], + "allowed_publish": ["*"], + "allowed_labels": ["*"] + }, + { + "name": "caller", + "allowed_services": ["mcp://calculator", "inference://*"], + "allowed_targets": ["*"] + } + ], + "bindings": [ + { + "role": "mesh:role:router", + "members": ["user:system:serviceaccount:agentmesh:router"] + }, + { + "role": "mesh:role:node", + "members": ["mesh:system:authenticated"] + }, + { + "role": "caller", + "members": ["node:12D3KooWFaBcD1234567890abcdefghijklmnopqrstuv"] + } + ] +} +``` + +Post the updated policy back to `POST /policies`: + +```bash +curl -fsS -X POST https://mesh.example.com/policies \ + -H "Authorization: Bearer $AGENTMESH_ADMIN_TOKEN" \ + -H "Content-Type: application/json" \ + -d @policy-updated.json +``` + +(You can also make this update in the web console under **Policy** by adding the +role and creating a binding with member `node:`.) + +### 5. Policy propagation and credential evaluation + +- **No node restart is required.** The node continues running without + interruption. +- **Propagation timing:** The control plane publishes a policy update event over + gossip. Nodes pull updated policy rules within the sync jitter window: + up to `ControlPlaneSyncInterval / 10`. With the default 15-minute sync + interval (`DefaultControlPlaneSyncInterval`), the jitter is **0 to 90 + seconds** (often taking effect within a few seconds on a quiet mesh). +- **Credential roles vs. policy evaluation:** + A bootstrap-enrolled node's Biscuit credential will **still list only + `mesh:role:node`**, even after a credential refresh. Inspecting the + credential via `/mesh/identity` or reading headers like `X-Mesh-Roles` + will not display `caller`. + + This is expected: for bootstrap nodes, bound custom access roles are not baked + into the Biscuit authority block. Instead, the control plane compiles the + binding into distributed Biscuit Datalog rules: + ```datalog + role("caller") <- node("12D3KooWFaBcD1234567890abcdefghijklmnopqrstuv") + granted_service_set("mcp", ["calculator"]) <- role("caller") + ``` + When the node sends a request, the verifier's Biscuit authorizer evaluates these + synced rules against the caller's identity fact `node("")`. + + **Effective permissions come from policy evaluation, not merely the roles + printed in the credential.** Anyone building a "what can this node do" view + must read effective grants from the policy bindings, not the roles listed in + the Biscuit. + +### 6. Verify allowed and denied calls + +Verify that the node can call permitted services and is denied when attempting +unauthorized calls. + +Assume another peer on the mesh (`12D3KooWTargetPeer...`) publishes +`mcp://calculator` as well as an administrative tool `mcp://admin-tools`. + +#### Test an allowed call + +Using the node's MCP client interface to call `call_remote_tool`: + +```bash +curl -s --unix-socket ./n1/agentmesh.sock \ + -X POST http://localhost/mcp \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", + "id": 1, + "method": "tools/call", + "params": { + "name": "call_remote_tool", + "arguments": { + "peer_id": "12D3KooWTargetPeer...", + "tool_name": "mcp://calculator/add", + "arguments": {"a": 2, "b": 3} + } + } + }' +``` + +The call is authorized under the `caller` role and returns the tool output: + +```json +{"jsonrpc":"2.0","id":1,"result":{"content":[{"type":"text","text":"5"}]}} +``` + +You can also test the same call via the direct proxy path: + +```bash +curl -s --unix-socket ./n1/agentmesh.sock \ + -X POST "http://localhost/mesh/12D3KooWTargetPeer.../mcp/calculator" \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' +``` + +#### Test a denied call + +Attempt to invoke a service not permitted by the `caller` role (such as +`mcp://admin-tools`): + +```bash +curl -s --unix-socket ./n1/agentmesh.sock \ + -X POST http://localhost/mcp \ + -H "Content-Type: application/json" \ + -d '{ + "jsonrpc": "2.0", + "id": 2, + "method": "tools/call", + "params": { + "name": "call_remote_tool", + "arguments": { + "peer_id": "12D3KooWTargetPeer...", + "tool_name": "mcp://admin-tools/restart", + "arguments": {} + } + } + }' +``` + +The request is rejected during policy evaluation, and `call_remote_tool` returns a +tool error indicating that authorization was denied: + +```json +{"jsonrpc":"2.0","id":2,"result":{"content":[{"type":"text","text":"call failed: request denied by policy"}],"isError":true}} +``` + +On the HTTP proxy path, an unauthorized request is rejected with `403 Forbidden`: + +```bash +curl -si --unix-socket ./n1/agentmesh.sock \ + -X POST "http://localhost/mesh/12D3KooWTargetPeer.../mcp/admin-tools" \ + -H "Content-Type: application/json" \ + -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' +``` + +```http +HTTP/1.1 403 Forbidden +Proxy-Status: agentmesh-node; error=http_request_denied +``` + +--- + +## Summary + +1. **Bootstrap tokens enroll component identities (`mesh:role:node`)**: Never pass custom access roles to `agentmesh-one token create --role` or `agentmesh-node join`. +2. **Access roles are bound via policy**: Use `node:` in `PolicyConfig.bindings` to grant access roles to specific nodes. +3. **No restarts needed**: Policy changes propagate within the sync jitter window (0–90 seconds by default). +4. **Effective permissions come from policy evaluation**: The node's Biscuit continues to list `mesh:role:node`, but requests are authorized by the synced Datalog rules. diff --git a/site/content/docs/guides/headless-enrollment.md b/site/content/docs/guides/headless-enrollment.md index 6bb8793a..94357f5e 100644 --- a/site/content/docs/guides/headless-enrollment.md +++ b/site/content/docs/guides/headless-enrollment.md @@ -128,12 +128,19 @@ curl -fsS -X POST https://mesh.example.com/admin/bootstrap-tokens \ ``` The plaintext `token` is shown once. The control plane keeps only its hash. -`role` is the role that the token enrolls into (`mesh:role:router` for a -router). `ttl_hours` defaults to 24 and `max_usages` to 1. The Bootstrap -Tokens view in the console and `agentmesh-one token create` do the same thing. An -OIDC user who is already enrolled can mint tokens for their own machines -through `POST /user/bootstrap-tokens` with their ID token. Such tokens -record the user as owner, and banning the user disables them. +`role` is the component role that the token enrolls into (`mesh:role:node` for a +node, `mesh:role:router` for a router). `ttl_hours` defaults to 24 and +`max_usages` to 1. The Bootstrap Tokens view in the console and `agentmesh-one +token create` do the same thing. An OIDC user who is already enrolled can mint +tokens for their own machines through `POST /user/bootstrap-tokens` with their ID +token. Such tokens record the user as owner, and banning the user disables them. + +Bootstrap tokens enroll component identities only, not custom access roles. +`agentmesh-node` always requests `mesh:role:node` and will fail to enroll if the +bootstrap token specifies a custom role (such as `caller` or `developer`). To +grant custom access roles to an enrolled node, bind the role to the node's +PeerID (`node:`) in the mesh policy; see the [custom node roles +guide](../custom-node-roles/). Write the token to a file on the target machine. The node reads it from a file and not from a flag, so it does not appear in process listings or in diff --git a/site/content/docs/reference/agentmesh-node.md b/site/content/docs/reference/agentmesh-node.md index cb4e609d..7fa40f28 100644 --- a/site/content/docs/reference/agentmesh-node.md +++ b/site/content/docs/reference/agentmesh-node.md @@ -59,7 +59,7 @@ bootstrap token, `join` runs an interactive OIDC login. | Flag | Default | Meaning | |---|---|---| -| `--bootstrap-token-path` | | File containing a bootstrap token. | +| `--bootstrap-token-path` | | File containing a bootstrap token minted with `"role": "mesh:role:node"`. | | `--bootstrap-token` | | The token as a value. Visible in process listings. The file form is preferred. | | `--offline-access` | `false` | Request an OIDC refresh token, so that the node can re-enroll on its own when its credential expires. | | `--allow-loopback` | `false` | Advertise and dial loopback and link-local addresses. For several nodes on one host. | diff --git a/site/content/docs/reference/agentmesh-one.md b/site/content/docs/reference/agentmesh-one.md index 377645d2..942e2304 100644 --- a/site/content/docs/reference/agentmesh-one.md +++ b/site/content/docs/reference/agentmesh-one.md @@ -107,7 +107,7 @@ The subcommands talk to a running instance over its HTTP API. Shared flags: | Command | Flags | Effect | |---|---|---| -| `token create` | `--role` (`mesh:role:node`), `--ttl-hours` (24), `--max-usages` (1), `--description`, `--autonomous-recovery` | Mint a token. Prints it once on stdout. | +| `token create` | `--role` (`mesh:role:node`), `--ttl-hours` (24), `--max-usages` (1), `--description`, `--autonomous-recovery` | Mint a component enrollment token (`mesh:role:node` or `mesh:role:router`). Prints it once on stdout. | | `token list` | | Tokens with usage count, status (`active`, `exhausted`, `expired`, `revoked`) and expiry. | | `token revoke ` | | Revoke by ID or unambiguous ID prefix. Enrolled devices keep their identity. | | `token qr` | `--enroll-url`, `--ttl-hours`, `--max-usages`, `--description`, `--autonomous-recovery` | Mint a node token and print `mesh://enroll?server=&token=` as a terminal QR code. The URL must be `https`. | diff --git a/site/content/docs/reference/control-plane.md b/site/content/docs/reference/control-plane.md index c6f89bae..176e8a9c 100644 --- a/site/content/docs/reference/control-plane.md +++ b/site/content/docs/reference/control-plane.md @@ -133,7 +133,7 @@ also accept binary protobuf, and answer in the encoding of the request. | `GET /admin/policy` | The mesh policy as `PolicyConfig`, the same document `POST /policies` takes. | | `POST /policies`, `PUT /policies` | Replace the mesh policy. The body is `PolicyConfig`, so a misspelt grant fails instead of being dropped. | | `GET /admin/bootstrap-tokens` | `BootstrapTokenListResponse`: every token, including revoked and expired ones. | -| `POST /admin/bootstrap-tokens` | Mint a token. Body `BootstrapTokenCreateRequest`: `role` (required), `ttl_hours` (default 24), `max_usages` (default 1), `description`, `autonomous_recovery` (default false), `ephemeral` (default false: nodes enrolled with the token are kept for `--ephemeral-node-retention` after their last refresh instead of `--node-retention`). Returns `201` with `BootstrapTokenCreateResponse`: `id`, `token` (shown once), `role`, `expire_time`. | +| `POST /admin/bootstrap-tokens` | Mint a token. Body `BootstrapTokenCreateRequest`: `role` (required, component role `mesh:role:node` or `mesh:role:router`), `ttl_hours` (default 24), `max_usages` (default 1), `description`, `autonomous_recovery` (default false), `ephemeral` (default false: nodes enrolled with the token are kept for `--ephemeral-node-retention` after their last refresh instead of `--node-retention`). Returns `201` with `BootstrapTokenCreateResponse`: `id`, `token` (shown once), `role`, `expire_time`. | | `DELETE /admin/bootstrap-tokens/{id}` | Revoke a token. Can be repeated. The token stays in the list with `revoke_time` set. | | `GET /admin/enrollments` | `EnrollmentRequestListResponse`: bootstrap enrollment requests, pending and decided. | | `POST /admin/enrollments/{id}/approve` | Approve. Spends a token usage. Checks the token again, and checks the labels against the role's `allowed_labels`. Answers `200` with a plain-text body, or `409` when the request is already resolved. The route answers `410` when the token was revoked, expired or spent after the request was queued, and `403` when the token's owner is banned. | diff --git a/site/content/docs/reference/policy.md b/site/content/docs/reference/policy.md index c62e45e8..b3058bff 100644 --- a/site/content/docs/reference/policy.md +++ b/site/content/docs/reference/policy.md @@ -64,9 +64,22 @@ notice. ## Roles +Agent Mesh distinguishes between **component roles** and **access roles**: + +- **Component roles** (`mesh:role:node` and `mesh:role:router`): Infrastructure identities built into the mesh architecture. They define what kind of binary a peer is: + - `mesh:role:router` must be held by a router before the control plane grants it a lease and other nodes trust it to relay traffic and serve ingress. + - `mesh:role:node` must be held by a node before peers admit it as an enrolled mesh member. + - These names are fixed for the life of the enrollment so a policy mistake can never accidentally promote a node into a router. + - **Bootstrap tokens only enroll component roles.** `agentmesh-node` always requests `mesh:role:node` at enrollment. Minting a bootstrap token with an access role (e.g. `--role caller`) fails enrollment. +- **Access roles** (`caller`, `developer`, `analyst`, etc.): Application-level roles describing what services a member may call (`allowed_services`), serve (`allowed_publish`), or expose on ingress (`allowed_ingress`), and which targets they may reach (`allowed_targets`). + - Access roles are attached dynamically through policy bindings (`user:`, `group:`, `email:`, or `node:`). + - They take effect live via `POST /policies` without re-enrolling or restarting binaries. + - For bootstrap-enrolled nodes, bound custom roles are derived at evaluation time via distributed Biscuit Datalog rules (`role("") <- node("")`) rather than written into the node's Biscuit token on refresh. Thus, inspecting the credential (`/mesh/identity`) or reading `X-Mesh-Roles` will continue to show only `mesh:role:node`. Effective permissions come from policy evaluation against the synced rules, not merely the roles listed in the credential. + - Policy changes propagate within the sync jitter window (up to `ControlPlaneSyncInterval / 10`, or 0–90 seconds by default). See the [custom node roles guide](../../guides/custom-node-roles/) for a step-by-step recipe. + | Field | Type | Meaning | |---|---|---| -| `name` | string, required, unique | The role name. `mesh:role:node` and `mesh:role:router` are the roles that the two binaries request at enrollment. Any other name is an ordinary role. | +| `name` | string, required, unique | The role name. `mesh:role:node` and `mesh:role:router` are reserved component roles that the two binaries request at enrollment. Any other name defines a custom access role. | | `allowed_services` | list of service patterns | Services that holders may call. | | `allowed_publish` | list of service patterns | Services that holders may serve. A router keeps a member's directory record only for a service its credential grants here, and a caller sends a request to a provider it reached by name only when the provider's credential does. If absent, holders may publish nothing but an egress destination whose `served_by` selects them. See [Publishing](#publishing). | | `allowed_ingress` | list of ingress grants | Inbound services (`a2a`, `mcp`, `inference`, or `*`) that holders may expose on router HTTP ingress. Each entry has `services` (required) and optional `allowed_auth_modes` (`INGRESS_AUTH_MODE_EDGE`, `INGRESS_AUTH_MODE_PASSTHROUGH`; empty grants `EDGE` only). See the [external ingress guide](../../guides/external-ingress/). | @@ -287,8 +300,13 @@ and UTF-8 (for example `group:Engineering Team`), and may not contain `"`, `role:` is not a member, because a role cannot grant a role. A bootstrap token enrollment carries no OIDC claims. Such a node receives the token's -role and the roles bound to `mesh:system:authenticated` or to its -`node:`. A binding on claims adds nothing to such a node. +component role (`mesh:role:node`) and any access roles bound to +`mesh:system:authenticated` or to its `node:`. A binding on claims +adds nothing to such a node. Roles bound to `node:` take effect via +distributed Datalog rules without updating the node's Biscuit credential, so the +credential still lists only `mesh:role:node` while policy evaluation authorizes +the calls. Grants propagate within the sync jitter window (0–90 seconds by +default); see the [custom node roles guide](../../guides/custom-node-roles/). ## Egress destinations @@ -399,11 +417,15 @@ At enrollment, refresh, and token exchange, the control plane mints into the credential one `role()` fact per role and the compiled `granted_*` facts of every role. For an identity that the identity provider authenticates, the control plane resolves the roles from the bindings. A member that enrolled -with a bootstrap token gets only the token's role. The control -plane also renders the policy as Datalog rules served as `datalog_rules` at -`GET /policies`. Nodes, routers and SDK members fetch this text -(`--control-plane-sync-interval`, 15 minutes for a node, 5 for a router) and -add it to their authorizer as it arrives. +with a bootstrap token receives only the token's component role (`mesh:role:node`) +in its credential. Access roles bound to its `node:` are not written +into the Biscuit, even on refresh. Instead, the control plane renders the +policy as Datalog rules served as `datalog_rules` at `GET /policies` (e.g. +`role("caller") <- node("...")`). Nodes, routers and SDK members fetch this text +(`--control-plane-sync-interval`, 15 minutes for a node, 5 for a router; +propagating within the sync jitter window of 0–90 seconds) and add it to their +authorizer as it arrives. When a node presents its credential, effective +permissions are derived from these synced rules during authorizer evaluation. At the destination node, in this order: