Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
feat(cua-driver): apply capability manifests across permission profiles (#3015)
Francesco Bonacci3a53e53f99dc
diff --git a/docs/content/docs/concepts/how-permission-policies-work.mdx b/docs/content/docs/concepts/how-permission-policies-work.mdxindex 0c9bfac5b1..1f29c09352 100644--- a/docs/content/docs/concepts/how-permission-policies-work.mdx+++ b/docs/content/docs/concepts/how-permission-policies-work.mdx@@ -14,7 +14,7 @@ call, it asks the same policy engine whether the call is allowed.Every public path reaches the authorization coordinator before platformdispatch. It evaluates the built-in risk map, managed policy, user policy, and-bounded session manifest in order. Adapters may repeat a check earlier as+optional capability manifest in order. Adapters may repeat a check earlier asdefense in depth, but they cannot authorize a request the runtime denies. Adenial returns an error to the client and the tool implementation is neverreached.diff --git a/docs/content/docs/how-to-guides/driver/connect-your-agent.mdx b/docs/content/docs/how-to-guides/driver/connect-your-agent.mdxindex 069719e404..c92bec0972 100644--- a/docs/content/docs/how-to-guides/driver/connect-your-agent.mdx+++ b/docs/content/docs/how-to-guides/driver/connect-your-agent.mdx@@ -43,19 +43,20 @@ default `standard` mode unless you change that process.that stick.- **Windows and Linux:** bare `cua-driver mcp` owns its own runtime and has no`--permission-mode` flag. Either set `CUA_DRIVER_PERMISSION_MODE` — plus- `CUA_DRIVER_SESSION_POLICY_FILE` and `CUA_DRIVER_SESSION_POLICY_APPROVED` for- `bounded` — in the client's `env` block, or run a `cua-driver serve` daemon in- that mode and point the client at it with `--socket`.+ `CUA_DRIVER_CAPABILITY_MANIFEST_FILE` and+ `CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED` for `bounded` — in the client's+ `env` block, or run a `cua-driver serve` daemon in that mode and point the+ client at it with `--socket`.`--grant existing-profile` is the one authorization flag `cua-driver mcp` acceptsdirectly, and it applies only to a runtime this command launches. An agent cannotwiden any of this from a tool call.<Callout type="warn">- A `standard`-mode runtime allows input against every application on the desktop. If an agent- should reach only a reviewed set of apps, origins, and directories, register it against a- `bounded` runtime instead — see [Write a bounded- manifest](/how-to-guides/driver/write-a-bounded-manifest).+ A `standard`-mode runtime allows input against every application on the+ desktop. If an agent should reach only a reviewed set of apps, origins, and+ directories, register it against a `bounded` runtime instead — see [Write a+ capability manifest](/how-to-guides/driver/write-a-bounded-manifest).</Callout>## Generate the client configdiff --git a/docs/content/docs/how-to-guides/driver/drive-a-web-page.mdx b/docs/content/docs/how-to-guides/driver/drive-a-web-page.mdxindex 192f7317a7..48a70cbf17 100644--- a/docs/content/docs/how-to-guides/driver/drive-a-web-page.mdx+++ b/docs/content/docs/how-to-guides/driver/drive-a-web-page.mdx@@ -87,8 +87,7 @@ origins, and typed browser tools. This avoids prompts without granting everyCua capability. For example:```yaml-version: 2-mode: bounded+version: 3expires_after: 2hidle_timeout: 20m@@ -124,8 +123,8 @@ Launch Cua Driver with that reviewed scope:```bashcua-driver serve \--permission-mode bounded \- --session-policy ./browser-session.yaml \- --approve-session-policy+ --capability-manifest ./browser-session.yaml \+ --approve-capability-manifest```Bounded attachment does not display a Cua modal or banner. The manifest is the@@ -161,7 +160,7 @@ A trusted embedding host can install the authorization callback describedin [Permission modes and bounded autonomy](/reference/cua-driver/permission-modes).In `standard`, the host may authorize the exact browser resource once. Astandalone CLI or MCP launch can instead use `--grant existing-profile`.-`bounded` uses the approved session manifest.+`bounded` uses the approved capability manifest.The browser may display its own remote-debugging consent prompt. Cua Driver willpress only the exact browser-owned semantic allow action for this approveddiff --git a/docs/content/docs/how-to-guides/driver/install.mdx b/docs/content/docs/how-to-guides/driver/install.mdxindex 7968981ce6..84e605288a 100644--- a/docs/content/docs/how-to-guides/driver/install.mdx+++ b/docs/content/docs/how-to-guides/driver/install.mdx@@ -107,8 +107,8 @@ Cua Driver authorizes every agent action inside the native runtime, and the mode```bashcua-driver serve \--permission-mode bounded \- --session-policy ~/cua-session.yaml \- --approve-session-policy+ --capability-manifest ~/cua-session.yaml \+ --approve-capability-manifest```For `unrestricted`, pass the dangerous acknowledgement. `--permission-mode unrestricted` on its own fails closed:@@ -122,11 +122,11 @@ On macOS, put those flags after `serve` in the app-bundle launch so TCC attribut```bashopen -n -g -a CuaDriver --args serve \--permission-mode bounded \- --session-policy ~/cua-session.yaml \- --approve-session-policy+ --capability-manifest ~/cua-session.yaml \+ --approve-capability-manifest```-See [Permission modes](/reference/cua-driver/permission-modes) for exactly what each mode allows, and [Write a bounded manifest](/how-to-guides/driver/write-a-bounded-manifest) for a tested manifest. To keep a non-default mode across reboots, its flags belong in the autostart entry — see [Pin a permission mode](/how-to-guides/driver/keep-running#pin-a-permission-mode).+See [Permission modes](/reference/cua-driver/permission-modes) for exactly what each profile allows, and [Write a capability manifest](/how-to-guides/driver/write-a-bounded-manifest) for a tested manifest. To keep a non-default profile across reboots, its flags belong in the autostart entry — see [Pin a permission mode](/how-to-guides/driver/keep-running#pin-a-permission-mode).## Grant TCC permissions (macOS only)diff --git a/docs/content/docs/how-to-guides/driver/keep-running.mdx b/docs/content/docs/how-to-guides/driver/keep-running.mdxindex 614e4341df..cd02903dd2 100644--- a/docs/content/docs/how-to-guides/driver/keep-running.mdx+++ b/docs/content/docs/how-to-guides/driver/keep-running.mdx@@ -150,7 +150,7 @@ A headless box has no `graphical-session.target`, so on those machines also chan## Pin a permission mode-`--permission-mode`, `--session-policy`, `--approve-session-policy`, and+`--permission-mode`, `--capability-manifest`, `--approve-capability-manifest`, and`--dangerously-bypass-approvals` are read once, when the daemon starts. Put themin the autostart entry so an unattended restart comes back in the same modeinstead of falling back to `standard`.@@ -167,9 +167,9 @@ Add each flag as its own `<string>` inside `ProgramArguments`, after `serve`:<string>serve</string><string>--permission-mode</string><string>bounded</string>- <string>--session-policy</string>+ <string>--capability-manifest</string><string>/Users/you/cua-session.yaml</string>- <string>--approve-session-policy</string>+ <string>--approve-capability-manifest</string></array>```@@ -190,8 +190,8 @@ Scheduled Task inherits them at logon:```powershellsetx CUA_DRIVER_PERMISSION_MODE bounded-setx CUA_DRIVER_SESSION_POLICY_FILE "$env:USERPROFILE\cua-session.yaml"-setx CUA_DRIVER_SESSION_POLICY_APPROVED 1+setx CUA_DRIVER_CAPABILITY_MANIFEST_FILE "$env:USERPROFILE\cua-capabilities.yaml"+setx CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED 1````setx` affects new processes only, so restart the daemon for the change to take@@ -208,7 +208,7 @@ cua-driver autostart kickExtend `ExecStart` in `~/.config/systemd/user/cua-driver.service`:```ini-ExecStart=%h/.local/bin/cua-driver serve --permission-mode bounded --session-policy %h/cua-session.yaml --approve-session-policy+ExecStart=%h/.local/bin/cua-driver serve --permission-mode bounded --capability-manifest %h/cua-session.yaml --approve-capability-manifest```Then reload and restart the unit:diff --git a/docs/content/docs/how-to-guides/driver/update.mdx b/docs/content/docs/how-to-guides/driver/update.mdxindex 77269e0028..c3201a6ee2 100644--- a/docs/content/docs/how-to-guides/driver/update.mdx+++ b/docs/content/docs/how-to-guides/driver/update.mdx@@ -16,7 +16,7 @@ attention:1. `standard` is the promptless practical default for normal observation,input, file, browser, and configuration tools. Attaching to an existinglogged-in Chromium profile remains an explicit boundary. Start CLI or MCP- with `--grant existing-profile`, use a matching bounded manifest, or supply+ with `--grant existing-profile`, use a matching capability manifest, or supplyan authorization host from an embedding application.2. The old cursor-style fields and `set_agent_cursor_style` operation areremoved. Sessions use the built-in animated `cua.default` theme and displaydiff --git a/docs/content/docs/how-to-guides/driver/write-a-bounded-manifest.mdx b/docs/content/docs/how-to-guides/driver/write-a-bounded-manifest.mdxindex e4c3f266af..6924121f9b 100644--- a/docs/content/docs/how-to-guides/driver/write-a-bounded-manifest.mdx+++ b/docs/content/docs/how-to-guides/driver/write-a-bounded-manifest.mdx@@ -1,18 +1,18 @@----title: Write a bounded manifest-description: Run Cua Driver unattended with an explicit tool and resource boundary.+title: Write a capability manifest+description: Narrow any Cua Driver permission profile to explicit tools and resources.----Use `bounded` mode when an agent should work without runtime prompts but must-stay inside a reviewed set of applications, browser origins, files, and tools.+Use a capability manifest when a Cua Driver runtime should stay inside a+reviewed set of applications, browser origins, files, and tools. The manifest+is optional in `standard` and `unrestricted` and required in `bounded`.## 1. Create the manifest-Save this as `cua-session.yaml` and replace the example paths:+Save this as `cua-capabilities.yaml` and replace the example paths:```yaml-version: 2-mode: bounded+version: 3expires_after: 8hidle_timeout: 30m@@ -65,7 +65,7 @@ path.## 2. Select browser access-A bounded manifest that drives a browser is a separate, typed-browser-only+A capability manifest that drives a browser is a separate, typed-browser-onlymanifest. It cannot also allow generic input or window observation.Every navigation is checked against `resources.browser.origins`, so a browser@@ -78,7 +78,7 @@ tools that could reach a page without crossing the typed browser adapter:refused when the runtime starts:```text-authorization startup error: origin-scoped bounded manifests cannot allow+authorization startup error: origin-scoped capability manifests cannot allow'click' because it bypasses the typed browser origin adapter```@@ -89,8 +89,7 @@ application scope contains no browser. Use `list_windows` rather thanFor a driver-owned browser profile:```yaml-version: 2-mode: bounded+version: 3expires_after: 8hidle_timeout: 30m@@ -130,9 +129,10 @@ resources:- https://app.example.com```-An existing-profile entry authorizes attachment under bounded mode without a-Cua modal or host callback. The typed browser tools still validate the live-top-level origin before input.+An existing-profile entry supplies resource scope. In `bounded`, the in-scope+attachment is unattended. In `standard`, the normal launch grant or trusted+host decision is still required. The typed browser tools validate the live+top-level origin before input in every profile.An agent that needs both a browser and generic desktop input needs tworuntimes: this manifest for the browser, and a separate application-scoped@@ -140,7 +140,7 @@ manifest for the desktop work.Scope that second runtime so it cannot reach a browser window. A runtime thatcan click the browser makes the first runtime's origin list decorative, because-nothing checks an origin on the generic input path. Give it a bounded manifest+nothing checks an origin on the generic input path. Give it a capability manifestnaming only the non-browser applications it needs, and keep`desktop.display: false`. A standard-mode runtime is not a substitute: standardallows input against any application, including the browser.@@ -176,7 +176,7 @@ resources:````recursive: false` allows direct children only. Existing version 1 manifests-may still list exact path strings, but version 2 directory roots are more+may still list exact path strings, but version 2 and 3 directory roots are morepractical for unattended output.## 5. Start Cua Driver@@ -184,13 +184,20 @@ practical for unattended output.```bashcua-driver serve \--permission-mode bounded \- --session-policy ./cua-session.yaml \- --approve-session-policy+ --capability-manifest ./cua-capabilities.yaml \+ --approve-capability-manifest```The approval flag confirms that the trusted launcher reviewed this exact file.It is not accepted from a tool call.+To narrow `standard`, use the same flags with `--permission-mode standard`.+Routine standard behavior remains promptless, while residual boundaries such+as existing-profile attachment still require their normal grant. To narrow+`unrestricted`, add the manifest flags alongside+`--dangerously-bypass-approvals`; the approval bypass then applies only inside+the manifest.+For MCP, point the client at the running daemon:```json@@ -224,14 +231,15 @@ cua-driver revoke --all````revoke --all` suspends the complete runtime generation. Restart the daemon-before starting a new bounded run.+before starting a new run.## Know what the manifest is worthA manifest bounds one runtime's tool surface. It is not a sandbox around yourmachine, your browser, or your logged-in accounts. Another Cua Driver runtime,-or any other process running as the same user, is unaffected by it — including-a standard-mode runtime, which allows input against every application.+or any other process running as the same user, is unaffected by it. A+standard-mode runtime without its own capability manifest allows input against+every application.Read [Permission modes](/reference/cua-driver/permission-modes#origin-scope-excludes-generic-input)before relying on a manifest as a security boundary rather than as a reviewed@@ -246,8 +254,7 @@ statement of what one agent run may do.- Declaring browser origins excludes generic input and window observation fromthe same manifest.- `terminate: driver_launched` requires a fresh process fingerprint match.-- `ask.tools` is denied in unattended use because an agent cannot approve its- own request.+- Version 3 has no `ask.tools`; legacy version 1/2 `ask.tools` entries are deny.- Keep expiry and idle timeouts as short as the task permits.See [Permission modes](/reference/cua-driver/permission-modes) for the completediff --git a/docs/content/docs/reference/cua-driver/cli-reference.mdx b/docs/content/docs/reference/cua-driver/cli-reference.mdxindex fbccf88245..a996530424 100644--- a/docs/content/docs/reference/cua-driver/cli-reference.mdx+++ b/docs/content/docs/reference/cua-driver/cli-reference.mdx@@ -98,7 +98,8 @@ The daemon owns per-process state such as element-index caches, recording state,| `--pid-file` | String | — | Override the pid-file path on Unix targets. || `--permission-mode` | String | standard | Immutable agent authorization mode: standard, bounded, or unrestricted. || `--grant` | String | — | Pre-authorize a residual standard-mode boundary. Repeatable; supported value: existing-profile. |-| `--session-policy` | String | — | Immutable tool manifest required in bounded mode. |+| `--capability-manifest` | String | — | Optional narrow-only tool/resource ceiling; required in bounded mode. |+| `--session-policy` | String | — | Deprecated alias for capability-manifest. || `--host-bundle-id` | String | — | Advisory host bundle id label echoed in check_permissions output (embedded mode). |**Flags:**@@ -107,7 +108,8 @@ The daemon owns per-process state such as element-index caches, recording state,| ---- | ----------- || `--dangerously-bypass-approvals` | Select unrestricted mode and acknowledge its risk. || `--allow-legacy-existing-profile-approval` | Temporary migration flag for the unprotected file-backed existing-profile artifact. |-| `--approve-session-policy` | Trusted-launcher confirmation that the exact bounded manifest was reviewed. |+| `--approve-capability-manifest` | Trusted-launcher confirmation that the exact capability manifest was reviewed. |+| `--approve-session-policy` | Deprecated alias for approve-capability-manifest. || `--no-permissions-gate` | Skip the macOS first-launch permissions gate. || `--embedded` | Run embedded inside a host app: inherit the host's TCC grants, never prompt or relaunch. Also CUA_DRIVER_EMBEDDED=1. || `--no-overlay` | Disable the agent cursor overlay for this daemon. |diff --git a/docs/content/docs/reference/cua-driver/permission-modes.mdx b/docs/content/docs/reference/cua-driver/permission-modes.mdxindex 9f2c3aff5d..79ad43b9a2 100644--- a/docs/content/docs/reference/cua-driver/permission-modes.mdx+++ b/docs/content/docs/reference/cua-driver/permission-modes.mdx@@ -10,13 +10,23 @@ arguments are sanitized and before a platform action runs. CLI, MCP, directSDK, private-worker, and service-backed calls all reach the same enforcementboundary.+The three public names are authorization profiles over that shared engine.+They select built-in capability and approval behavior; a capability manifest+is a separate narrow-only ceiling.+## Choose a mode| Mode | Best for | Runtime behavior || --- | --- | --- |-| `standard` | Normal local CLI and MCP use | Routine observation, input, file transfer, isolated browser use, recording, and agent-adjustable settings run without Cua prompts. Residual boundaries return a structured refusal unless they have an explicit grant or trusted host callback. |-| `bounded` | Unattended agents, gateways, and embedded applications | Only tools and resources in a launch-approved manifest may run. In-scope work is silent. Out-of-scope work is denied. |-| `unrestricted` | Disposable or fully trusted environments | Cua approval checks are bypassed after an explicit dangerous acknowledgement. Hard invariants and configured policy ceilings still apply. |+| `standard` | Normal local CLI and MCP use | Routine operations follow the built-in profile. Residual boundaries still require a launch grant or trusted host decision. An optional capability manifest can narrow tools and resources. |+| `bounded` | Unattended agents, gateways, and embedded applications | A capability manifest is required. In-scope work is silent and undeclared scope is denied. |+| `unrestricted` | Disposable or fully trusted environments | Cua approval checks are bypassed after an explicit dangerous acknowledgement. An optional capability manifest limits that bypass to declared scope. |++| Profile | Manifest absent | Manifest present |+| --- | --- | --- |+| `standard` | Preserve standard behavior | Standard behavior intersected with manifest scope; residual grants remain required |+| `bounded` | Startup fails | Unattended, deny-by-default bounded behavior with required lifetimes |+| `unrestricted` | Preserve the acknowledged approval bypass within existing ceilings | Bypass approval only inside manifest scope |`standard` is the default:@@ -29,8 +39,8 @@ Use `bounded` with a reviewed manifest:```bashcua-driver serve \--permission-mode bounded \- --session-policy ./cua-session.yaml \- --approve-session-policy+ --capability-manifest ./cua-capabilities.yaml \+ --approve-capability-manifest```Use `unrestricted` only when full autonomous access is intentional:@@ -39,6 +49,10 @@ Use `unrestricted` only when full autonomous access is intentional:cua-driver serve --dangerously-bypass-approvals```+Add the same two capability-manifest flags to `standard` or `unrestricted`+when that runtime should have a smaller tool and resource surface. A manifest+can narrow a profile but never widen it.+Passing `--permission-mode unrestricted` without`--dangerously-bypass-approvals` fails closed.@@ -63,20 +77,21 @@ host — uses the equivalent environment variables:| Flag | Environment variable || --- | --- || `--permission-mode <mode>` | `CUA_DRIVER_PERMISSION_MODE=<mode>` |-| `--session-policy <path>` | `CUA_DRIVER_SESSION_POLICY_FILE=<path>` |-| `--approve-session-policy` | `CUA_DRIVER_SESSION_POLICY_APPROVED=1` |+| `--capability-manifest <path>` | `CUA_DRIVER_CAPABILITY_MANIFEST_FILE=<path>` |+| `--approve-capability-manifest` | `CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED=1` || `--dangerously-bypass-approvals` | `CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS=1` |The variables accept `1`, `true`, `yes`, or `on` for their boolean form. The CLIflag normalizes mode plus acknowledgement in one step; the environment form doesnot, so `unrestricted` requires `CUA_DRIVER_PERMISSION_MODE=unrestricted` **and**`CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS=1`, and `bounded` requires both the-policy file and its approval. Missing halves fail startup instead of downgrading+capability manifest and its approval. Missing halves fail startup instead of downgradingto `standard`.-`CUA_DRIVER_SESSION_POLICY_FILE` and `CUA_DRIVER_SESSION_POLICY_APPROVED` are-rejected in `standard` and `unrestricted` mode, so a stale exported variable-prevents startup rather than applying silently.+`CUA_DRIVER_SESSION_POLICY_FILE`, `CUA_DRIVER_SESSION_POLICY_APPROVED`,+`--session-policy`, and `--approve-session-policy` remain deprecated aliases+for one compatibility window. New integrations should use the capability+manifest names. Conflicting old and new paths fail closed.These variables are trusted launch configuration on the same footing as theflags. Whoever can write them for the daemon's environment sets its mode, so@@ -132,7 +147,9 @@ needed.Other valid authorization paths are:-- A `bounded` manifest that allows `kind: existing_profile`.+- A capability manifest containing the exact profile scope, combined with the+ profile's normal approval behavior. In `bounded` it is unattended; in+ `standard` a launch grant or trusted host decision is still required.- A `DriverAuthorizationHost` callback installed by an embedding application.- `unrestricted` mode with its dangerous acknowledgement.- The temporary `browser-approve` compatibility artifact when the trusted@@ -148,17 +165,18 @@ origin scope still applies to live navigation and input.See [Browser Profile Attachment](/reference/cua-driver/browser-profile-attachment)for the platform and CDP boundary.-## Bounded manifests+## Capability manifests-Bounded mode is deny by default. A tool must appear in `allow.tools`, and every-resource crossed by that call must match the manifest.+A configured capability manifest is deny by default in every profile. A tool+must appear in `allow.tools`, and every resource crossed by that call must+match the manifest. Approval is considered only after those checks pass.-Manifest version 2 supports application identities, browser profile kinds, and-directory roots:+Manifest version 3 removes profile behavior from the file. It supports the+same application identities, browser profile kinds, and directory roots as+version 2:```yaml-version: 2-mode: bounded+version: 3expires_after: 8hidle_timeout: 30m@@ -219,7 +237,7 @@ that declares origins therefore cannot also allow a tool that reaches a pagearound that adapter, and the runtime refuses to start if it does:```text-authorization startup error: origin-scoped bounded manifests cannot allow+authorization startup error: origin-scoped capability manifests cannot allow'click' because it bypasses the typed browser origin adapter```@@ -248,17 +266,20 @@ runtimes. Use `list_windows` for the `window_id` a browser call needs.An origin scope binds one runtime's tool surface. It is not a property of thebrowser, the profile, or the machine. A second runtime that can deliver generic-input to a browser window — including any standard-mode runtime, which allows-input against every application — voids the first runtime's origin scope+input to a browser window — including a standard-mode runtime without a+capability manifest, which allows input against every application — voids the first runtime's origin scopewithout violating it. Scope a companion runtime to non-browser applicationswith `desktop.display: false`, and treat same-user processes outside Cua Driveras outside the boundary entirely.-Version 1 manifests remain loadable. They may name exact PIDs, windows, and-paths, but version 2 is preferred for pre-launch and unattended workflows.+Version 1 and 2 manifests remain loadable. Their `mode` field is retained for+compatibility, and legacy `ask.tools` entries are treated as deny. Version 3+removes `mode` and `ask.tools`. `expires_after` and `idle_timeout` are optional+in version 3, but any declared lifetime is enforced in every profile. Bounded+mode requires both fields.For a complete tested example, see-[Write a bounded manifest](/how-to-guides/driver/write-a-bounded-manifest).+[Write a capability manifest](/how-to-guides/driver/write-a-bounded-manifest).## Authorization stack@@ -268,12 +289,13 @@ Every call must pass all applicable layers:2. The reviewed built-in tool and risk map.3. Administrator policy from `CUA_DRIVER_MANAGED_POLICY_FILE`, when set.4. User policy from `CUA_DRIVER_POLICY_FILE`, when set.-5. The bounded manifest, when the active mode is `bounded`.-6. A launch grant or trusted host authorization for a residual standard-mode+5. The selected profile's capability and approval behavior.+6. The capability manifest, when configured.+7. A launch grant or trusted host authorization for a residual standard-modeboundary.-Each layer can narrow access. No grant or permission mode can widen a managed-or user policy.+Each layer can narrow access. No manifest, grant, approval bypass, or permission+profile can widen a hard invariant or managed/user policy.The `tools/list`, `manifest`, and status surfaces expose content-freeenforcement descriptors. Each descriptor states its adapter ID, risk class,@@ -335,7 +357,7 @@ hides the badge. Headless sessions do not require either.## Security boundary-The host owns the permission mode, manifest, launch grants, and any human+The host owns the permission profile, capability manifest, launch grants, and any humanconsent UX. Agent tools cannot change them.Same-user native code, malware, and automation with control of the same@@ -347,5 +369,5 @@ window into a secure desktop.- [Permission policies](/reference/cua-driver/permission-policies)- [Browser Profile Attachment](/reference/cua-driver/browser-profile-attachment)-- [Write a bounded manifest](/how-to-guides/driver/write-a-bounded-manifest)+- [Write a capability manifest](/how-to-guides/driver/write-a-bounded-manifest)- [Restrict tool access](/how-to-guides/driver/restrict-tool-access)diff --git a/docs/content/docs/reference/cua-driver/permission-policies.mdx b/docs/content/docs/reference/cua-driver/permission-policies.mdxindex c9abb57a5c..e66dd22744 100644--- a/docs/content/docs/reference/cua-driver/permission-policies.mdx+++ b/docs/content/docs/reference/cua-driver/permission-policies.mdx@@ -279,5 +279,5 @@ Permission denied: tool 'launch_app' is not allowed by the Rego policy- [Restrict tool access with permission policies](/how-to-guides/driver/restrict-tool-access): step-by-step setup guide- [How permission policies work](/concepts/how-permission-policies-work): evaluation engine internals and trust model-- [Permission modes and bounded autonomy](/reference/cua-driver/permission-modes): startup modes, session manifests, launch grants, host callbacks, and revocation+- [Permission profiles and capability manifests](/reference/cua-driver/permission-modes): startup profiles, narrow-only manifests, launch grants, host callbacks, and revocation- [MCP tools](/reference/cua-driver/mcp-tools): tool names and argument schemasdiff --git a/libs/cua-driver/README.md b/libs/cua-driver/README.mdindex 7860ff867d..00bda12925 100644--- a/libs/cua-driver/README.md+++ b/libs/cua-driver/README.md@@ -27,10 +27,11 @@ only the tools and resources in a reviewed manifest. `unrestricted` requires`--dangerously-bypass-approvals`.The mode belongs to the process that owns the runtime and is fixed at launch:-`cua-driver serve` takes the flags, `cua-driver mcp` and embedding hosts use the-matching `CUA_DRIVER_PERMISSION_MODE`, `CUA_DRIVER_SESSION_POLICY_FILE`, and-`CUA_DRIVER_SESSION_POLICY_APPROVED` variables. Choose it before starting the-daemon; a running daemon must be restarted to change it.+`cua-driver serve` takes the flags, while `cua-driver mcp` and embedding hosts+use the matching `CUA_DRIVER_PERMISSION_MODE`,+`CUA_DRIVER_CAPABILITY_MANIFEST_FILE`, and+`CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED` variables. Choose it before starting+the daemon; a running daemon must be restarted to change it.Attaching to an existing logged-in Chromium profile remains explicit:diff --git a/libs/cua-driver/compat-fixtures/cli.json b/libs/cua-driver/compat-fixtures/cli.jsonindex 0529e28a03..f496c32f5a 100644--- a/libs/cua-driver/compat-fixtures/cli.json+++ b/libs/cua-driver/compat-fixtures/cli.json@@ -7,9 +7,7 @@"manifest": {"schema_version": "1","binary_version_format": "semver",- "mcp_args": [- "mcp"- ],+ "mcp_args": ["mcp"],"subcommands": {"mcp": [["--socket", "string"],@@ -23,6 +21,8 @@["--permission-mode", "string"],["--grant", "repeatable-string"],["--dangerously-bypass-approvals", "flag"],+ ["--capability-manifest", "string"],+ ["--approve-capability-manifest", "flag"],["--session-policy", "string"],["--approve-session-policy", "flag"],["--no-permissions-gate", "flag"],@@ -35,9 +35,7 @@["--screenshot-out-file", "string"],["--socket", "string"]],- "manifest": [- ["--pretty", "flag"]- ]+ "manifest": [["--pretty", "flag"]]}}}diff --git a/libs/cua-driver/python/src/cua_driver/_native.py b/libs/cua-driver/python/src/cua_driver/_native.pyindex 84027c7c99..ee00789bdc 100644--- a/libs/cua-driver/python/src/cua_driver/_native.py+++ b/libs/cua-driver/python/src/cua_driver/_native.py@@ -2039,9 +2039,13 @@ class RuntimeAuthorizationOptions:"""Immutable authorization ceiling supplied before a runtime accepts actions."""- def __init__(self, *, allowed_modes:typing.List[SessionPermissionMode], compatibility_mode:SessionPermissionMode, compatibility_bounded_manifest_path:typing.Optional[str], unrestricted_acknowledged:bool, max_session_ttl_seconds:int, max_idle_ttl_seconds:int):+ def __init__(self, *, allowed_modes:typing.List[SessionPermissionMode], compatibility_mode:SessionPermissionMode, compatibility_capability_manifest_path:typing.Optional[str] = _DEFAULT, compatibility_bounded_manifest_path:typing.Optional[str], unrestricted_acknowledged:bool, max_session_ttl_seconds:int, max_idle_ttl_seconds:int):self.allowed_modes = allowed_modesself.compatibility_mode = compatibility_mode+ if compatibility_capability_manifest_path is _DEFAULT:+ self.compatibility_capability_manifest_path = None+ else:+ self.compatibility_capability_manifest_path = compatibility_capability_manifest_pathself.compatibility_bounded_manifest_path = compatibility_bounded_manifest_pathself.unrestricted_acknowledged = unrestricted_acknowledgedself.max_session_ttl_seconds = max_session_ttl_seconds@@ -2051,12 +2055,14 @@ class RuntimeAuthorizationOptions:def __str__(self):- return "RuntimeAuthorizationOptions(allowed_modes={}, compatibility_mode={}, compatibility_bounded_manifest_path={}, unrestricted_acknowledged={}, max_session_ttl_seconds={}, max_idle_ttl_seconds={})".format(self.allowed_modes, self.compatibility_mode, self.compatibility_bounded_manifest_path, self.unrestricted_acknowledged, self.max_session_ttl_seconds, self.max_idle_ttl_seconds)+ return "RuntimeAuthorizationOptions(allowed_modes={}, compatibility_mode={}, compatibility_capability_manifest_path={}, compatibility_bounded_manifest_path={}, unrestricted_acknowledged={}, max_session_ttl_seconds={}, max_idle_ttl_seconds={})".format(self.allowed_modes, self.compatibility_mode, self.compatibility_capability_manifest_path, self.compatibility_bounded_manifest_path, self.unrestricted_acknowledged, self.max_session_ttl_seconds, self.max_idle_ttl_seconds)def __eq__(self, other):if self.allowed_modes != other.allowed_modes:return Falseif self.compatibility_mode != other.compatibility_mode:return False+ if self.compatibility_capability_manifest_path != other.compatibility_capability_manifest_path:+ return Falseif self.compatibility_bounded_manifest_path != other.compatibility_bounded_manifest_path:return Falseif self.unrestricted_acknowledged != other.unrestricted_acknowledged:@@ -2073,6 +2079,7 @@ class _UniffiFfiConverterTypeRuntimeAuthorizationOptions(_UniffiConverterRustBufreturn RuntimeAuthorizationOptions(allowed_modes=_UniffiFfiConverterSequenceTypeSessionPermissionMode.read(buf),compatibility_mode=_UniffiFfiConverterTypeSessionPermissionMode.read(buf),+ compatibility_capability_manifest_path=_UniffiFfiConverterOptionalString.read(buf),compatibility_bounded_manifest_path=_UniffiFfiConverterOptionalString.read(buf),unrestricted_acknowledged=_UniffiFfiConverterBoolean.read(buf),max_session_ttl_seconds=_UniffiFfiConverterUInt64.read(buf),@@ -2083,6 +2090,7 @@ class _UniffiFfiConverterTypeRuntimeAuthorizationOptions(_UniffiConverterRustBufdef check_lower(value):_UniffiFfiConverterSequenceTypeSessionPermissionMode.check_lower(value.allowed_modes)_UniffiFfiConverterTypeSessionPermissionMode.check_lower(value.compatibility_mode)+ _UniffiFfiConverterOptionalString.check_lower(value.compatibility_capability_manifest_path)_UniffiFfiConverterOptionalString.check_lower(value.compatibility_bounded_manifest_path)_UniffiFfiConverterBoolean.check_lower(value.unrestricted_acknowledged)_UniffiFfiConverterUInt64.check_lower(value.max_session_ttl_seconds)@@ -2092,6 +2100,7 @@ class _UniffiFfiConverterTypeRuntimeAuthorizationOptions(_UniffiConverterRustBufdef write(value, buf):_UniffiFfiConverterSequenceTypeSessionPermissionMode.write(value.allowed_modes, buf)_UniffiFfiConverterTypeSessionPermissionMode.write(value.compatibility_mode, buf)+ _UniffiFfiConverterOptionalString.write(value.compatibility_capability_manifest_path, buf)_UniffiFfiConverterOptionalString.write(value.compatibility_bounded_manifest_path, buf)_UniffiFfiConverterBoolean.write(value.unrestricted_acknowledged, buf)_UniffiFfiConverterUInt64.write(value.max_session_ttl_seconds, buf)@@ -2984,13 +2993,18 @@ class _UniffiFfiConverterOptionalTypeEmbeddedPermissionMode(_UniffiConverterRust@dataclassclass EmbeddedDriverHostOptions:- def __init__(self, *, binary_path:str, host_bundle_id:str, socket_path:typing.Optional[str], startup_timeout_ms:typing.Optional[int], shutdown_timeout_ms:typing.Optional[int], permission_mode:typing.Optional[EmbeddedPermissionMode], session_policy_path:typing.Optional[str], approve_session_policy:bool, dangerously_bypass_approvals:bool, environment:typing.List[EmbeddedEnvironmentVariable], inherit_stderr:bool):+ def __init__(self, *, binary_path:str, host_bundle_id:str, socket_path:typing.Optional[str], startup_timeout_ms:typing.Optional[int], shutdown_timeout_ms:typing.Optional[int], permission_mode:typing.Optional[EmbeddedPermissionMode], capability_manifest_path:typing.Optional[str] = _DEFAULT, approve_capability_manifest:bool = False, session_policy_path:typing.Optional[str], approve_session_policy:bool, dangerously_bypass_approvals:bool, environment:typing.List[EmbeddedEnvironmentVariable], inherit_stderr:bool):self.binary_path = binary_pathself.host_bundle_id = host_bundle_idself.socket_path = socket_pathself.startup_timeout_ms = startup_timeout_msself.shutdown_timeout_ms = shutdown_timeout_msself.permission_mode = permission_mode+ if capability_manifest_path is _DEFAULT:+ self.capability_manifest_path = None+ else:+ self.capability_manifest_path = capability_manifest_path+ self.approve_capability_manifest = approve_capability_manifestself.session_policy_path = session_policy_pathself.approve_session_policy = approve_session_policyself.dangerously_bypass_approvals = dangerously_bypass_approvals@@ -3001,7 +3015,7 @@ class EmbeddedDriverHostOptions:def __str__(self):- return "EmbeddedDriverHostOptions(binary_path={}, host_bundle_id={}, socket_path={}, startup_timeout_ms={}, shutdown_timeout_ms={}, permission_mode={}, session_policy_path={}, approve_session_policy={}, dangerously_bypass_approvals={}, environment={}, inherit_stderr={})".format(self.binary_path, self.host_bundle_id, self.socket_path, self.startup_timeout_ms, self.shutdown_timeout_ms, self.permission_mode, self.session_policy_path, self.approve_session_policy, self.dangerously_bypass_approvals, self.environment, self.inherit_stderr)+ return "EmbeddedDriverHostOptions(binary_path={}, host_bundle_id={}, socket_path={}, startup_timeout_ms={}, shutdown_timeout_ms={}, permission_mode={}, capability_manifest_path={}, approve_capability_manifest={}, session_policy_path={}, approve_session_policy={}, dangerously_bypass_approvals={}, environment={}, inherit_stderr={})".format(self.binary_path, self.host_bundle_id, self.socket_path, self.startup_timeout_ms, self.shutdown_timeout_ms, self.permission_mode, self.capability_manifest_path, self.approve_capability_manifest, self.session_policy_path, self.approve_session_policy, self.dangerously_bypass_approvals, self.environment, self.inherit_stderr)def __eq__(self, other):if self.binary_path != other.binary_path:return False@@ -3015,6 +3029,10 @@ class EmbeddedDriverHostOptions:return Falseif self.permission_mode != other.permission_mode:return False+ if self.capability_manifest_path != other.capability_manifest_path:+ return False+ if self.approve_capability_manifest != other.approve_capability_manifest:+ return Falseif self.session_policy_path != other.session_policy_path:return Falseif self.approve_session_policy != other.approve_session_policy:@@ -3037,6 +3055,8 @@ class _UniffiFfiConverterTypeEmbeddedDriverHostOptions(_UniffiConverterRustBuffestartup_timeout_ms=_UniffiFfiConverterOptionalUInt64.read(buf),shutdown_timeout_ms=_UniffiFfiConverterOptionalUInt64.read(buf),permission_mode=_UniffiFfiConverterOptionalTypeEmbeddedPermissionMode.read(buf),+ capability_manifest_path=_UniffiFfiConverterOptionalString.read(buf),+ approve_capability_manifest=_UniffiFfiConverterBoolean.read(buf),session_policy_path=_UniffiFfiConverterOptionalString.read(buf),approve_session_policy=_UniffiFfiConverterBoolean.read(buf),dangerously_bypass_approvals=_UniffiFfiConverterBoolean.read(buf),@@ -3052,6 +3072,8 @@ class _UniffiFfiConverterTypeEmbeddedDriverHostOptions(_UniffiConverterRustBuffe_UniffiFfiConverterOptionalUInt64.check_lower(value.startup_timeout_ms)_UniffiFfiConverterOptionalUInt64.check_lower(value.shutdown_timeout_ms)_UniffiFfiConverterOptionalTypeEmbeddedPermissionMode.check_lower(value.permission_mode)+ _UniffiFfiConverterOptionalString.check_lower(value.capability_manifest_path)+ _UniffiFfiConverterBoolean.check_lower(value.approve_capability_manifest)_UniffiFfiConverterOptionalString.check_lower(value.session_policy_path)_UniffiFfiConverterBoolean.check_lower(value.approve_session_policy)_UniffiFfiConverterBoolean.check_lower(value.dangerously_bypass_approvals)@@ -3066,6 +3088,8 @@ class _UniffiFfiConverterTypeEmbeddedDriverHostOptions(_UniffiConverterRustBuffe_UniffiFfiConverterOptionalUInt64.write(value.startup_timeout_ms, buf)_UniffiFfiConverterOptionalUInt64.write(value.shutdown_timeout_ms, buf)_UniffiFfiConverterOptionalTypeEmbeddedPermissionMode.write(value.permission_mode, buf)+ _UniffiFfiConverterOptionalString.write(value.capability_manifest_path, buf)+ _UniffiFfiConverterBoolean.write(value.approve_capability_manifest, buf)_UniffiFfiConverterOptionalString.write(value.session_policy_path, buf)_UniffiFfiConverterBoolean.write(value.approve_session_policy, buf)_UniffiFfiConverterBoolean.write(value.dangerously_bypass_approvals, buf)@@ -3385,18 +3409,22 @@ class TrustedSessionOptions:"""Trusted host request for one immutable, connection-bound action surface."""- def __init__(self, *, public_session:str, mode:SessionPermissionMode, ttl_seconds:int, idle_ttl_seconds:int, bounded_manifest_path:typing.Optional[str]):+ def __init__(self, *, public_session:str, mode:SessionPermissionMode, ttl_seconds:int, idle_ttl_seconds:int, capability_manifest_path:typing.Optional[str] = _DEFAULT, bounded_manifest_path:typing.Optional[str]):self.public_session = public_sessionself.mode = modeself.ttl_seconds = ttl_secondsself.idle_ttl_seconds = idle_ttl_seconds+ if capability_manifest_path is _DEFAULT:+ self.capability_manifest_path = None+ else:+ self.capability_manifest_path = capability_manifest_pathself.bounded_manifest_path = bounded_manifest_pathdef __str__(self):- return "TrustedSessionOptions(public_session={}, mode={}, ttl_seconds={}, idle_ttl_seconds={}, bounded_manifest_path={})".format(self.public_session, self.mode, self.ttl_seconds, self.idle_ttl_seconds, self.bounded_manifest_path)+ return "TrustedSessionOptions(public_session={}, mode={}, ttl_seconds={}, idle_ttl_seconds={}, capability_manifest_path={}, bounded_manifest_path={})".format(self.public_session, self.mode, self.ttl_seconds, self.idle_ttl_seconds, self.capability_manifest_path, self.bounded_manifest_path)def __eq__(self, other):if self.public_session != other.public_session:return False@@ -3406,6 +3434,8 @@ class TrustedSessionOptions:return Falseif self.idle_ttl_seconds != other.idle_ttl_seconds:return False+ if self.capability_manifest_path != other.capability_manifest_path:+ return Falseif self.bounded_manifest_path != other.bounded_manifest_path:return Falsereturn True@@ -3418,6 +3448,7 @@ class _UniffiFfiConverterTypeTrustedSessionOptions(_UniffiConverterRustBuffer):mode=_UniffiFfiConverterTypeSessionPermissionMode.read(buf),ttl_seconds=_UniffiFfiConverterUInt64.read(buf),idle_ttl_seconds=_UniffiFfiConverterUInt64.read(buf),+ capability_manifest_path=_UniffiFfiConverterOptionalString.read(buf),bounded_manifest_path=_UniffiFfiConverterOptionalString.read(buf),)@@ -3427,6 +3458,7 @@ class _UniffiFfiConverterTypeTrustedSessionOptions(_UniffiConverterRustBuffer):_UniffiFfiConverterTypeSessionPermissionMode.check_lower(value.mode)_UniffiFfiConverterUInt64.check_lower(value.ttl_seconds)_UniffiFfiConverterUInt64.check_lower(value.idle_ttl_seconds)+ _UniffiFfiConverterOptionalString.check_lower(value.capability_manifest_path)_UniffiFfiConverterOptionalString.check_lower(value.bounded_manifest_path)@staticmethod@@ -3435,6 +3467,7 @@ class _UniffiFfiConverterTypeTrustedSessionOptions(_UniffiConverterRustBuffer):_UniffiFfiConverterTypeSessionPermissionMode.write(value.mode, buf)_UniffiFfiConverterUInt64.write(value.ttl_seconds, buf)_UniffiFfiConverterUInt64.write(value.idle_ttl_seconds, buf)+ _UniffiFfiConverterOptionalString.write(value.capability_manifest_path, buf)_UniffiFfiConverterOptionalString.write(value.bounded_manifest_path, buf)diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rsindex 591bd9a516..4112d3edac 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/authorization.rs@@ -116,8 +116,10 @@ pub struct EnforcementAdapterDescriptor {/// Mode-specific truth. `state` remains the standard-mode value for/// backward-compatible inventory consumers.pub enforcement_by_mode: AdapterEnforcement,- /// Runtime behavior selected after hard invariants and policy admission.- pub behavior_by_mode: AdapterModeBehavior,+ /// Factored profile behavior selected after hard invariants, configured+ /// policy, and optional capability-manifest scope admission.+ #[serde(rename = "profile_behavior_class")]+ pub profile_behavior: AdapterProfileBehavior,}#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]@@ -151,34 +153,41 @@ pub enum ModeBehavior {Allow,Deny,RequireGrant,- Manifest,+ /// Bounded-profile compatibility spelling on the public inventory. The+ /// factored profile class explains that the manifest is a separate scope+ /// ceiling rather than the approval behavior itself.+ #[serde(rename = "manifest")]+ AllowWithoutGrant,}#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]-pub struct AdapterModeBehavior {- pub standard: ModeBehavior,- pub bounded: ModeBehavior,- pub unrestricted: ModeBehavior,+#[serde(rename_all = "snake_case")]+pub enum AdapterProfileBehavior {+ Routine,+ GrantInStandard,+ BoundedOrUnrestricted,+ UnrestrictedOnly,+ Denied,}-impl AdapterModeBehavior {- pub const fn new(- standard: ModeBehavior,- bounded: ModeBehavior,- unrestricted: ModeBehavior,- ) -> Self {- Self {- standard,- bounded,- unrestricted,- }- }-+impl AdapterProfileBehavior {pub const fn for_mode(self, mode: PermissionMode) -> ModeBehavior {- match mode {- PermissionMode::Standard => self.standard,- PermissionMode::Bounded => self.bounded,- PermissionMode::Unrestricted => self.unrestricted,+ match (self, mode) {+ (Self::Routine, PermissionMode::Standard | PermissionMode::Unrestricted) => {+ ModeBehavior::Allow+ }+ (Self::Routine, PermissionMode::Bounded) => ModeBehavior::AllowWithoutGrant,+ (Self::GrantInStandard, PermissionMode::Standard) => ModeBehavior::RequireGrant,+ (Self::GrantInStandard, PermissionMode::Bounded) => ModeBehavior::AllowWithoutGrant,+ (Self::GrantInStandard, PermissionMode::Unrestricted) => ModeBehavior::Allow,+ (Self::BoundedOrUnrestricted, PermissionMode::Standard) => ModeBehavior::Deny,+ (Self::BoundedOrUnrestricted, PermissionMode::Bounded) => {+ ModeBehavior::AllowWithoutGrant+ }+ (Self::BoundedOrUnrestricted, PermissionMode::Unrestricted) => ModeBehavior::Allow,+ (Self::UnrestrictedOnly, PermissionMode::Unrestricted) => ModeBehavior::Allow,+ (Self::UnrestrictedOnly, PermissionMode::Standard | PermissionMode::Bounded)+ | (Self::Denied, _) => ModeBehavior::Deny,}}}@@ -367,17 +376,13 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("existing_profile_session_grant"),idle_ttl_seconds: Some(30 * 60),absolute_ttl_seconds: Some(8 * 60 * 60),- authorization_requirement: "launch_grant_or_host_in_standard; manifest_in_bounded",+ authorization_requirement: "profile_approval_behavior_and_optional_capability_manifest",revocation_triggers: EXISTING_PROFILE_REVOCATION,refusal_code: Some("browser_consent_required"),authorization_source:- "launch_grant_or_authorization_host_in_standard; manifest_in_bounded; trusted_launch_acknowledgement_in_unrestricted",+ "launch_grant_or_authorization_host_in_standard; unattended_in_bounded; trusted_launch_acknowledgement_in_unrestricted; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::RequireGrant,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::GrantInStandard,},EnforcementAdapterDescriptor {id: "private_observation",@@ -389,16 +394,12 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(30 * 60),absolute_ttl_seconds: Some(8 * 60 * 60),- authorization_requirement: "manifest_only_in_bounded",+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),- authorization_source: "built_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Allow,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::Routine,},EnforcementAdapterDescriptor {id: "desktop_input",@@ -410,16 +411,12 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(30 * 60),absolute_ttl_seconds: Some(8 * 60 * 60),- authorization_requirement: "manifest_only_in_bounded",+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),- authorization_source: "built_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Allow,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::Routine,},EnforcementAdapterDescriptor {id: "file_transfer_and_output",@@ -431,16 +428,12 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(30 * 60),absolute_ttl_seconds: Some(8 * 60 * 60),- authorization_requirement: "manifest_only_in_bounded",+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),- authorization_source: "built_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Allow,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::Routine,},EnforcementAdapterDescriptor {id: "browser_consequential_action",@@ -452,16 +445,12 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(5 * 60),absolute_ttl_seconds: Some(30 * 60),- authorization_requirement: "manifest_only_in_bounded",+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),- authorization_source: "built_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Allow,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::Routine,},EnforcementAdapterDescriptor {id: "browser_unbounded_script",@@ -478,11 +467,7 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[refusal_code: Some("unbounded_operation_requires_unrestricted"),authorization_source: "unrestricted_mode_with_trusted_launch_time_risk_acknowledgement",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Deny,- ModeBehavior::Deny,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::UnrestrictedOnly,},EnforcementAdapterDescriptor {id: "browser_bound_input",@@ -494,16 +479,12 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(30 * 60),absolute_ttl_seconds: Some(8 * 60 * 60),- authorization_requirement: "manifest_only_in_bounded",+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),- authorization_source: "built_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Allow,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::Routine,},EnforcementAdapterDescriptor {id: "process_control",@@ -515,17 +496,13 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(2 * 60),absolute_ttl_seconds: Some(10 * 60),- authorization_requirement: "driver_ownership_in_standard; manifest_in_bounded",+ authorization_requirement: "driver_ownership_in_standard; unattended_in_bounded; optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),authorization_source:- "driver_ownership_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ "driver_ownership_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Deny,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::BoundedOrUnrestricted,},EnforcementAdapterDescriptor {id: "os_permission_prompt",@@ -542,11 +519,7 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[refusal_code: Some("os_permission_prompt_requires_trusted_host"),authorization_source: "trusted_host_setup_outside_the_agent_tool_path",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Deny,- ModeBehavior::Deny,- ModeBehavior::Deny,- ),+ profile_behavior: AdapterProfileBehavior::Denied,},EnforcementAdapterDescriptor {id: "driver_configuration",@@ -563,16 +536,12 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(5 * 60),absolute_ttl_seconds: Some(30 * 60),- authorization_requirement: "manifest_only_in_bounded",+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),- authorization_source: "built_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Allow,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::Routine,},EnforcementAdapterDescriptor {id: "clipboard",@@ -592,16 +561,12 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[grant_type: Some("protected_resource_grant"),idle_ttl_seconds: Some(30 * 60),absolute_ttl_seconds: Some(8 * 60 * 60),- authorization_requirement: "manifest_only_in_bounded",+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",revocation_triggers: SESSION_REVOCATION,refusal_code: Some("authorization_required"),- authorization_source: "built_in_standard; manifest_in_bounded; trusted_unrestricted_mode",+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Allow,- ModeBehavior::Manifest,- ModeBehavior::Allow,- ),+ profile_behavior: AdapterProfileBehavior::Routine,},EnforcementAdapterDescriptor {id: "devices",@@ -618,11 +583,7 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[refusal_code: None,authorization_source: "capability_not_exposed",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::NotExposed),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Deny,- ModeBehavior::Deny,- ModeBehavior::Deny,- ),+ profile_behavior: AdapterProfileBehavior::Denied,},EnforcementAdapterDescriptor {id: "shell_and_network",@@ -639,16 +600,32 @@ pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[refusal_code: None,authorization_source: "capability_not_exposed",enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::NotExposed),- behavior_by_mode: AdapterModeBehavior::new(- ModeBehavior::Deny,- ModeBehavior::Deny,- ModeBehavior::Deny,- ),+ profile_behavior: AdapterProfileBehavior::Denied,},];pub fn enforcement_adapter_inventory_json() -> Value {- serde_json::to_value(ENFORCEMENT_ADAPTERS).expect("static adapter inventory serializes")+ Value::Array(+ ENFORCEMENT_ADAPTERS+ .iter()+ .map(|adapter| {+ let mut value =+ serde_json::to_value(adapter).expect("static adapter inventory serializes");+ value+ .as_object_mut()+ .expect("adapter descriptor serializes as an object")+ .insert(+ "behavior_by_mode".to_owned(),+ serde_json::json!({+ "standard": adapter.profile_behavior.for_mode(PermissionMode::Standard),+ "bounded": adapter.profile_behavior.for_mode(PermissionMode::Bounded),+ "unrestricted": adapter.profile_behavior.for_mode(PermissionMode::Unrestricted),+ }),+ );+ value+ })+ .collect(),+ )}pub fn adapter_ids_with_state(state: RiskEnforcement) -> Vec<&'static str> {@@ -1088,46 +1065,32 @@ pub fn authorize_tool_call_with_context()));}let mode = context.mode();- if mode == PermissionMode::Bounded {- let manifest = context.bounded_manifest().ok_or_else(|| {- crate::policy::AuthorizationError::Loading(- "bounded session policy is unavailable".to_owned(),- )- })?;- if manifest.is_expired() {- return Err(crate::policy::AuthorizationError::Denied(- "bounded session policy expired".to_owned(),- ));- }+ if mode == PermissionMode::Bounded && context.capability_manifest().is_none() {+ return Err(crate::policy::AuthorizationError::Loading(+ "bounded mode capability manifest is unavailable".to_owned(),+ ));+ }+ if let Some(manifest) = context.capability_manifest() {+ manifest+ .validate_for_mode(mode)+ .map_err(crate::policy::AuthorizationError::Denied)?;match manifest.decision(tool) {- crate::session_manifest::ManifestDecision::Allow => {- manifest- .authorize_call(tool, args)- .map_err(crate::policy::AuthorizationError::Denied)?;- manifest- .authorize_dispatch()- .map_err(crate::policy::AuthorizationError::Denied)?;- }- crate::session_manifest::ManifestDecision::Deny => {+ crate::session_manifest::ManifestDecision::Allow => manifest+ .authorize_call(tool, args)+ .map_err(crate::policy::AuthorizationError::Denied)?,+ crate::session_manifest::ManifestDecision::Deny+ | crate::session_manifest::ManifestDecision::Ask => {return Err(crate::policy::AuthorizationError::Denied(format!(- "bounded session policy denies tool '{tool}'"- )))- }- crate::session_manifest::ManifestDecision::Ask => {- return Err(crate::policy::AuthorizationError::Denied(format!(- "bounded session policy requires protected approval for tool '{tool}'; unattended dispatch cannot auto-accept"+ "capability manifest denies tool '{tool}'")))}crate::session_manifest::ManifestDecision::Undeclared => {return Err(crate::policy::AuthorizationError::Denied(format!(- "tool '{tool}' is outside the bounded session policy"+ "tool '{tool}' is outside the capability manifest")))}}}- context- .authorize_dispatch()- .map_err(crate::policy::AuthorizationError::Denied)?;Ok(risk)}@@ -1199,13 +1162,13 @@ pub enum PermissionModeError {MissingDangerAcknowledgement,#[error("--dangerously-bypass-approvals cannot be combined with a non-unrestricted --permission-mode")]UnexpectedDangerAcknowledgement,- #[error("permission mode bounded requires --session-policy <path> at trusted daemon startup")]- MissingSessionPolicy,- #[error("permission mode bounded requires --approve-session-policy at trusted daemon startup")]- MissingSessionPolicyApproval,#[error(- "--session-policy/--approve-session-policy are valid only with --permission-mode bounded"+ "permission mode bounded requires --capability-manifest <path> at trusted daemon startup")]+ MissingSessionPolicy,+ #[error("a configured capability manifest requires --approve-capability-manifest at trusted daemon startup")]+ MissingSessionPolicyApproval,+ #[error("--approve-capability-manifest requires --capability-manifest <path>")]UnexpectedSessionPolicy,#[error("permission mode unrestricted is disabled by managed startup configuration")]UnrestrictedDisabled,@@ -1285,29 +1248,23 @@ pub fn validate_startup_authorization() -> anyhow::Result<()> {if mode != PermissionMode::Standard && env_flag(LEGACY_EXISTING_PROFILE_APPROVAL_ENV) {return Err(PermissionModeError::UnexpectedLegacyApproval.into());}- let session_policy_configured =- std::env::var_os(crate::session_manifest::SESSION_POLICY_FILE_ENV).is_some();- let session_policy_approved = env_flag(crate::session_manifest::SESSION_POLICY_APPROVED_ENV);- match mode {- PermissionMode::Bounded => {- if !session_policy_configured {- return Err(PermissionModeError::MissingSessionPolicy.into());- }- if !session_policy_approved {- return Err(PermissionModeError::MissingSessionPolicyApproval.into());- }- let manifest = crate::session_manifest::configured_session_manifest()- .map_err(anyhow::Error::msg)?- .ok_or(PermissionModeError::MissingSessionPolicy)?;- if manifest.is_expired() {- anyhow::bail!("bounded session policy is already expired");- }- }- PermissionMode::Standard | PermissionMode::Unrestricted => {- if session_policy_configured || session_policy_approved {- return Err(PermissionModeError::UnexpectedSessionPolicy.into());- }- }+ let manifest_configured = crate::session_manifest::capability_manifest_configured();+ let manifest_approved = crate::session_manifest::capability_manifest_approved();+ if mode == PermissionMode::Bounded && !manifest_configured {+ return Err(PermissionModeError::MissingSessionPolicy.into());+ }+ if manifest_configured && !manifest_approved {+ return Err(PermissionModeError::MissingSessionPolicyApproval.into());+ }+ if manifest_approved && !manifest_configured {+ return Err(PermissionModeError::UnexpectedSessionPolicy.into());+ }+ if let Some(manifest) =+ crate::session_manifest::configured_capability_manifest().map_err(anyhow::Error::msg)?+ {+ manifest+ .validate_for_mode(mode)+ .map_err(anyhow::Error::msg)?;}Ok(())}@@ -1343,8 +1300,8 @@ pub fn status_json_with_provider(authorization_host: Option<&'static str>) -> se.as_ref().map(|mode| adapter_ids_with_state_for_mode(*mode, RiskEnforcement::NotExposed)).unwrap_or_default();- let session_policy = crate::session_manifest::configured_session_manifest();- let session_policy_status = session_policy+ let capability_manifest = crate::session_manifest::configured_capability_manifest();+ let capability_manifest_status = capability_manifest.as_ref().ok().and_then(|manifest| *manifest)@@ -1354,7 +1311,9 @@ pub fn status_json_with_provider(authorization_host: Option<&'static str>) -> se"version": manifest.version(),"sha256": manifest.sha256(),"expires_unix_ms": manifest.expires_unix_ms(),- "idle_timeout_seconds": manifest.idle_timeout().as_secs(),+ "idle_timeout_seconds": manifest.idle_timeout().map(|duration| duration.as_secs()),+ "expired": manifest.is_expired(),+ "idle_expired": manifest.is_idle_expired(),"allow_count": allow,"deny_count": deny,"ask_count": ask,@@ -1389,10 +1348,15 @@ pub fn status_json_with_provider(authorization_host: Option<&'static str>) -> se"enforcement_adapters": enforcement_adapter_inventory_json(),"authorization_host": authorization_host,"authorization_host_assurance": authorization_host_assurance,- "session_policy_configured": std::env::var_os(crate::session_manifest::SESSION_POLICY_FILE_ENV).is_some(),- "session_policy_approved_at_startup": env_flag(crate::session_manifest::SESSION_POLICY_APPROVED_ENV),- "session_policy_valid": session_policy.is_ok(),- "session_policy": session_policy_status,+ "capability_manifest_configured": crate::session_manifest::capability_manifest_configured(),+ "capability_manifest_approved_at_startup": crate::session_manifest::capability_manifest_approved(),+ "capability_manifest_valid": capability_manifest.is_ok(),+ "capability_manifest": capability_manifest_status,+ // Deprecated status aliases retained for one compatibility window.+ "session_policy_configured": crate::session_manifest::capability_manifest_configured(),+ "session_policy_approved_at_startup": crate::session_manifest::capability_manifest_approved(),+ "session_policy_valid": capability_manifest.is_ok(),+ "session_policy": capability_manifest_status,});let session_status = crate::session_authorization::status_json();if let (Some(target), Some(session_status)) =@@ -1673,7 +1637,7 @@ mod tests {.iter().find(|adapter| adapter.id == id).unwrap()- .behavior_by_mode+ .profile_behavior.for_mode(mode)};@@ -1689,7 +1653,7 @@ mod tests {assert_eq!(behavior(id, PermissionMode::Standard), ModeBehavior::Allow);assert_eq!(behavior(id, PermissionMode::Bounded),- ModeBehavior::Manifest+ ModeBehavior::AllowWithoutGrant);assert_eq!(behavior(id, PermissionMode::Unrestricted),@@ -1714,6 +1678,87 @@ mod tests {);}+ #[test]+ fn adding_a_manifest_is_monotonic_for_standard_and_unrestricted_profile_behavior() {+ let authority = |behavior| match behavior {+ ModeBehavior::Deny => 0,+ ModeBehavior::RequireGrant => 1,+ ModeBehavior::Allow | ModeBehavior::AllowWithoutGrant => 2,+ };++ // Manifest admission is evaluated before the unchanged profile+ // behavior. Exhaust every adapter and every manifest decision: an+ // in-scope allow preserves the profile result, while deny, legacy ask,+ // and undeclared scope all reduce it to deny.+ for mode in [PermissionMode::Standard, PermissionMode::Unrestricted] {+ for adapter in ENFORCEMENT_ADAPTERS {+ let baseline = adapter.profile_behavior.for_mode(mode);+ for manifest_decision in [+ crate::session_manifest::ManifestDecision::Allow,+ crate::session_manifest::ManifestDecision::Deny,+ crate::session_manifest::ManifestDecision::Ask,+ crate::session_manifest::ManifestDecision::Undeclared,+ ] {+ let with_manifest = match manifest_decision {+ crate::session_manifest::ManifestDecision::Allow => baseline,+ crate::session_manifest::ManifestDecision::Deny+ | crate::session_manifest::ManifestDecision::Ask+ | crate::session_manifest::ManifestDecision::Undeclared => {+ ModeBehavior::Deny+ }+ };+ assert!(+ authority(with_manifest) <= authority(baseline),+ "adding {manifest_decision:?} scope widened {} in {mode:?} from {baseline:?} to {with_manifest:?}",+ adapter.id,+ );+ }+ }+ }+ }++ #[test]+ fn standard_manifest_scope_is_checked_before_existing_profile_approval() {+ use std::io::Write as _;+ use std::sync::Arc;++ let mut file = tempfile::NamedTempFile::new().unwrap();+ writeln!(+ file,+ "version: 3\nallow:\n tools: [browser_prepare]\nresources:\n browser:\n existing_profiles:\n - pid: 42\n window_id: 7"+ )+ .unwrap();+ let manifest = Arc::new(crate::session_manifest::load_manifest(file.path()).unwrap());+ let ceiling = crate::session_authorization::SessionModeCeiling::for_trusted_sessions(+ [PermissionMode::Standard],+ false,+ std::time::Duration::from_secs(60),+ std::time::Duration::from_secs(30),+ )+ .unwrap();+ let context =+ crate::session_authorization::SessionAuthorizationRegistry::with_ceiling(ceiling)+ .compatibility_context(PermissionMode::Standard, Some(manifest))+ .unwrap();++ let call = |window_id| {+ authorize_tool_call_with_context(+ "browser_prepare",+ &serde_json::json!({+ "pid": 42,+ "window_id": window_id,+ "strategy": {"kind": "existing_profile"},+ }),+ &context,+ )+ };+ assert!(call(7).is_ok());+ assert!(call(8)+ .unwrap_err()+ .to_string()+ .contains("outside the capability manifest"));+ }+#[test]fn exact_call_inventory_composes_overlapping_resource_boundaries() {let ids = |tool, args: Value| {@@ -1866,6 +1911,24 @@ mod tests {status["enforcement_adapters"],enforcement_adapter_inventory_json());+ let existing_profile = status["enforcement_adapters"]+ .as_array()+ .unwrap()+ .iter()+ .find(|adapter| adapter["id"] == "browser_prepare.existing_profile")+ .unwrap();+ assert_eq!(+ existing_profile["profile_behavior_class"],+ "grant_in_standard"+ );+ assert_eq!(+ existing_profile["behavior_by_mode"],+ serde_json::json!({+ "standard": "require_grant",+ "bounded": "manifest",+ "unrestricted": "allow",+ })+ );assert_eq!(status["authorization_host_assurance"], "unavailable");assert_eq!(status_json_with_provider(Some("cua_local_desktop_confirmation_v1"))diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rsindex dbc5720356..2b599b5a68 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/engine.rs@@ -96,7 +96,7 @@ fn authorize_live_browser_origin(let manifest = manifest.ok_or_else(|| {refuse(BrowserRefusalCode::BrowserOriginOutsideScope,- "the bounded session policy is unavailable",+ "the capability manifest is unavailable",)})?;manifest@@ -1425,15 +1425,13 @@ impl BrowserEngine {let cdp_session = self.attach(&conn, &tab.cdp_target_id).await?;let dispatch_context = crate::tool::current_dispatch_authorization_context();- let dispatch_mode = dispatch_context- .as_ref()- .map(|context| context.mode())- .map(Ok)- .unwrap_or_else(crate::authorization::configured_permission_mode);- if dispatch_mode.is_ok_and(|mode| mode == crate::authorization::PermissionMode::Bounded) {+ if dispatch_context+ .as_deref()+ .is_some_and(|context| context.capability_manifest().is_some())+ {let live_url = self.live_top_level_url(&conn, &cdp_session).await?;- // A browser mutation admitted for a delegated bounded session- // must use that exact session's manifest. Falling back to the+ // A browser mutation admitted for a delegated session must use+ // that exact session's capability manifest. Falling back to the// process compatibility manifest would let a missing task-local// context borrow unrelated authority.let manifest = dispatch_context@@ -1441,10 +1439,10 @@ impl BrowserEngine {.ok_or_else(|| {refuse(BrowserRefusalCode::BrowserOriginOutsideScope,- "the bounded browser authorization context is unavailable",+ "the browser authorization context is unavailable",)})?- .bounded_manifest();+ .capability_manifest();authorize_live_browser_origin(manifest, &live_url)?;}Ok(ValidatedTab {diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/prepare.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/prepare.rsindex f04120e81a..4155728881 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/prepare.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/prepare.rs@@ -803,10 +803,10 @@ impl BrowserEngine {"bounded existing-profile attachment requires a live session authorization context",)})?;- let manifest = context.bounded_manifest().ok_or_else(|| {+ let manifest = context.capability_manifest().ok_or_else(|| {refusal(BrowserRefusalCode::BrowserConsentRequired,- "bounded existing-profile attachment requires an approved session manifest",+ "bounded existing-profile attachment requires an approved capability manifest",)})?;manifest@@ -985,7 +985,7 @@ impl BrowserEngine {// Host authorization is requested only after the exact process,// native window, browser product, and endpoint owner have all been- // proven. Bounded manifests, launch grants, and unrestricted mode+ // proven. Bounded capability manifests, launch grants, and unrestricted mode// never enter this callback path.let protected_consent = if matches!(consent_path, ConsentPath::Protected) {let transport_session = requestdiff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/refusal.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/refusal.rsindex 51863b4486..74bc3e2b66 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/refusal.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/refusal.rs@@ -62,7 +62,7 @@ pub enum BrowserRefusalCode {/// browser action.BrowserActionUnavailable,/// The live top-level document left the origin set approved in the- /// bounded session manifest. Further browser input is paused.+ /// capability manifest. Further browser input is paused.BrowserOriginOutsideScope,}diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/consent.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/consent.rsindex e1d41a12d0..397b15a307 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/consent.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/consent.rs@@ -98,7 +98,7 @@ pub enum ConsentError {DigestMismatch,#[error("confirmation expired before activation")]Expired,- #[error("protected resource is outside the bounded session policy: {0}")]+ #[error("protected resource is outside the capability manifest: {0}")]BoundedResource(String),}@@ -372,7 +372,27 @@ impl ProtectedResourceGrants {"protected resource adapter '{adapter_id}' is not registered"))})?;- match descriptor.behavior_by_mode.for_mode(context.mode()) {+ if let Some(manifest) = context.capability_manifest() {+ manifest+ .authorize_protected_resource(adapter_id, &resource)+ .map_err(ConsentError::BoundedResource)?;+ }+ let profile_behavior = if adapter_id == "process_control"+ && context.mode() == PermissionMode::Standard+ && resource+ .get("driver_owned")+ .and_then(Value::as_bool)+ .unwrap_or(false)+ {+ // Standard's process-control capability is ownership-dependent:+ // an attested runtime-launched process remains available, while a+ // foreign process is denied before approval. Manifest scope is an+ // additional ceiling and never replaces that ownership proof.+ ModeBehavior::Allow+ } else {+ descriptor.profile_behavior.for_mode(context.mode())+ };+ match profile_behavior {ModeBehavior::Allow => return Ok(None),ModeBehavior::Deny => {return Err(ConsentError::Provider(format!(@@ -380,15 +400,12 @@ impl ProtectedResourceGrants {context.mode().as_str())))}- ModeBehavior::Manifest => {- let manifest = context.bounded_manifest().ok_or_else(|| {+ ModeBehavior::AllowWithoutGrant => {+ context.capability_manifest().ok_or_else(|| {ConsentError::BoundedResource(- "bounded mode has no approved session manifest".to_owned(),+ "bounded mode has no approved capability manifest".to_owned(),)})?;- manifest- .authorize_protected_resource(adapter_id, &resource)- .map_err(ConsentError::BoundedResource)?;return Ok(None);}ModeBehavior::RequireGrant => {}@@ -595,6 +612,7 @@ fn digest_request(request: &ConsentRequest) -> String {#[cfg(test)]mod tests {use super::*;+ use std::io::Write;struct FakeProvider {action: ConsentAction,@@ -659,6 +677,28 @@ mod tests {.unwrap()}+ fn authorization_context_with_manifest(+ mode: PermissionMode,+ ) -> Arc<crate::session_authorization::EffectiveAuthorizationContext> {+ let mut file = tempfile::NamedTempFile::new().unwrap();+ writeln!(+ file,+ "version: 1\nmode: bounded\nexpires_after: 1h\nidle_timeout: 30m\nresources:\n desktop:\n windows:\n - pid: 42\n window_id: 7\nallow:\n tools: [click]"+ )+ .unwrap();+ let manifest = Arc::new(crate::session_manifest::load_manifest(file.path()).unwrap());+ let ceiling = crate::session_authorization::SessionModeCeiling::for_trusted_sessions(+ [mode],+ mode == PermissionMode::Unrestricted,+ Duration::from_secs(60),+ Duration::from_secs(30),+ )+ .unwrap();+ crate::session_authorization::SessionAuthorizationRegistry::with_ceiling(ceiling)+ .compatibility_context(mode, Some(manifest))+ .unwrap()+ }+#[test]fn process_ownership_requires_the_same_attested_process_instance() {let store = ProtectedResourceOwnershipStore::default();@@ -777,6 +817,44 @@ mod tests {assert_eq!(provider.requests.load(Ordering::SeqCst), 0);}+ #[tokio::test]+ async fn capability_manifest_resources_narrow_standard_and_unrestricted_without_prompting() {+ for mode in [PermissionMode::Standard, PermissionMode::Unrestricted] {+ let provider = provider(ConsentAction::Accept);+ let grants =+ ProtectedResourceGrants::new(Arc::new(ApprovalBroker::new(Some(provider.clone()))));+ let context = authorization_context_with_manifest(mode);++ assert!(grants+ .authorize(+ &context,+ "desktop_input",+ RiskClass::R1,+ Some("public-a"),+ serde_json::json!({"kind": "window_input", "pid": 42, "window_id": 7}),+ "Control the declared window",+ Duration::from_secs(30),+ Duration::from_secs(60),+ )+ .await+ .is_ok());+ assert!(grants+ .authorize(+ &context,+ "desktop_input",+ RiskClass::R1,+ Some("public-a"),+ serde_json::json!({"kind": "window_input", "pid": 42, "window_id": 8}),+ "Control an undeclared window",+ Duration::from_secs(30),+ Duration::from_secs(60),+ )+ .await+ .is_err());+ assert_eq!(provider.requests.load(Ordering::SeqCst), 0);+ }+ }+#[tokio::test]async fn exact_accept_creates_a_revocable_grant() {let provider = provider(ConsentAction::Accept);diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/session_authorization.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/session_authorization.rsindex b7115c607f..f4563e310b 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/session_authorization.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/session_authorization.rs@@ -180,7 +180,7 @@ pub struct EffectiveAuthorizationContext {public_session: Option<String>,transport_session: Option<String>,host_lease: Option<HostLeaseId>,- bounded_manifest: Option<Arc<SessionManifest>>,+ capability_manifest: Option<Arc<SessionManifest>>,user_policy_sha256: Option<String>,managed_policy_sha256: Option<String>,expires_unix_ms: Option<u128>,@@ -219,15 +219,23 @@ impl EffectiveAuthorizationContext {}pub fn bounded_manifest(&self) -> Option<&SessionManifest> {- self.bounded_manifest.as_deref()+ self.capability_manifest.as_deref()+ }++ pub fn capability_manifest(&self) -> Option<&SessionManifest> {+ self.capability_manifest.as_deref()}pub fn bounded_manifest_sha256(&self) -> Option<&str> {- self.bounded_manifest+ self.capability_manifest.as_deref().map(SessionManifest::sha256)}+ pub fn capability_manifest_sha256(&self) -> Option<&str> {+ self.bounded_manifest_sha256()+ }+pub fn public_session(&self) -> Option<&str> {self.public_session.as_deref()}@@ -287,7 +295,7 @@ impl EffectiveAuthorizationContext {false}- pub fn authorize_dispatch(&self) -> Result<(), String> {+ fn commit_context_dispatch(&self) -> Result<(), String> {if self.revoked.load(Ordering::Acquire) {return Err("authorization context has been revoked".to_owned());}@@ -310,6 +318,28 @@ impl EffectiveAuthorizationContext {*previous = now;Ok(())}++ /// Commit one dispatch after tool admission and every typed-resource+ /// check have succeeded. A rejected resource must not refresh either+ /// lifetime lease.+ pub fn commit_authorized_dispatch(&self) -> Result<(), String> {+ if self.is_expired() {+ return Err("authorization context expired".to_owned());+ }+ if let Some(manifest) = self.capability_manifest() {+ manifest.check_lifetime()?;+ }+ self.commit_context_dispatch()?;+ if let Some(manifest) = self.capability_manifest() {+ manifest.commit_authorized_dispatch()?;+ }+ Ok(())+ }++ /// Compatibility alias for callers that commit a fully admitted dispatch.+ pub fn authorize_dispatch(&self) -> Result<(), String> {+ self.commit_authorized_dispatch()+ }}pub struct DelegatedSessionRequest {@@ -318,7 +348,7 @@ pub struct DelegatedSessionRequest {pub mode: PermissionMode,pub ttl: Duration,pub idle_ttl: Duration,- pub bounded_manifest: Option<Arc<SessionManifest>>,+ pub capability_manifest: Option<Arc<SessionManifest>>,}impl std::fmt::Debug for AuthenticatedActionConnection {@@ -347,7 +377,10 @@ impl std::fmt::Debug for EffectiveAuthorizationContext {.field("mode", &self.mode).field("sessions", &"[redacted]").field("host_lease", &self.host_lease.is_some())- .field("bounded_manifest_sha256", &self.bounded_manifest_sha256())+ .field(+ "capability_manifest_sha256",+ &self.capability_manifest_sha256(),+ ).field("user_policy_bound", &self.user_policy_sha256.is_some()).field("managed_policy_bound",@@ -367,9 +400,9 @@ impl std::fmt::Debug for DelegatedSessionRequest {.field("ttl", &self.ttl).field("idle_ttl", &self.idle_ttl).field(- "bounded_manifest_sha256",+ "capability_manifest_sha256",&self- .bounded_manifest+ .capability_manifest.as_deref().map(SessionManifest::sha256),)@@ -403,10 +436,13 @@ pub enum SessionAuthorizationError {Expired,#[error("session and idle TTLs must be non-zero and within the daemon ceiling")]InvalidTtl,- #[error("bounded mode requires an immutable per-session manifest")]+ #[error("bounded mode requires an immutable capability manifest")]MissingBoundedManifest,- #[error("a bounded manifest is valid only for bounded mode")]+ #[deprecated(note = "capability manifests are now valid in every permission profile")]+ #[error("the capability manifest is unexpected")]UnexpectedBoundedManifest,+ #[error("the capability manifest is invalid for the selected permission mode")]+ InvalidManifest,}#[derive(Debug, Default)]@@ -484,14 +520,10 @@ impl SessionAuthorizationRegistry {pub fn legacy_context(&self) -> Result<Arc<EffectiveAuthorizationContext>, String> {let mode = crate::authorization::configured_permission_mode()?;- let bounded_manifest = if mode == PermissionMode::Bounded {- crate::session_manifest::configured_session_manifest()?- .cloned()- .map(Arc::new)- } else {- None- };- self.compatibility_context(mode, bounded_manifest)+ let capability_manifest = crate::session_manifest::configured_capability_manifest()?+ .cloned()+ .map(Arc::new);+ self.compatibility_context(mode, capability_manifest)}/// Construct the compatibility action context from explicit trusted@@ -499,21 +531,16 @@ impl SessionAuthorizationRegistry {pub fn compatibility_context(&self,mode: PermissionMode,- bounded_manifest: Option<Arc<SessionManifest>>,+ capability_manifest: Option<Arc<SessionManifest>>,) -> Result<Arc<EffectiveAuthorizationContext>, String> {if !self.ceiling.allows(mode) {return Err("compatibility permission mode is outside the runtime ceiling".to_owned());}- match (mode, bounded_manifest.as_ref()) {- (PermissionMode::Bounded, None) => {- return Err("bounded compatibility mode requires a session manifest".to_owned())- }- (PermissionMode::Standard | PermissionMode::Unrestricted, Some(_)) => {- return Err(- "a compatibility session manifest is valid only for bounded mode".to_owned(),- )- }- _ => {}+ if mode == PermissionMode::Bounded && capability_manifest.is_none() {+ return Err("bounded compatibility mode requires a capability manifest".to_owned());+ }+ if let Some(manifest) = capability_manifest.as_ref() {+ manifest.validate_for_mode(mode)?;}Ok(Arc::new(EffectiveAuthorizationContext {daemon_generation: self.daemon_generation,@@ -522,7 +549,7 @@ impl SessionAuthorizationRegistry {public_session: None,transport_session: None,host_lease: None,- bounded_manifest,+ capability_manifest,user_policy_sha256: self.ceiling.user_policy_sha256.clone(),managed_policy_sha256: self.ceiling.managed_policy_sha256.clone(),expires_unix_ms: None,@@ -571,14 +598,15 @@ impl SessionAuthorizationRegistry {{return Err(SessionAuthorizationError::InvalidTtl);}- match (request.mode, request.bounded_manifest.as_ref()) {- (PermissionMode::Bounded, None) => {- return Err(SessionAuthorizationError::MissingBoundedManifest)- }- (PermissionMode::Standard | PermissionMode::Unrestricted, Some(_)) => {- return Err(SessionAuthorizationError::UnexpectedBoundedManifest)- }- _ => {}+ if request.mode == PermissionMode::Bounded && request.capability_manifest.is_none() {+ return Err(SessionAuthorizationError::MissingBoundedManifest);+ }+ if request+ .capability_manifest+ .as_ref()+ .is_some_and(|manifest| manifest.validate_for_mode(request.mode).is_err())+ {+ return Err(SessionAuthorizationError::InvalidManifest);}let mut state = self.state.lock().unwrap();state.by_connection.retain(|_, context| {@@ -604,7 +632,7 @@ impl SessionAuthorizationRegistry {public_session: Some(request.public_session),transport_session: Some(request.transport_session),host_lease: Some(host.id),- bounded_manifest: request.bounded_manifest,+ capability_manifest: request.capability_manifest,user_policy_sha256: self.ceiling.user_policy_sha256.clone(),managed_policy_sha256: self.ceiling.managed_policy_sha256.clone(),expires_unix_ms: Some(now_unix_ms() + request.ttl.as_millis()),@@ -800,7 +828,7 @@ mod tests {mode,ttl: Duration::from_secs(60),idle_ttl: Duration::from_secs(30),- bounded_manifest: None,+ capability_manifest: None,}}@@ -1097,7 +1125,7 @@ mod tests {}#[test]- fn bounded_manifests_are_stored_per_connection_context() {+ fn capability_manifests_are_stored_per_connection_context() {let registry = SessionAuthorizationRegistry::delegated_for_test(SessionModeCeiling::delegated([PermissionMode::Bounded], false),);@@ -1109,7 +1137,7 @@ mod tests {let hash_b = manifest_b.sha256().to_owned();let mut request_a = request(PermissionMode::Bounded);- request_a.bounded_manifest = Some(manifest_a);+ request_a.capability_manifest = Some(manifest_a);registry.bind_delegated_session(&host, &connection_a, request_a).unwrap();@@ -1117,7 +1145,7 @@ mod tests {let mut request_b = request(PermissionMode::Bounded);request_b.public_session = "public-b".to_owned();request_b.transport_session = "transport-b".to_owned();- request_b.bounded_manifest = Some(manifest_b);+ request_b.capability_manifest = Some(manifest_b);registry.bind_delegated_session(&host, &connection_b, request_b).unwrap();@@ -1127,24 +1155,28 @@ mod tests {registry.resolve_delegated(&connection_a, "public-a", "transport-a").unwrap()- .bounded_manifest_sha256(),+ .capability_manifest_sha256(),Some(hash_a.as_str()));assert_eq!(registry.resolve_delegated(&connection_b, "public-b", "transport-b").unwrap()- .bounded_manifest_sha256(),+ .capability_manifest_sha256(),Some(hash_b.as_str()));}#[test]- fn manifest_presence_matches_the_exact_mode() {+ fn capability_manifest_is_optional_except_in_bounded_mode() {let registry =SessionAuthorizationRegistry::delegated_for_test(SessionModeCeiling::delegated(- [PermissionMode::Standard, PermissionMode::Bounded],- false,+ [+ PermissionMode::Standard,+ PermissionMode::Bounded,+ PermissionMode::Unrestricted,+ ],+ true,));let (host, bounded_connection) = registry.trusted_pair_for_test(None);assert_eq!(@@ -1160,13 +1192,33 @@ mod tests {let (_, standard_connection) = registry.trusted_pair_for_test(Some(&host));let mut standard = request(PermissionMode::Standard);- standard.bounded_manifest = Some(manifest_with_allowed_tool("click"));- assert_eq!(- registry- .bind_delegated_session(&host, &standard_connection, standard)- .unwrap_err(),- SessionAuthorizationError::UnexpectedBoundedManifest- );+ standard.capability_manifest = Some(manifest_with_allowed_tool("click"));+ registry+ .bind_delegated_session(&host, &standard_connection, standard)+ .unwrap();+ assert!(registry+ .resolve_delegated(&standard_connection, "public-a", "transport-a")+ .unwrap()+ .capability_manifest()+ .is_some());++ let (_, unrestricted_connection) = registry.trusted_pair_for_test(Some(&host));+ let mut unrestricted = request(PermissionMode::Unrestricted);+ unrestricted.public_session = "public-unrestricted".to_owned();+ unrestricted.transport_session = "transport-unrestricted".to_owned();+ unrestricted.capability_manifest = Some(manifest_with_allowed_tool("click"));+ registry+ .bind_delegated_session(&host, &unrestricted_connection, unrestricted)+ .unwrap();+ assert!(registry+ .resolve_delegated(+ &unrestricted_connection,+ "public-unrestricted",+ "transport-unrestricted",+ )+ .unwrap()+ .capability_manifest()+ .is_some());}#[test]diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/session_manifest.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/session_manifest.rsindex 2c80907f61..bfa681fc05 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/session_manifest.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/session_manifest.rs@@ -1,4 +1,4 @@-//! Immutable bounded-autonomy manifest loaded at trusted daemon startup.+//! Immutable capability manifest loaded at trusted daemon startup.//!//! The agent may propose this file, but selecting and approving it is a//! launcher responsibility. The manifest only narrows the built-in,@@ -17,6 +17,8 @@ use sha2::{Digest, Sha256};pub const SESSION_POLICY_FILE_ENV: &str = "CUA_DRIVER_SESSION_POLICY_FILE";pub const SESSION_POLICY_APPROVED_ENV: &str = "CUA_DRIVER_SESSION_POLICY_APPROVED";+pub const CAPABILITY_MANIFEST_FILE_ENV: &str = "CUA_DRIVER_CAPABILITY_MANIFEST_FILE";+pub const CAPABILITY_MANIFEST_APPROVED_ENV: &str = "CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED";#[derive(Debug, Clone, Copy, PartialEq, Eq)]pub enum ManifestDecision {@@ -30,8 +32,8 @@ pub enum ManifestDecision {pub struct SessionManifest {version: u32,sha256: String,- expires_unix_ms: u128,- idle_timeout: Duration,+ expires_unix_ms: Option<u128>,+ idle_timeout: Option<Duration>,allow: HashSet<String>,deny: HashSet<String>,ask: HashSet<String>,@@ -84,11 +86,11 @@ impl SessionManifest {&self.sha256}- pub fn expires_unix_ms(&self) -> u128 {+ pub fn expires_unix_ms(&self) -> Option<u128> {self.expires_unix_ms}- pub fn idle_timeout(&self) -> Duration {+ pub fn idle_timeout(&self) -> Option<Duration> {self.idle_timeout}@@ -134,7 +136,7 @@ impl SessionManifest {&& !self.existing_profiles.contains(&(pid, window_id)){return Err(format!(- "browser pid {pid} window {window_id} is outside the bounded session policy"+ "browser pid {pid} window {window_id} is outside the capability manifest"));}}@@ -156,12 +158,12 @@ impl SessionManifest {if self.browser_origins.contains(&origin) {Ok(())} else {- Err("the live browser origin is outside the bounded session policy".to_owned())+ Err("the live browser origin is outside the capability manifest".to_owned())}}/// Match the implementation-attested resource of an active adapter- /// against the immutable bounded manifest. A tool allow-list entry alone+ /// against the immutable capability manifest. A tool allow-list entry alone/// never widens the resources approved at launch.pub fn authorize_protected_resource(&self,@@ -174,7 +176,7 @@ impl SessionManifest {.ok_or_else(|| format!("{adapter_id} did not attest a resource kind"))?;let refused = || {Err(format!(- "{adapter_id} resource kind '{kind}' is outside the bounded session policy"+ "{adapter_id} resource kind '{kind}' is outside the capability manifest"))};match adapter_id {@@ -182,7 +184,7 @@ impl SessionManifest {"window" => self.authorize_desktop_window(resource),"application" => self.authorize_desktop_application(resource),"display" => self.desktop_display.then_some(()).ok_or_else(|| {- "desktop display observation is outside the bounded session policy".to_owned()+ "desktop display observation is outside the capability manifest".to_owned()}),"browser_target" | "authenticated_browser_tab" => {self.authorize_resource_origin(resource)@@ -193,7 +195,7 @@ impl SessionManifest {// directly instead of keying enforcement on a field the tool// can never send."session_capture_scope" => self.desktop_display.then_some(()).ok_or_else(|| {- "desktop capture escalation is outside the bounded session policy".to_owned()+ "desktop capture escalation is outside the capability manifest".to_owned()}),"session_trajectory_recording" => Ok(()),_ => refused(),@@ -202,7 +204,7 @@ impl SessionManifest {"window_input" => self.authorize_desktop_window(resource),"application_input" => self.authorize_desktop_application(resource),"display_input" => self.desktop_display.then_some(()).ok_or_else(|| {- "desktop-wide input is outside the bounded session policy".to_owned()+ "desktop-wide input is outside the capability manifest".to_owned()}),_ => refused(),},@@ -240,7 +242,7 @@ impl SessionManifest {Ok(())} else {Err(format!(- "process pid {pid} is outside the bounded session policy"+ "process pid {pid} is outside the capability manifest"))}}@@ -260,7 +262,7 @@ impl SessionManifest {}){return Err(format!(- "driver configuration change '{key}' is outside the bounded session policy"+ "driver configuration change '{key}' is outside the capability manifest"));}}@@ -286,7 +288,7 @@ impl SessionManifest {Ok(())} else {Err(format!(- "desktop pid {pid} window {window_id} is outside the bounded session policy"+ "desktop pid {pid} window {window_id} is outside the capability manifest"))}}@@ -306,7 +308,7 @@ impl SessionManifest {Ok(())} else {Err(format!(- "desktop application pid {pid} is outside the bounded session policy"+ "desktop application pid {pid} is outside the capability manifest"))}}@@ -347,7 +349,7 @@ impl SessionManifest {if self.browser_origins.contains(origin) {Ok(())} else {- Err("the live browser origin is outside the bounded session policy".to_owned())+ Err("the live browser origin is outside the capability manifest".to_owned())}}@@ -376,10 +378,7 @@ impl SessionManifest {) {Ok(())} else {- Err(- "one or more upload paths are outside the bounded session policy"- .to_owned(),- )+ Err("one or more upload paths are outside the capability manifest".to_owned())}}"trajectory_replay" => self.authorize_exact_path(@@ -411,7 +410,7 @@ impl SessionManifest {// reviewed bounded decision."dependency_install" => Ok(()),_ => Err(format!(- "file resource kind '{kind}' is outside the bounded session policy"+ "file resource kind '{kind}' is outside the capability manifest")),}}@@ -430,34 +429,75 @@ impl SessionManifest {if path_allowed(path, allowed, roots) {Ok(())} else {- Err("the exact path is outside the bounded session policy".to_owned())+ Err("the exact path is outside the capability manifest".to_owned())}}pub fn is_expired(&self) -> bool {- self.expires_unix_ms < now_unix_ms()+ self.expires_unix_ms+ .is_some_and(|expires_unix_ms| expires_unix_ms < now_unix_ms())}pub fn is_idle_expired(&self) -> bool {self.idle_expired.load(Ordering::Acquire)}- /// Refresh the bounded-mode idle lease only after a call passed every- /// manifest decision and resource check. Once the idle lease expires it is- /// terminal for this daemon instance; a tool call cannot revive it.- pub fn authorize_dispatch(&self) -> Result<(), String> {+ /// Check the optional idle lease without refreshing it.+ pub fn check_lifetime(&self) -> Result<(), String> {+ if self.is_expired() {+ return Err("capability manifest expired".to_owned());+ }+ let Some(idle_timeout) = self.idle_timeout else {+ return Ok(());+ };if self.is_idle_expired() {- return Err("bounded session policy idle timeout exceeded".to_owned());+ return Err("capability manifest idle timeout exceeded".to_owned());+ }+ let last = self.last_authorized_dispatch.lock().unwrap();+ if Instant::now().duration_since(*last) > idle_timeout {+ self.idle_expired.store(true, Ordering::Release);+ return Err("capability manifest idle timeout exceeded".to_owned());}+ Ok(())+ }++ /// Refresh the capability-manifest idle lease only after a call passed every+ /// manifest decision and resource check. Once the idle lease expires it is+ /// terminal for this daemon instance; a tool call cannot revive it.+ pub fn commit_authorized_dispatch(&self) -> Result<(), String> {+ self.check_lifetime()?;+ let Some(idle_timeout) = self.idle_timeout else {+ return Ok(());+ };let now = Instant::now();let mut last = self.last_authorized_dispatch.lock().unwrap();- if now.duration_since(*last) > self.idle_timeout {+ if now.duration_since(*last) > idle_timeout {self.idle_expired.store(true, Ordering::Release);- return Err("bounded session policy idle timeout exceeded".to_owned());+ return Err("capability manifest idle timeout exceeded".to_owned());}*last = now;Ok(())}++ /// Compatibility alias retained for downstream callers during migration.+ pub fn authorize_dispatch(&self) -> Result<(), String> {+ self.commit_authorized_dispatch()+ }++ pub fn validate_for_mode(+ &self,+ mode: crate::authorization::PermissionMode,+ ) -> Result<(), String> {+ if mode == crate::authorization::PermissionMode::Bounded+ && (self.expires_unix_ms.is_none() || self.idle_timeout.is_none())+ {+ return Err(+ "bounded mode requires capability manifest expires_after and idle_timeout"+ .to_owned(),+ );+ }+ self.check_lifetime()+ }}#[cfg(feature = "yaml")]@@ -465,9 +505,12 @@ impl SessionManifest {#[serde(deny_unknown_fields)]struct RawManifest {version: u32,- mode: String,- expires_after: String,- idle_timeout: String,+ #[serde(default)]+ mode: Option<String>,+ #[serde(default)]+ expires_after: Option<String>,+ #[serde(default)]+ idle_timeout: Option<String>,#[serde(default)]resources: RawResources,#[serde(default)]@@ -475,7 +518,7 @@ struct RawManifest {#[serde(default)]deny: RawToolSet,#[serde(default)]- ask: RawToolSet,+ ask: Option<RawToolSet>,}#[cfg(feature = "yaml")]@@ -622,26 +665,66 @@ pub fn configured_session_manifest() -> Result<Option<&'static SessionManifest>,}}+pub fn configured_capability_manifest() -> Result<Option<&'static SessionManifest>, String> {+ configured_session_manifest()+}++pub fn capability_manifest_configured() -> bool {+ std::env::var_os(CAPABILITY_MANIFEST_FILE_ENV).is_some()+ || std::env::var_os(SESSION_POLICY_FILE_ENV).is_some()+}++pub fn capability_manifest_approved() -> bool {+ [+ CAPABILITY_MANIFEST_APPROVED_ENV,+ SESSION_POLICY_APPROVED_ENV,+ ]+ .into_iter()+ .any(|name| {+ std::env::var(name).is_ok_and(|value| {+ matches!(+ value.trim().to_ascii_lowercase().as_str(),+ "1" | "true" | "yes" | "on"+ )+ })+ })+}+fn load_configured_manifest() -> Result<Option<SessionManifest>, String> {- let Some(path) = std::env::var_os(SESSION_POLICY_FILE_ENV) else {+ let capability_path = std::env::var_os(CAPABILITY_MANIFEST_FILE_ENV);+ let legacy_path = std::env::var_os(SESSION_POLICY_FILE_ENV);+ if capability_path.is_some() && legacy_path.is_some() && capability_path != legacy_path {+ return Err(format!(+ "{CAPABILITY_MANIFEST_FILE_ENV} conflicts with deprecated {SESSION_POLICY_FILE_ENV}"+ ));+ }+ let Some(path) = capability_path.or(legacy_path) else {return Ok(None);};load_manifest(Path::new(&path)).map(Some)}-/// Load and validate an immutable bounded-session manifest for a trusted+/// Load and validate an immutable capability manifest for a trusted/// runtime/session constructor.pub fn load_manifest(path: &Path) -> Result<SessionManifest, String> {- let bytes = std::fs::read(path)- .map_err(|error| format!("failed to read session policy {}: {error}", path.display()))?;+ let bytes = std::fs::read(path).map_err(|error| {+ format!(+ "failed to read capability manifest {}: {error}",+ path.display()+ )+ })?;if bytes.is_empty() {- return Err(format!("session policy {} is empty", path.display()));+ return Err(format!("capability manifest {} is empty", path.display()));}#[cfg(feature = "yaml")]- let raw: RawManifest = serde_yaml_ng::from_slice(&bytes)- .map_err(|error| format!("failed to parse session policy {}: {error}", path.display()))?;+ let raw: RawManifest = serde_yaml_ng::from_slice(&bytes).map_err(|error| {+ format!(+ "failed to parse capability manifest {}: {error}",+ path.display()+ )+ })?;#[cfg(not(feature = "yaml"))]- return Err("session policy support requires the yaml feature".to_owned());+ return Err("capability manifest support requires the yaml feature".to_owned());#[cfg(feature = "yaml")]{@@ -684,42 +767,70 @@ pub fn load_manifest(path: &Path) -> Result<SessionManifest, String> {changes: raw_configuration_changes,} = driver_configuration;- if !matches!(version, 1 | 2) {+ if !matches!(version, 1..=3) {return Err(format!(- "unsupported session policy version {}; expected 1 or 2",+ "unsupported capability manifest version {}; expected 1, 2, or 3",version));}- if !matches!(mode.as_str(), "bounded" | "autonomous") {- return Err("session policy mode must be bounded".to_owned());- }- let expires_after = parse_duration(&expires_after)?;- let idle_timeout = parse_duration(&idle_timeout)?;- if expires_after.is_zero() || expires_after > Duration::from_secs(24 * 60 * 60) {- return Err("expires_after must be greater than zero and no more than 24h".to_owned());+ if version < 3 {+ if !mode+ .as_deref()+ .is_some_and(|mode| matches!(mode, "bounded" | "autonomous"))+ {+ return Err("legacy capability manifest mode must be bounded".to_owned());+ }+ } else if mode.is_some() {+ return Err("capability manifest version 3 must not declare mode".to_owned());}- if idle_timeout.is_zero() || idle_timeout > expires_after {+ if version < 3 && (expires_after.is_none() || idle_timeout.is_none()) {return Err(- "idle_timeout must be greater than zero and no more than expires_after".to_owned(),+ "legacy capability manifests require expires_after and idle_timeout".to_owned(),);}+ let expires_after = expires_after.as_deref().map(parse_duration).transpose()?;+ let idle_timeout = idle_timeout.as_deref().map(parse_duration).transpose()?;+ if expires_after.is_some_and(|duration| {+ duration.is_zero() || duration > Duration::from_secs(24 * 60 * 60)+ }) {+ return Err("expires_after must be greater than zero and no more than 24h".to_owned());+ }+ if idle_timeout.is_some_and(|idle| {+ idle.is_zero() || expires_after.is_some_and(|expires| idle > expires)+ }) {+ return Err("idle_timeout must be greater than zero and no more than expires_after when both are declared".to_owned());+ }let allow = validate_tools("allow", allow.tools)?;- let deny = validate_tools("deny", deny.tools)?;- let ask = validate_tools("ask", ask.tools)?;+ let mut deny = validate_tools("deny", deny.tools)?;+ let legacy_ask = if version < 3 {+ validate_tools("ask", ask.unwrap_or_default().tools)?+ } else if ask.is_some() {+ return Err("capability manifest version 3 does not support ask.tools".to_owned());+ } else {+ HashSet::new()+ };+ for tool in legacy_ask {+ if !deny.insert(tool.clone()) {+ return Err(format!(+ "capability manifest tool '{tool}' appears in more than one decision set"+ ));+ }+ }+ let ask = HashSet::new();if allow.is_empty() {- return Err("session policy allow.tools must not be empty".to_owned());+ return Err("capability manifest allow.tools must not be empty".to_owned());}for tool in &allow {if deny.contains(tool) || ask.contains(tool) {return Err(format!(- "session policy tool '{tool}' appears in more than one decision set"+ "capability manifest tool '{tool}' appears in more than one decision set"));}}for tool in &deny {if ask.contains(tool) {return Err(format!(- "session policy tool '{tool}' appears in more than one decision set"+ "capability manifest tool '{tool}' appears in more than one decision set"));}}@@ -739,7 +850,9 @@ pub fn load_manifest(path: &Path) -> Result<SessionManifest, String> {}}if version == 1 && !raw_browser_profiles.is_empty() {- return Err("browser profiles require session policy version 2".to_owned());+ return Err(+ "browser profiles require capability manifest version 2 or later".to_owned(),+ );}let mut existing_profile_kind = false;for profile in raw_browser_profiles {@@ -769,7 +882,8 @@ pub fn load_manifest(path: &Path) -> Result<SessionManifest, String> {validate_positive_pids("desktop applications", raw_desktop_applications)?;if version == 1 && !raw_applications.is_empty() {return Err(- "application identity resources require session policy version 2".to_owned(),+ "application identity resources require capability manifest version 2 or later"+ .to_owned(),);}let applications = validate_applications(raw_applications)?;@@ -836,18 +950,23 @@ pub fn load_manifest(path: &Path) -> Result<SessionManifest, String> {.find(|tool| allow.contains(**tool)){return Err(format!(- "origin-scoped bounded manifests cannot allow '{tool}' because it bypasses the typed browser origin adapter"+ "origin-scoped capability manifests cannot allow '{tool}' because it bypasses the typed browser origin adapter"));}}let mut digest = Sha256::new();- digest.update(format!("cua-driver-session-policy-v{version}\0").as_bytes());+ let digest_domain = if version == 3 {+ "cua-driver-capability-manifest"+ } else {+ "cua-driver-session-policy"+ };+ digest.update(format!("{digest_domain}-v{version}\0").as_bytes());digest.update(&bytes);Ok(SessionManifest {version,sha256: format!("{:x}", digest.finalize()),- expires_unix_ms: now_unix_ms() + expires_after.as_millis(),+ expires_unix_ms: expires_after.map(|duration| now_unix_ms() + duration.as_millis()),idle_timeout,allow,deny,@@ -881,12 +1000,12 @@ fn validate_tools(section: &str, tools: Vec<String>) -> Result<HashSet<String>,== crate::authorization::RiskClass::Unclassified{return Err(format!(- "session policy {section}.tools contains unknown or unreviewed tool '{tool}'"+ "capability manifest {section}.tools contains unknown or unreviewed tool '{tool}'"));}if !validated.insert(canonical.clone()) {return Err(format!(- "session policy {section}.tools repeats '{canonical}'"+ "capability manifest {section}.tools repeats '{canonical}'"));}}@@ -996,7 +1115,7 @@ fn validate_manifest_path_resources(RawPathResource::Directory { dir, recursive } => {if version < 2 {return Err(format!(- "{section} directory roots require session policy version 2"+ "{section} directory roots require capability manifest version 2 or later"));}let canonical = validate_manifest_paths(section, vec![dir])?@@ -1200,7 +1319,7 @@ mod tests {#[cfg(feature = "yaml")]#[test]- fn manifest_is_deny_by_default_and_preserves_ask() {+ fn legacy_ask_is_deny_and_undeclared_tools_fail_closed() {let loaded = manifest(r#"version: 1@@ -1219,10 +1338,55 @@ ask:.unwrap();assert_eq!(loaded.decision("start_session"), ManifestDecision::Allow);assert_eq!(loaded.decision("page"), ManifestDecision::Deny);- assert_eq!(loaded.decision("browser_download"), ManifestDecision::Ask);+ assert_eq!(loaded.decision("browser_download"), ManifestDecision::Deny);assert_eq!(loaded.decision("click"), ManifestDecision::Undeclared);}+ #[cfg(feature = "yaml")]+ #[test]+ fn version_three_removes_mode_and_ask_and_allows_optional_lifetimes() {+ let loaded =+ manifest("version: 3\nallow:\n tools: [get_config]\ndeny:\n tools: [page]\n")+ .unwrap();+ assert_eq!(loaded.version(), 3);+ assert_eq!(loaded.expires_unix_ms(), None);+ assert_eq!(loaded.idle_timeout(), None);+ assert!(loaded+ .validate_for_mode(crate::authorization::PermissionMode::Standard)+ .is_ok());+ assert!(loaded+ .validate_for_mode(crate::authorization::PermissionMode::Unrestricted)+ .is_ok());+ assert!(loaded+ .validate_for_mode(crate::authorization::PermissionMode::Bounded)+ .is_err());++ assert!(+ manifest("version: 3\nmode: bounded\nallow:\n tools: [get_config]\n")+ .unwrap_err()+ .contains("must not declare mode")+ );+ assert!(+ manifest("version: 3\nallow:\n tools: [get_config]\nask:\n tools: [page]\n")+ .unwrap_err()+ .contains("does not support ask.tools")+ );+ }++ #[cfg(feature = "yaml")]+ #[test]+ fn version_three_lifetimes_are_enforced_when_declared() {+ let loaded = manifest(+ "version: 3\nexpires_after: 1h\nidle_timeout: 5m\nallow:\n tools: [get_config]\n",+ )+ .unwrap();+ assert!(loaded.expires_unix_ms().is_some());+ assert_eq!(loaded.idle_timeout(), Some(Duration::from_secs(5 * 60)));+ assert!(loaded+ .validate_for_mode(crate::authorization::PermissionMode::Bounded)+ .is_ok());+ }+#[cfg(feature = "yaml")]#[test]fn autonomous_manifest_mode_remains_a_compatibility_alias() {@@ -1690,9 +1854,19 @@ allow:.unwrap();*loaded.last_authorized_dispatch.lock().unwrap() =Instant::now().checked_sub(Duration::from_secs(2)).unwrap();- assert!(loaded.authorize_dispatch().is_err());+ for mode in [+ crate::authorization::PermissionMode::Standard,+ crate::authorization::PermissionMode::Bounded,+ crate::authorization::PermissionMode::Unrestricted,+ ] {+ assert!(+ loaded.validate_for_mode(mode).is_err(),+ "declared idle timeout must be enforced in {mode:?}"+ );+ }+ assert!(loaded.commit_authorized_dispatch().is_err());assert!(loaded.is_idle_expired());- assert!(loaded.authorize_dispatch().is_err());+ assert!(loaded.commit_authorized_dispatch().is_err());for bypass_tool in ["page", "verify_state"] {let policy = format!(diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rsindex a4afc91cba..6e5c993520 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/tool.rs@@ -1163,15 +1163,16 @@ impl ToolRegistry {// Resource adapters run at the same canonical boundary as policy and// manifest admission, after session capture-scope validation but// before recording or the platform tool can observe user state. This- // avoids prompting for a call the session policy will refuse, while+ // avoids prompting for a call the capability manifest will refuse, while// preserving the public arguments in the grant scope and the private// runtime session key in its revocation lifecycle.if has_adapter("private_observation")- && !runtime_proves_driver_owned- && tool- .protected_resource_ownership("private_observation", &public_args)- .await- != ProtectedResourceOwnership::DriverOwned+ && ((!runtime_proves_driver_owned+ && tool+ .protected_resource_ownership("private_observation", &public_args)+ .await+ != ProtectedResourceOwnership::DriverOwned)+ || context.capability_manifest().is_some()){if let Err(error) = self.authorize_private_observation(@@ -1218,7 +1219,9 @@ impl ToolRegistry {namespace_runtime_args(&mut args, context, evidence);}let recording_args = recording_args_for(resolved_name, &public_args);- if has_adapter("desktop_input") && !runtime_proves_driver_owned {+ if has_adapter("desktop_input")+ && (!runtime_proves_driver_owned || context.capability_manifest().is_some())+ {if let Err(error) = self.authorize_desktop_input(resolved_name,@@ -1232,10 +1235,11 @@ impl ToolRegistry {}}if has_adapter("browser_consequential_action")- && tool+ && (tool.protected_resource_ownership("browser_consequential_action", &public_args).await!= ProtectedResourceOwnership::DriverOwned+ || context.capability_manifest().is_some()){let approved_scope = match self.authorize_attested_resource(@@ -1269,10 +1273,11 @@ impl ToolRegistry {}}if has_adapter("browser_bound_input")- && tool+ && (tool.protected_resource_ownership("browser_bound_input", &public_args).await!= ProtectedResourceOwnership::DriverOwned+ || context.capability_manifest().is_some()){let approved_scope = match self.authorize_attested_resource(@@ -1306,8 +1311,7 @@ impl ToolRegistry {}}if has_adapter("process_control")- && (!runtime_proves_driver_owned- || context.mode() == crate::authorization::PermissionMode::Bounded)+ && (!runtime_proves_driver_owned || context.capability_manifest().is_some()){let approved_scope = match self.authorize_attested_resource(@@ -1357,6 +1361,10 @@ impl ToolRegistry {}}+ if let Err(error) = context.commit_authorized_dispatch() {+ return permission_denied_result(error);+ }+let lifecycle_dispatch =if session_requiring_tool(resolved_name) && resolved_name != "start_session" {let Some(session_id) = runtime_session.as_deref() else {@@ -1578,12 +1586,16 @@ impl ToolRegistry {context: &crate::session_authorization::EffectiveAuthorizationContext,lifecycle_session: Option<&str>,) -> Result<(), crate::consent::ConsentError> {- if context.mode() == crate::authorization::PermissionMode::Unrestricted {+ if context.mode() == crate::authorization::PermissionMode::Unrestricted+ && context.capability_manifest().is_none()+ {return Ok(());}let browser_target = args.get("target_id").and_then(Value::as_str);let browser_tab = args.get("tab_id").and_then(Value::as_str);- if context.mode() == crate::authorization::PermissionMode::Standard {+ if context.mode() == crate::authorization::PermissionMode::Standard+ && context.capability_manifest().is_none()+ {// Standard observation is promptless, but browser observations// still have to attest their live target before dispatch.if browser_target.is_some()@@ -1704,7 +1716,7 @@ impl ToolRegistry {)};- if context.mode() == crate::authorization::PermissionMode::Bounded {+ if context.capability_manifest().is_some() {if let Some(pid) = resource.get("pid").and_then(Value::as_i64) {self.enrich_application_resource(&mut resource, pid).await;}@@ -1731,11 +1743,9 @@ impl ToolRegistry {context: &crate::session_authorization::EffectiveAuthorizationContext,lifecycle_session: Option<&str>,) -> Result<(), crate::consent::ConsentError> {- if matches!(- context.mode(),- crate::authorization::PermissionMode::Standard- | crate::authorization::PermissionMode::Unrestricted- ) {+ if context.mode() != crate::authorization::PermissionMode::Bounded+ && context.capability_manifest().is_none()+ {// Standard and unrestricted input do not need a protected grant.// Bounded mode continues below so the exact resource can be// checked against its approved manifest.@@ -1810,7 +1820,7 @@ impl ToolRegistry {)};- if context.mode() == crate::authorization::PermissionMode::Bounded {+ if context.capability_manifest().is_some() {if let Some(pid) = resource.get("pid").and_then(Value::as_i64) {self.enrich_application_resource(&mut resource, pid).await;}@@ -1837,7 +1847,9 @@ impl ToolRegistry {context: &crate::session_authorization::EffectiveAuthorizationContext,lifecycle_session: Option<&str>,) -> Result<(), crate::consent::ConsentError> {- if context.mode() != crate::authorization::PermissionMode::Bounded {+ if context.mode() != crate::authorization::PermissionMode::Bounded+ && context.capability_manifest().is_none()+ {return Ok(());}let (operation, content_kind, summary) = if tool_name == "clipboard_read" {@@ -1890,7 +1902,9 @@ impl ToolRegistry {context: &crate::session_authorization::EffectiveAuthorizationContext,lifecycle_session: Option<&str>,) -> Result<(), ToolResult> {- if context.mode() == crate::authorization::PermissionMode::Unrestricted {+ if context.mode() == crate::authorization::PermissionMode::Unrestricted+ && context.capability_manifest().is_none()+ {return Ok(());}let (resource, summary) = match tool_name {@@ -2050,7 +2064,9 @@ impl ToolRegistry {idle_ttl: Duration,absolute_ttl: Duration,) -> Result<Value, ToolResult> {- if context.mode() == crate::authorization::PermissionMode::Unrestricted {+ if context.mode() == crate::authorization::PermissionMode::Unrestricted+ && context.capability_manifest().is_none()+ {return Ok(Value::Null);}let mut resource = tool@@ -2096,7 +2112,9 @@ impl ToolRegistry {lifecycle_session: Option<&str>,approved_scope: &Value,) -> Result<(), ToolResult> {- if context.mode() == crate::authorization::PermissionMode::Unrestricted {+ if context.mode() == crate::authorization::PermissionMode::Unrestricted+ && context.capability_manifest().is_none()+ {return Ok(());}let mut validation_scope = approved_scope.clone();@@ -2146,7 +2164,9 @@ impl ToolRegistry {})),);}- if context.mode() == crate::authorization::PermissionMode::Unrestricted {+ if context.mode() == crate::authorization::PermissionMode::Unrestricted+ && context.capability_manifest().is_none()+ {return Ok(());}let properties = tool@@ -2642,6 +2662,13 @@ mod runtime_isolation_tests {fn bounded_context(manifest_source: &str,+ ) -> Arc<crate::session_authorization::EffectiveAuthorizationContext> {+ manifest_context(PermissionMode::Bounded, manifest_source)+ }++ fn manifest_context(+ mode: PermissionMode,+ manifest_source: &str,) -> Arc<crate::session_authorization::EffectiveAuthorizationContext> {let mut file = tempfile::NamedTempFile::new().unwrap();file.write_all(manifest_source.as_bytes()).unwrap();@@ -2650,14 +2677,14 @@ mod runtime_isolation_tests {.expect("test bounded manifest loads"),);let ceiling = SessionModeCeiling::for_trusted_sessions(- [PermissionMode::Bounded],- false,+ [mode],+ mode == PermissionMode::Unrestricted,Duration::from_secs(60),Duration::from_secs(30),).unwrap();SessionAuthorizationRegistry::with_ceiling(ceiling)- .compatibility_context(PermissionMode::Bounded, Some(manifest))+ .compatibility_context(mode, Some(manifest)).unwrap()}@@ -3038,6 +3065,155 @@ resources:assert_ne!(result.is_error, Some(true));}+ #[tokio::test]+ async fn capability_manifest_typed_resources_narrow_standard_and_unrestricted() {+ for mode in [PermissionMode::Standard, PermissionMode::Unrestricted] {+ let allowed_hits = Arc::new(AtomicUsize::new(0));+ let registry = attested_registry("get_window_state", None, allowed_hits.clone(), false);+ let allowed = manifest_context(+ mode,+ r#"+version: 3+allow:+ tools: [get_window_state]+resources:+ apps:+ - executable: /synthetic/fixture+ windows: all+"#,+ );+ let result = registry+ .invoke_with_context(+ "get_window_state",+ serde_json::json!({"pid": 424242, "window_id": 7, "session": "review"}),+ allowed,+ )+ .await;+ assert_ne!(result.is_error, Some(true), "{mode:?} in-scope call");+ assert_eq!(allowed_hits.load(Ordering::SeqCst), 1);++ let denied_hits = Arc::new(AtomicUsize::new(0));+ let registry = attested_registry("get_window_state", None, denied_hits.clone(), false);+ let denied = manifest_context(+ mode,+ r#"+version: 3+allow:+ tools: [get_window_state]+resources:+ apps:+ - executable: /another/application+ windows: all+"#,+ );+ let result = registry+ .invoke_with_context(+ "get_window_state",+ serde_json::json!({"pid": 424242, "window_id": 7, "session": "review"}),+ denied,+ )+ .await;+ assert_eq!(result.is_error, Some(true), "{mode:?} out-of-scope call");+ assert_eq!(denied_hits.load(Ordering::SeqCst), 0);+ }+ }++ #[tokio::test]+ async fn capability_manifest_tools_narrow_standard_and_unrestricted() {+ for mode in [PermissionMode::Standard, PermissionMode::Unrestricted] {+ let hits = Arc::new(AtomicUsize::new(0));+ let registry = attested_registry("get_window_state", None, hits.clone(), false);+ let context = manifest_context(+ mode,+ r#"+version: 3+allow:+ tools: [click]+"#,+ );+ let result = registry+ .invoke_with_context(+ "get_window_state",+ serde_json::json!({"pid": 424242, "window_id": 7, "session": "review"}),+ context,+ )+ .await;+ assert_eq!(result.is_error, Some(true), "{mode:?} undeclared tool");+ assert_eq!(hits.load(Ordering::SeqCst), 0);+ }+ }++ #[tokio::test]+ async fn rejected_typed_resource_does_not_refresh_manifest_idle_lease() {+ let denied_hits = Arc::new(AtomicUsize::new(0));+ let allowed_hits = Arc::new(AtomicUsize::new(0));+ let mut registry = super::ToolRegistry::new();+ for (name, window_id, hits) in [+ ("get_desktop_state", 8_u64, denied_hits.clone()),+ ("get_window_state", 7_u64, allowed_hits.clone()),+ ] {+ registry.register(Box::new(AttestedProbe {+ hits,+ scope: serde_json::json!({+ "kind": "window",+ "pid": 42,+ "window_id": window_id,+ }),+ stale_before_dispatch: false,+ def: super::ToolDef {+ name: name.to_owned(),+ description: "manifest idle lease probe".into(),+ input_schema: serde_json::json!({"type": "object"}),+ read_only: true,+ destructive: false,+ idempotent: true,+ open_world: false,+ },+ }));+ }+ let context = manifest_context(+ PermissionMode::Standard,+ r#"+version: 3+expires_after: 1h+idle_timeout: 1s+allow:+ tools: [get_desktop_state, get_window_state]+resources:+ desktop:+ windows:+ - pid: 42+ window_id: 7+"#,+ );++ tokio::time::sleep(Duration::from_millis(650)).await;+ let denied = registry+ .invoke_with_context(+ "get_desktop_state",+ serde_json::json!({"session": "lease"}),+ context.clone(),+ )+ .await;+ assert_eq!(denied.is_error, Some(true));+ assert_eq!(denied_hits.load(Ordering::SeqCst), 0);++ tokio::time::sleep(Duration::from_millis(650)).await;+ let expired = registry+ .invoke_with_context(+ "get_window_state",+ serde_json::json!({"pid": 42, "window_id": 7, "session": "lease"}),+ context,+ )+ .await;+ assert_eq!(expired.is_error, Some(true));+ assert_eq!(allowed_hits.load(Ordering::SeqCst), 0);+ assert!(expired+ .content+ .iter()+ .any(|content| matches!(content, crate::protocol::Content::Text { text, .. } if text.contains("idle timeout"))));+ }+#[tokio::test]async fn ended_session_and_runtime_suspend_latches_fail_closed_at_dispatch() {let ended_hits = Arc::new(AtomicUsize::new(0));@@ -3445,6 +3621,80 @@ resources:);}+ #[tokio::test]+ async fn manifest_cannot_widen_standard_foreign_process_termination() {+ let hits = Arc::new(AtomicUsize::new(0));+ let provider = Arc::new(AcceptingProvider {+ requests: AtomicUsize::new(0),+ });+ let registry = attested_registry("kill_app", Some(provider.clone()), hits.clone(), false);+ let context = manifest_context(+ PermissionMode::Standard,+ r#"+version: 3+allow:+ tools: [kill_app]+resources:+ processes:+ terminate: [424242]+"#,+ );+ let result = registry+ .invoke_with_context(+ "kill_app",+ serde_json::json!({"pid": 424242, "session": "process"}),+ context,+ )+ .await;+ assert_eq!(hits.load(Ordering::SeqCst), 0);+ assert_eq!(provider.requests.load(Ordering::SeqCst), 0);+ assert_eq!(+ result+ .structured_content+ .as_ref()+ .and_then(|value| value.pointer("/refusal/code"))+ .and_then(serde_json::Value::as_str),+ Some("foreign_process_termination_denied")+ );+ }++ #[tokio::test]+ async fn manifest_preserves_standard_owned_process_termination_inside_scope() {+ let hits = Arc::new(AtomicUsize::new(0));+ let registry = attested_registry("kill_app", None, hits.clone(), false);+ let context = manifest_context(+ PermissionMode::Standard,+ r#"+version: 3+allow:+ tools: [kill_app]+resources:+ processes:+ terminate: [424242]+"#,+ );+ registry+ .protected_resource_ownership()+ .mark_driver_owned_process(+ &context.runtime_session_key("process"),+ crate::browser::ProcessFingerprint {+ pid: 424242,+ start_time: Some(7),+ executable: Some("/synthetic/fixture".to_owned()),+ },+ );++ let result = registry+ .invoke_with_context(+ "kill_app",+ serde_json::json!({"pid": 424242, "session": "process"}),+ context,+ )+ .await;+ assert_ne!(result.is_error, Some(true));+ assert_eq!(hits.load(Ordering::SeqCst), 1);+ }+#[tokio::test]async fn standard_owned_process_termination_reproves_the_fingerprint() {let hits = Arc::new(AtomicUsize::new(0));diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/abi.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/abi.rsindex 5c54e4d322..38b120ab69 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/abi.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/abi.rs@@ -13,7 +13,10 @@ use cua_driver_core::{LEGACY_EXISTING_PROFILE_APPROVAL_ENV, PERMISSION_MODE_ENV,},session_authorization::{DelegatedSessionRequest, SessionModeCeiling},- session_manifest::{load_manifest, SESSION_POLICY_APPROVED_ENV, SESSION_POLICY_FILE_ENV},+ session_manifest::{+ load_manifest, CAPABILITY_MANIFEST_APPROVED_ENV, CAPABILITY_MANIFEST_FILE_ENV,+ SESSION_POLICY_APPROVED_ENV, SESSION_POLICY_FILE_ENV,+ },};use serde::Deserialize;use serde_json::Value;@@ -176,12 +179,34 @@ struct AbiDriverOptions {struct AbiRuntimeAuthorizationOptions {allowed_modes: Vec<PermissionMode>,compatibility_mode: PermissionMode,+ #[serde(default)]+ compatibility_capability_manifest_path: Option<String>,+ #[serde(default)]compatibility_bounded_manifest_path: Option<String>,unrestricted_acknowledged: bool,max_session_ttl_seconds: u64,max_idle_ttl_seconds: u64,}+impl AbiRuntimeAuthorizationOptions {+ fn capability_manifest_path(&self) -> Result<Option<&str>, AbiFailure> {+ if self.compatibility_capability_manifest_path.is_some()+ && self.compatibility_bounded_manifest_path.is_some()+ && self.compatibility_capability_manifest_path+ != self.compatibility_bounded_manifest_path+ {+ return Err(AbiFailure::new(+ CuaDriverStatus::InvalidArgument,+ "compatibility capability manifest path conflicts with its deprecated bounded-manifest alias",+ ));+ }+ Ok(self+ .compatibility_capability_manifest_path+ .as_deref()+ .or(self.compatibility_bounded_manifest_path.as_deref()))+ }+}+fn validate_explicit_authorization_sources(authorization: &AbiRuntimeAuthorizationOptions,) -> Result<(), AbiFailure> {@@ -233,17 +258,28 @@ fn validate_explicit_authorization_sources());}- let environment_manifest =- std::env::var_os(SESSION_POLICY_FILE_ENV).map(std::path::PathBuf::from);+ let capability_environment_manifest = std::env::var_os(CAPABILITY_MANIFEST_FILE_ENV);+ let legacy_environment_manifest = std::env::var_os(SESSION_POLICY_FILE_ENV);+ if capability_environment_manifest.is_some()+ && legacy_environment_manifest.is_some()+ && capability_environment_manifest != legacy_environment_manifest+ {+ return Err(AbiFailure::new(+ CuaDriverStatus::InvalidArgument,+ "capability manifest environment path conflicts with its deprecated session-policy alias",+ ));+ }+ let environment_manifest = capability_environment_manifest+ .or(legacy_environment_manifest)+ .map(std::path::PathBuf::from);if let Some(environment_manifest) = environment_manifest {let Some(explicit_manifest) = authorization- .compatibility_bounded_manifest_path- .as_deref()+ .capability_manifest_path()?.map(std::path::Path::new)else {return Err(AbiFailure::new(CuaDriverStatus::InvalidArgument,- "explicit runtime authorization conflicts with a compatibility session policy environment value",+ "explicit runtime authorization conflicts with a compatibility capability-manifest environment value",));};let environment_manifest =@@ -251,7 +287,7 @@ fn validate_explicit_authorization_sources(AbiFailure::new(CuaDriverStatus::InvalidArgument,format!(- "canonicalize compatibility session policy {}: {error}",+ "canonicalize compatibility capability manifest {}: {error}",environment_manifest.display()),)@@ -260,7 +296,7 @@ fn validate_explicit_authorization_sources(AbiFailure::new(CuaDriverStatus::InvalidArgument,format!(- "canonicalize explicit compatibility session policy {}: {error}",+ "canonicalize explicit compatibility capability manifest {}: {error}",explicit_manifest.display()),)@@ -268,15 +304,16 @@ fn validate_explicit_authorization_sources(if environment_manifest != explicit_manifest {return Err(AbiFailure::new(CuaDriverStatus::InvalidArgument,- "explicit compatibility session policy conflicts with the trusted environment path",+ "explicit compatibility capability manifest conflicts with the trusted environment path",));}- } else if environment_flag(SESSION_POLICY_APPROVED_ENV)- && authorization.compatibility_bounded_manifest_path.is_none()+ } else if (environment_flag(CAPABILITY_MANIFEST_APPROVED_ENV)+ || environment_flag(SESSION_POLICY_APPROVED_ENV))+ && authorization.capability_manifest_path()?.is_none(){return Err(AbiFailure::new(CuaDriverStatus::InvalidArgument,- "explicit runtime authorization conflicts with a compatibility session-policy approval",+ "explicit runtime authorization conflicts with a compatibility capability-manifest approval",));}Ok(())@@ -294,8 +331,7 @@ fn runtime_options_from_abi(options: AbiDriverOptions) -> Result<RuntimeOptions,).map_err(|error| AbiFailure::new(CuaDriverStatus::InvalidArgument, error))?;let manifest = authorization- .compatibility_bounded_manifest_path- .as_deref()+ .capability_manifest_path()?.map(std::path::Path::new).map(load_manifest).transpose()@@ -328,6 +364,9 @@ struct AbiTrustedSessionOptions {mode: PermissionMode,ttl_seconds: u64,idle_ttl_seconds: u64,+ #[serde(default)]+ capability_manifest_path: Option<String>,+ #[serde(default)]bounded_manifest_path: Option<String>,/// Host-generated lifecycle lease identity. This field is accepted only/// by the in-process Rust bridge; it is not part of the generated public@@ -336,6 +375,24 @@ struct AbiTrustedSessionOptions {transport_session: Option<String>,}+impl AbiTrustedSessionOptions {+ fn capability_manifest_path(&self) -> Result<Option<&str>, AbiFailure> {+ if self.capability_manifest_path.is_some()+ && self.bounded_manifest_path.is_some()+ && self.capability_manifest_path != self.bounded_manifest_path+ {+ return Err(AbiFailure::new(+ CuaDriverStatus::InvalidArgument,+ "capability manifest path conflicts with its deprecated bounded-manifest alias",+ ));+ }+ Ok(self+ .capability_manifest_path+ .as_deref()+ .or(self.bounded_manifest_path.as_deref()))+ }+}+fn with_ffi_guard(out_error: *mut CuaDriverBuffer,operation: impl FnOnce() -> Result<(), AbiFailure>,@@ -763,16 +820,15 @@ pub unsafe extern "C" fn cua_driver_session_create_v1("public_session must not be empty",));}- let bounded_manifest = options- .bounded_manifest_path- .as_deref()+ let capability_manifest = options+ .capability_manifest_path()?.map(|path| {cua_driver_core::session_manifest::load_manifest(std::path::Path::new(path)).map(Arc::new).map_err(|error| {AbiFailure::new(CuaDriverStatus::InvalidArgument,- format!("invalid bounded session manifest: {error}"),+ format!("invalid capability manifest: {error}"),)})})@@ -786,7 +842,7 @@ pub unsafe extern "C" fn cua_driver_session_create_v1(mode: options.mode,ttl: Duration::from_secs(options.ttl_seconds),idle_ttl: Duration::from_secs(options.idle_ttl_seconds),- bounded_manifest,+ capability_manifest,};let session = driver.runtimediff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rsindex 1e4d2a5300..9597aae8cf 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/embedded.rs@@ -43,6 +43,11 @@ pub struct EmbeddedDriverHostOptions {pub startup_timeout_ms: Option<u64>,pub shutdown_timeout_ms: Option<u64>,pub permission_mode: Option<EmbeddedPermissionMode>,+ #[uniffi(default = None)]+ pub capability_manifest_path: Option<String>,+ #[uniffi(default = false)]+ pub approve_capability_manifest: bool,+ /// Deprecated aliases retained for compatibility.pub session_policy_path: Option<String>,pub approve_session_policy: bool,pub dangerously_bypass_approvals: bool,@@ -251,6 +256,8 @@ impl EmbeddedCuaDriverHost {startup_timeout_ms: None,shutdown_timeout_ms: None,permission_mode: None,+ capability_manifest_path: None,+ approve_capability_manifest: false,session_policy_path: None,approve_session_policy: false,dangerously_bypass_approvals: false,@@ -633,10 +640,10 @@ impl EmbeddedCuaDriverHost {.into(),];if let Some(path) = &self.options.session_policy_path {- args.extend(["--session-policy".into(), path.clone()]);+ args.extend(["--capability-manifest".into(), path.clone()]);}if self.options.approve_session_policy {- args.push("--approve-session-policy".into());+ args.push("--approve-capability-manifest".into());}if self.options.dangerously_bypass_approvals {args.push("--dangerously-bypass-approvals".into());@@ -732,13 +739,33 @@ fn validate_options(let permission_mode = options.permission_mode.unwrap_or(EmbeddedPermissionMode::Standard);+ if options.capability_manifest_path.is_some()+ && options.session_policy_path.is_some()+ && options.capability_manifest_path != options.session_policy_path+ {+ return configuration_error(+ "capability_manifest_path conflicts with deprecated session_policy_path",+ );+ }+ let capability_manifest_path = options+ .capability_manifest_path+ .clone()+ .or_else(|| options.session_policy_path.clone());+ let capability_manifest_approved =+ options.approve_capability_manifest || options.approve_session_policy;+ let manifest_configured = capability_manifest_path+ .as_deref()+ .is_some_and(|path| !path.trim().is_empty());+ if capability_manifest_path.is_some() && !manifest_configured {+ return configuration_error("capability manifest path must not be empty");+ }+ if manifest_configured != capability_manifest_approved {+ return configuration_error(+ "capability manifest path and approval acknowledgement must be supplied together",+ );+ }match permission_mode {EmbeddedPermissionMode::Standard => {- if options.session_policy_path.is_some() || options.approve_session_policy {- return configuration_error(- "session policy options are valid only in bounded mode",- );- }if options.dangerously_bypass_approvals {return configuration_error("dangerously_bypass_approvals is valid only in unrestricted mode",@@ -746,15 +773,8 @@ fn validate_options(}}EmbeddedPermissionMode::Bounded => {- if options- .session_policy_path- .as_deref()- .is_none_or(|path| path.trim().is_empty())- {- return configuration_error("bounded mode requires session_policy_path");- }- if !options.approve_session_policy {- return configuration_error("bounded mode requires approve_session_policy=true");+ if !manifest_configured {+ return configuration_error("bounded mode requires a capability manifest");}if options.dangerously_bypass_approvals {return configuration_error("bounded mode cannot bypass runtime approvals");@@ -766,11 +786,6 @@ fn validate_options("unrestricted mode requires dangerously_bypass_approvals=true",);}- if options.session_policy_path.is_some() || options.approve_session_policy {- return configuration_error(- "unrestricted mode cannot use a bounded session policy",- );- }}}for variable in &options.environment {@@ -795,8 +810,8 @@ fn validate_options(startup_timeout: Duration::from_millis(startup_timeout_ms),shutdown_timeout: Duration::from_millis(shutdown_timeout_ms),permission_mode,- session_policy_path: options.session_policy_path,- approve_session_policy: options.approve_session_policy,+ session_policy_path: capability_manifest_path,+ approve_session_policy: capability_manifest_approved,dangerously_bypass_approvals: options.dangerously_bypass_approvals,environment: options.environment,inherit_stderr: options.inherit_stderr,@@ -849,6 +864,8 @@ pub(crate) fn inherited_managed_environment_name(name: &str) -> bool {| "CUA_DRIVER_ALLOW_LEGACY_EXISTING_PROFILE_APPROVAL"| "CUA_DRIVER_SESSION_POLICY_FILE"| "CUA_DRIVER_SESSION_POLICY_APPROVED"+ | "CUA_DRIVER_CAPABILITY_MANIFEST_FILE"+ | "CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED"| "CUA_DRIVER_POLICY_FILE"| "CUA_DRIVER_MANAGED_POLICY_FILE")@@ -1123,6 +1140,8 @@ mod tests {startup_timeout_ms: None,shutdown_timeout_ms: None,permission_mode: Some(mode),+ capability_manifest_path: None,+ approve_capability_manifest: false,session_policy_path: None,approve_session_policy: false,dangerously_bypass_approvals: false,@@ -1135,6 +1154,11 @@ mod tests {fn authorization_modes_require_explicit_acknowledgements() {assert!(validate_options(options(EmbeddedPermissionMode::Standard)).is_ok());+ let mut standard_manifest = options(EmbeddedPermissionMode::Standard);+ standard_manifest.capability_manifest_path = Some("capabilities.yaml".into());+ standard_manifest.approve_capability_manifest = true;+ assert!(validate_options(standard_manifest).is_ok());+let bounded = options(EmbeddedPermissionMode::Bounded);assert!(validate_options(bounded).is_err());let mut bounded = options(EmbeddedPermissionMode::Bounded);@@ -1147,6 +1171,21 @@ mod tests {let mut unrestricted = options(EmbeddedPermissionMode::Unrestricted);unrestricted.dangerously_bypass_approvals = true;assert!(validate_options(unrestricted).is_ok());++ let mut unrestricted_manifest = options(EmbeddedPermissionMode::Unrestricted);+ unrestricted_manifest.dangerously_bypass_approvals = true;+ unrestricted_manifest.capability_manifest_path = Some("capabilities.yaml".into());+ unrestricted_manifest.approve_capability_manifest = true;+ assert!(validate_options(unrestricted_manifest).is_ok());+ }++ #[test]+ fn capability_manifest_aliases_must_not_conflict() {+ let mut options = options(EmbeddedPermissionMode::Standard);+ options.capability_manifest_path = Some("capabilities-v3.yaml".into());+ options.session_policy_path = Some("legacy-v2.yaml".into());+ options.approve_capability_manifest = true;+ assert!(validate_options(options).is_err());}#[test]diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rsindex 4eb7b05bd3..9ac84e96e0 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/lib.rs@@ -402,7 +402,10 @@ pub struct RuntimeAuthorizationOptions {/// Mode inherited by calls made through the released `CuaDriver` object/// rather than a trusted session-bound action surface.pub compatibility_mode: SessionPermissionMode,- /// Required only when `compatibility_mode` is bounded.+ /// Optional in standard and unrestricted; required when compatibility mode is bounded.+ #[uniffi(default = None)]+ pub compatibility_capability_manifest_path: Option<String>,+ /// Deprecated alias for `compatibility_capability_manifest_path`.pub compatibility_bounded_manifest_path: Option<String>,pub unrestricted_acknowledged: bool,pub max_session_ttl_seconds: u64,@@ -429,6 +432,7 @@ fn configured_driver_options_json(options: &ConfiguredDriverOptions) -> Value {"authorization": {"allowed_modes": allowed_modes,"compatibility_mode": options.authorization.compatibility_mode.as_str(),+ "compatibility_capability_manifest_path": options.authorization.compatibility_capability_manifest_path.clone(),"compatibility_bounded_manifest_path": options.authorization.compatibility_bounded_manifest_path.clone(),"unrestricted_acknowledged": options.authorization.unrestricted_acknowledged,"max_session_ttl_seconds": options.authorization.max_session_ttl_seconds,@@ -444,6 +448,9 @@ pub struct TrustedSessionOptions {pub mode: SessionPermissionMode,pub ttl_seconds: u64,pub idle_ttl_seconds: u64,+ #[uniffi(default = None)]+ pub capability_manifest_path: Option<String>,+ /// Deprecated alias for `capability_manifest_path`.pub bounded_manifest_path: Option<String>,}@@ -1018,6 +1025,7 @@ impl CuaDriver {"mode": options.mode.as_str(),"ttl_seconds": options.ttl_seconds,"idle_ttl_seconds": options.idle_ttl_seconds,+ "capability_manifest_path": options.capability_manifest_path,"bounded_manifest_path": options.bounded_manifest_path,});Ok(Arc::new(CuaDriverSession {@@ -1082,6 +1090,7 @@ impl CuaDriver {"mode": options.mode.as_str(),"ttl_seconds": options.ttl_seconds,"idle_ttl_seconds": options.idle_ttl_seconds,+ "capability_manifest_path": options.capability_manifest_path,"bounded_manifest_path": options.bounded_manifest_path,"transport_session": transport_session,});@@ -1155,14 +1164,10 @@ impl CuaDriver {reason: format!("authorization configuration is invalid: {error}"),}})?;- let manifest = if mode == cua_driver_core::authorization::PermissionMode::Bounded {- cua_driver_core::session_manifest::configured_session_manifest()- .map_err(|error| DriverError::Configuration { reason: error })?- .cloned()- .map(Arc::new)- } else {- None- };+ let manifest = cua_driver_core::session_manifest::configured_capability_manifest()+ .map_err(|error| DriverError::Configuration { reason: error })?+ .cloned()+ .map(Arc::new);let ceiling =cua_driver_core::session_authorization::SessionModeCeiling::for_trusted_sessions([mode],@@ -1211,6 +1216,7 @@ impl CuaDriver {"authorization": {"allowed_modes": allowed_modes,"compatibility_mode": options.authorization.compatibility_mode.as_str(),+ "compatibility_capability_manifest_path": options.authorization.compatibility_capability_manifest_path,"compatibility_bounded_manifest_path": options.authorization.compatibility_bounded_manifest_path,"unrestricted_acknowledged": options.authorization.unrestricted_acknowledged,"max_session_ttl_seconds": options.authorization.max_session_ttl_seconds,@@ -1865,6 +1871,7 @@ mod tests {authorization: RuntimeAuthorizationOptions {allowed_modes: vec![SessionPermissionMode::Standard],compatibility_mode: SessionPermissionMode::Standard,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: false,max_session_ttl_seconds: 60,@@ -1895,6 +1902,7 @@ mod tests {authorization: RuntimeAuthorizationOptions {allowed_modes: vec![SessionPermissionMode::Standard],compatibility_mode: SessionPermissionMode::Standard,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: false,max_session_ttl_seconds: 60,@@ -1926,6 +1934,7 @@ mod tests {authorization: RuntimeAuthorizationOptions {allowed_modes: vec![SessionPermissionMode::Unrestricted],compatibility_mode: SessionPermissionMode::Unrestricted,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: true,max_session_ttl_seconds: 60,@@ -2169,6 +2178,7 @@ mod tests {SessionPermissionMode::Unrestricted,],compatibility_mode: SessionPermissionMode::Standard,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: true,max_session_ttl_seconds: 60,@@ -2182,6 +2192,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2191,6 +2202,7 @@ mod tests {mode: SessionPermissionMode::Unrestricted,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2336,6 +2348,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 2,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2372,6 +2385,7 @@ mod tests {authorization: RuntimeAuthorizationOptions {allowed_modes: vec![SessionPermissionMode::Standard],compatibility_mode: SessionPermissionMode::Standard,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: false,max_session_ttl_seconds: 2,@@ -2386,6 +2400,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 1,idle_ttl_seconds: 1,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2395,6 +2410,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2429,6 +2445,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2473,6 +2490,7 @@ mod tests {SessionPermissionMode::Unrestricted,],compatibility_mode: SessionPermissionMode::Standard,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: true,max_session_ttl_seconds: 60,@@ -2486,6 +2504,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2528,6 +2547,7 @@ mod tests {mode: SessionPermissionMode::Unrestricted,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}),Err(DriverError::Configuration { .. })@@ -2538,6 +2558,7 @@ mod tests {mode: SessionPermissionMode::Unrestricted,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -2898,6 +2919,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).await@@ -3100,6 +3122,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).awaitdiff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/runtime.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/runtime.rsindex deda518ad1..f0e8b17aff 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/runtime.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/runtime.rs@@ -815,7 +815,7 @@ mod tests {mode: PermissionMode::Standard,ttl: Duration::from_secs(60),idle_ttl: Duration::from_secs(30),- bounded_manifest: None,+ capability_manifest: None,}).unwrap();diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/service_session.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/service_session.rsindex 302049fd40..fd46d1c140 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/service_session.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/service_session.rs@@ -479,6 +479,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,},DaemonClientKind::Unknown,@@ -591,6 +592,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,},DaemonClientKind::Unknown,@@ -658,6 +660,7 @@ mod tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,},DaemonClientKind::Unknown,diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/src/worker.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/src/worker.rsindex 638b516b75..d454564a75 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/src/worker.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/src/worker.rs@@ -554,7 +554,10 @@ mod tests {for name in ["CUA_DRIVER_DISABLE_UNRESTRICTED","CUA_DRIVER_MANAGED_POLICY_FILE",+ "CUA_DRIVER_CAPABILITY_MANIFEST_FILE",+ "CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED","CUA_DRIVER_SESSION_POLICY_FILE",+ "CUA_DRIVER_SESSION_POLICY_APPROVED",] {assert!(inherited_managed_environment_name(name));assert!(diff --git a/libs/cua-driver/rust/crates/cua-driver-sdk/tests/runtime_configuration.rs b/libs/cua-driver/rust/crates/cua-driver-sdk/tests/runtime_configuration.rsindex 2424953d7b..e388a44f29 100644--- a/libs/cua-driver/rust/crates/cua-driver-sdk/tests/runtime_configuration.rs+++ b/libs/cua-driver/rust/crates/cua-driver-sdk/tests/runtime_configuration.rs@@ -12,6 +12,7 @@ fn options(allowed_modes: Vec<SessionPermissionMode>) -> ConfiguredDriverOptionsauthorization: RuntimeAuthorizationOptions {allowed_modes,compatibility_mode: SessionPermissionMode::Standard,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: true,max_session_ttl_seconds: 60,@@ -61,6 +62,8 @@ fn run_probe(case: &str, environment: &[(&str, &str)]) {.env_remove("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS").env_remove("CUA_DRIVER_DISABLE_UNRESTRICTED").env_remove("CUA_DRIVER_ALLOW_LEGACY_EXISTING_PROFILE_APPROVAL")+ .env_remove("CUA_DRIVER_CAPABILITY_MANIFEST_FILE")+ .env_remove("CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED").env_remove("CUA_DRIVER_SESSION_POLICY_FILE").env_remove("CUA_DRIVER_SESSION_POLICY_APPROVED");for (name, value) in environment {diff --git a/libs/cua-driver/rust/crates/cua-driver/src/cli.rs b/libs/cua-driver/rust/crates/cua-driver/src/cli.rsindex 6b7712210b..e531ed13dc 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/cli.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/cli.rs@@ -58,11 +58,11 @@ pub enum Command {/// Temporary trusted-launcher compatibility path for the forgeable/// file-backed existing-profile approval artifact.allow_legacy_existing_profile_approval: bool,- /// Immutable bounded-autonomy manifest selected by the trusted- /// launcher. Valid only in bounded mode.- session_policy: Option<String>,+ /// Immutable narrow-only capability manifest selected by the trusted+ /// launcher. Required in bounded mode and optional in other profiles.+ capability_manifest: Option<String>,/// Deliberate launch-time confirmation that the manifest was reviewed.- approve_session_policy: bool,+ approve_capability_manifest: bool,/// True when `--no-permissions-gate` is on argv. The env-var/// `CUA_DRIVER_RS_PERMISSIONS_GATE=0` short-circuits the gate too/// (checked inside the gate itself), so the flag is only one of@@ -217,6 +217,7 @@ const VALUE_FLAGS: &[&str] = &["--permission-mode","--grant","--session-policy",+ "--capability-manifest","--pid-file","--type","--host-bundle-id",@@ -510,10 +511,14 @@ pub fn parse_command() -> Command {" controls the macOS OS-permission onboarding UI.");println!(- " --session-policy <path> Required in bounded mode; immutable tool manifest."+ " --capability-manifest <path> Narrow-only tool/resource manifest; required in bounded mode.");- println!(" --approve-session-policy Required with --session-policy; the trusted launcher asserts");+ println!(" --approve-capability-manifest Required with --capability-manifest; the trusted launcher asserts");println!(" that the human reviewed this exact manifest at startup.");+ println!(" --session-policy <path> Deprecated alias for --capability-manifest.");+ println!(+ " --approve-session-policy Deprecated alias for --approve-capability-manifest."+ );println!();println!("authorization revocation:");println!(" cua-driver revoke --session <id> Stop and revoke one session's grants.");@@ -702,8 +707,14 @@ pub fn parse_command() -> Command {allow_legacy_existing_profile_approval: args.iter().any(|a| a == "--allow-legacy-existing-profile-approval"),- session_policy: flag_value(&args, "--session-policy"),- approve_session_policy: args.iter().any(|a| a == "--approve-session-policy"),+ capability_manifest: aliased_flag_value(+ &args,+ "--capability-manifest",+ "--session-policy",+ ),+ approve_capability_manifest: args+ .iter()+ .any(|a| a == "--approve-capability-manifest" || a == "--approve-session-policy"),// Bare flag — present anywhere on argv counts as "skip the gate".no_permissions_gate: args.iter().any(|a| a == "--no-permissions-gate"),claude_code_compat,@@ -1070,6 +1081,19 @@ fn flag_value(args: &[String], flag: &str) -> Option<String> {None}+fn aliased_flag_value(args: &[String], preferred: &str, deprecated: &str) -> Option<String> {+ let preferred_value = flag_value(args, preferred);+ let deprecated_value = flag_value(args, deprecated);+ if preferred_value.is_some()+ && deprecated_value.is_some()+ && preferred_value != deprecated_value+ {+ eprintln!("{preferred} conflicts with deprecated {deprecated}");+ process::exit(64);+ }+ preferred_value.or(deprecated_value)+}+/// Return every value of a repeatable `--flag value` or `--flag=value`.fn flag_values(args: &[String], flag: &str) -> Vec<String> {let mut values = Vec::new();@@ -1498,8 +1522,10 @@ pub fn build_manifest() -> serde_json::Value {{ "name": "--grant", "type": "repeatable-string", "description": "Pre-authorize a residual standard-mode boundary. Supported value: existing-profile." },{ "name": "--dangerously-bypass-approvals", "type": "flag", "description": "Select unrestricted mode and acknowledge its risk." },{ "name": "--allow-legacy-existing-profile-approval", "type": "flag", "description": "Temporary migration flag for the unprotected file-backed existing-profile artifact." },- { "name": "--session-policy", "type": "string", "description": "Immutable tool manifest required in bounded mode." },- { "name": "--approve-session-policy", "type": "flag", "description": "Trusted-launcher confirmation that the exact bounded manifest was reviewed." },+ { "name": "--capability-manifest", "type": "string", "description": "Optional narrow-only tool/resource ceiling; required in bounded mode." },+ { "name": "--approve-capability-manifest", "type": "flag", "description": "Trusted-launcher confirmation that the exact capability manifest was reviewed." },+ { "name": "--session-policy", "type": "string", "description": "Deprecated alias for --capability-manifest." },+ { "name": "--approve-session-policy", "type": "flag", "description": "Deprecated alias for --approve-capability-manifest." },{ "name": "--no-permissions-gate", "type": "flag", "description": "Skip the macOS TCC first-launch gate." },{ "name": "--claude-code-computer-use-compat", "type": "flag", "description": "Forwarded by the MCP proxy when the client asked for the compat surface." },{ "name": "--embedded", "type": "flag", "description": "Run embedded inside a host app: inherit the host's TCC grants, never prompt or relaunch. Also CUA_DRIVER_EMBEDDED=1." },@@ -3103,13 +3129,15 @@ fn cli_docs_json() -> serde_json::Value {{"name":"pid-file","short_name":null,"help":"Override the pid-file path on Unix targets.","type":"String","default_value":null,"is_optional":true},{"name":"permission-mode","short_name":null,"help":"Immutable agent authorization mode: standard, bounded, or unrestricted.","type":"String","default_value":"standard","is_optional":true},{"name":"grant","short_name":null,"help":"Pre-authorize a residual standard-mode boundary. Repeatable; supported value: existing-profile.","type":"String","default_value":null,"is_optional":true,"is_repeatable":true},- {"name":"session-policy","short_name":null,"help":"Immutable tool manifest required in bounded mode.","type":"String","default_value":null,"is_optional":true},+ {"name":"capability-manifest","short_name":null,"help":"Optional narrow-only tool/resource ceiling; required in bounded mode.","type":"String","default_value":null,"is_optional":true},+ {"name":"session-policy","short_name":null,"help":"Deprecated alias for capability-manifest.","type":"String","default_value":null,"is_optional":true},{"name":"host-bundle-id","short_name":null,"help":"Advisory host bundle id label echoed in check_permissions output (embedded mode).","type":"String","default_value":null,"is_optional":true}],"flags": [{"name":"dangerously-bypass-approvals","short_name":null,"help":"Select unrestricted mode and acknowledge its risk.","default_value":false},{"name":"allow-legacy-existing-profile-approval","short_name":null,"help":"Temporary migration flag for the unprotected file-backed existing-profile artifact.","default_value":false},- {"name":"approve-session-policy","short_name":null,"help":"Trusted-launcher confirmation that the exact bounded manifest was reviewed.","default_value":false},+ {"name":"approve-capability-manifest","short_name":null,"help":"Trusted-launcher confirmation that the exact capability manifest was reviewed.","default_value":false},+ {"name":"approve-session-policy","short_name":null,"help":"Deprecated alias for approve-capability-manifest.","default_value":false},{"name":"no-permissions-gate","short_name":null,"help":"Skip the macOS first-launch permissions gate.","default_value":false},{"name":"embedded","short_name":null,"help":"Run embedded inside a host app: inherit the host's TCC grants, never prompt or relaunch. Also CUA_DRIVER_EMBEDDED=1.","default_value":false},{"name":"no-overlay","short_name":null,"help":"Disable the agent cursor overlay for this daemon.","default_value":false}@@ -3927,6 +3955,26 @@ mod tests {values.iter().map(|value| (*value).to_owned()).collect()}+ #[test]+ fn deprecated_session_policy_flag_remains_a_capability_manifest_alias() {+ let argv = args(&["serve", "--session-policy", "/tmp/legacy.yaml"]);+ assert_eq!(+ aliased_flag_value(&argv, "--capability-manifest", "--session-policy"),+ Some("/tmp/legacy.yaml".to_owned())+ );++ let identical = args(&[+ "serve",+ "--capability-manifest=/tmp/shared.yaml",+ "--session-policy",+ "/tmp/shared.yaml",+ ]);+ assert_eq!(+ aliased_flag_value(&identical, "--capability-manifest", "--session-policy"),+ Some("/tmp/shared.yaml".to_owned())+ );+ }+#[test]fn finite_call_tool_extraction_supports_subcommand_and_legacy_forms() {assert_eq!(diff --git a/libs/cua-driver/rust/crates/cua-driver/src/main.rs b/libs/cua-driver/rust/crates/cua-driver/src/main.rsindex c94e5c7e3d..d62fdb19b1 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/main.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/main.rs@@ -48,8 +48,8 @@ fn configure_startup_permission_mode(permission_mode: Option<&str>,dangerously_bypass_approvals: bool,allow_legacy_existing_profile_approval: bool,- session_policy: Option<&str>,- approve_session_policy: bool,+ capability_manifest: Option<&str>,+ approve_capability_manifest: bool,grants: &[String],) -> anyhow::Result<()> {if let Some(mode) = permission_mode {@@ -75,15 +75,15 @@ fn configure_startup_permission_mode("1",);}- if let Some(path) = session_policy {+ if let Some(path) = capability_manifest {std::env::set_var(- cua_driver_core::session_manifest::SESSION_POLICY_FILE_ENV,+ cua_driver_core::session_manifest::CAPABILITY_MANIFEST_FILE_ENV,path,);}- if approve_session_policy {+ if approve_capability_manifest {std::env::set_var(- cua_driver_core::session_manifest::SESSION_POLICY_APPROVED_ENV,+ cua_driver_core::session_manifest::CAPABILITY_MANIFEST_APPROVED_ENV,"1",);}@@ -512,8 +512,8 @@ fn main() {permission_mode,dangerously_bypass_approvals,allow_legacy_existing_profile_approval,- session_policy,- approve_session_policy,+ capability_manifest,+ approve_capability_manifest,no_permissions_gate,claude_code_compat,grants,@@ -522,8 +522,8 @@ fn main() {permission_mode.as_deref(),dangerously_bypass_approvals,allow_legacy_existing_profile_approval,- session_policy.as_deref(),- approve_session_policy,+ capability_manifest.as_deref(),+ approve_capability_manifest,&grants,) {eprintln!("cua-driver: authorization startup error: {error}");@@ -897,8 +897,8 @@ fn main() -> anyhow::Result<()> {permission_mode,dangerously_bypass_approvals,allow_legacy_existing_profile_approval,- session_policy,- approve_session_policy,+ capability_manifest,+ approve_capability_manifest,no_permissions_gate,claude_code_compat,grants,@@ -907,8 +907,8 @@ fn main() -> anyhow::Result<()> {permission_mode.as_deref(),dangerously_bypass_approvals,allow_legacy_existing_profile_approval,- session_policy.as_deref(),- approve_session_policy,+ capability_manifest.as_deref(),+ approve_capability_manifest,&grants,)?;responsibility::reexec_disclaimed_if_needed();diff --git a/libs/cua-driver/rust/crates/cua-driver/src/serve.rs b/libs/cua-driver/rust/crates/cua-driver/src/serve.rsindex 07073e02b3..e37ea88180 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/serve.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/serve.rs@@ -1907,18 +1907,20 @@ pub fn run_status_cmd(socket_path: &str, pid_file_path: &str) {.unwrap_or("unavailable"));println!(- " session policy: configured={}, approved_at_startup={}, valid={}",- status["session_policy_configured"]+ " capability manifest: configured={}, approved_at_startup={}, valid={}",+ status["capability_manifest_configured"].as_bool().unwrap_or(false),- status["session_policy_approved_at_startup"]+ status["capability_manifest_approved_at_startup"]+ .as_bool()+ .unwrap_or(false),+ status["capability_manifest_valid"].as_bool().unwrap_or(false),- status["session_policy_valid"].as_bool().unwrap_or(false),);- if let Some(manifest) = status["session_policy"].as_object() {+ if let Some(manifest) = status["capability_manifest"].as_object() {println!(- " session policy sha256: {}",+ " capability manifest sha256: {}",manifest.get("sha256").and_then(serde_json::Value::as_str)@@ -2421,6 +2423,7 @@ mod trusted_resume_tests {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,},transport_session: transport_session.into(),diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/daemon_required_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/daemon_required_test.rsindex 1e10d9250f..eca85409c7 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/daemon_required_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/daemon_required_test.rs@@ -311,11 +311,64 @@ deny:assert!(denied.is_error());assert!(denied.text()- .contains("bounded session policy denies tool 'list_apps'"));+ .contains("capability manifest denies tool 'list_apps'"));let undeclared = driver.call("get_screen_size", serde_json::json!({}));assert!(undeclared.is_error());assert!(undeclared.text()- .contains("outside the bounded session policy"));+ .contains("outside the capability manifest"));+}++#[test]+fn capability_manifest_narrows_standard_mode() {+ let directory = tempfile::tempdir().expect("temporary capability manifest directory");+ let manifest_path = directory.path().join("standard-v3.yaml");+ std::fs::write(+ &manifest_path,+ "version: 3\nallow:\n tools: [get_config]\ndeny:\n tools: [list_apps]\n",+ )+ .expect("write standard capability manifest");+ let manifest = manifest_path.display().to_string();+ let mut driver = CliDriver::with_daemon_env(&[+ ("CUA_DRIVER_PERMISSION_MODE", "standard"),+ ("CUA_DRIVER_CAPABILITY_MANIFEST_FILE", &manifest),+ ("CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED", "1"),+ ]);+ assert!(+ driver.available(),+ "standard manifest daemon failed to start"+ );+ assert!(!driver.call("get_config", serde_json::json!({})).is_error());+ assert!(driver.call("list_apps", serde_json::json!({})).is_error());+ assert!(driver+ .call("get_screen_size", serde_json::json!({}))+ .is_error());+}++#[test]+fn capability_manifest_narrows_unrestricted_mode() {+ let directory = tempfile::tempdir().expect("temporary capability manifest directory");+ let manifest_path = directory.path().join("unrestricted-v3.yaml");+ std::fs::write(+ &manifest_path,+ "version: 3\nallow:\n tools: [get_config]\ndeny:\n tools: [list_apps]\n",+ )+ .expect("write unrestricted capability manifest");+ let manifest = manifest_path.display().to_string();+ let mut driver = CliDriver::with_daemon_env(&[+ ("CUA_DRIVER_PERMISSION_MODE", "unrestricted"),+ ("CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS", "1"),+ ("CUA_DRIVER_CAPABILITY_MANIFEST_FILE", &manifest),+ ("CUA_DRIVER_CAPABILITY_MANIFEST_APPROVED", "1"),+ ]);+ assert!(+ driver.available(),+ "unrestricted manifest daemon failed to start"+ );+ assert!(!driver.call("get_config", serde_json::json!({})).is_error());+ assert!(driver.call("list_apps", serde_json::json!({})).is_error());+ assert!(driver+ .call("get_screen_size", serde_json::json!({}))+ .is_error());}diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/permission_policy_startup_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/permission_policy_startup_test.rsindex bad72f3e74..e6b3007b9c 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/permission_policy_startup_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/permission_policy_startup_test.rs@@ -167,13 +167,12 @@ fn danger_flag_alone_selects_unrestricted_and_managed_config_can_disable_it() {assert!(!std::path::Path::new(&socket).exists());}-fn write_valid_session_policy(directory: &tempfile::TempDir) -> String {- let path = directory.path().join("session-policy.yaml");+fn write_valid_capability_manifest(directory: &tempfile::TempDir) -> String {+ let path = directory.path().join("capability-manifest.yaml");std::fs::write(&path,r#"-version: 1-mode: bounded+version: 3expires_after: 1hidle_timeout: 10mresources: {}@@ -181,8 +180,6 @@ allow:tools: [start_session, get_session_state, end_session]deny:tools: [page]-ask:- tools: [browser_download]"#,).unwrap();@@ -190,12 +187,12 @@ ask:}#[test]-fn bounded_mode_requires_a_session_policy_before_bind() {+fn bounded_mode_requires_a_capability_manifest_before_bind() {let directory = tempfile::tempdir().expect("temporary bounded test directory");let socket = test_socket(&directory, "bounded-no-policy");let output = rejected_serve(&socket, &["--permission-mode", "bounded"]);assert!(!output.status.success());- assert!(String::from_utf8_lossy(&output.stderr).contains("requires --session-policy"));+ assert!(String::from_utf8_lossy(&output.stderr).contains("requires --capability-manifest"));#[cfg(unix)]assert!(!std::path::Path::new(&socket).exists());}@@ -203,35 +200,97 @@ fn bounded_mode_requires_a_session_policy_before_bind() {#[test]fn bounded_mode_requires_launch_time_manifest_approval_before_bind() {let directory = tempfile::tempdir().expect("temporary bounded test directory");- let policy = write_valid_session_policy(&directory);+ let policy = write_valid_capability_manifest(&directory);let socket = test_socket(&directory, "bounded-no-approval");let output = rejected_serve(&socket,- &["--permission-mode", "bounded", "--session-policy", &policy],+ &[+ "--permission-mode",+ "bounded",+ "--capability-manifest",+ &policy,+ ],+ );+ assert!(!output.status.success());+ assert!(+ String::from_utf8_lossy(&output.stderr).contains("requires --approve-capability-manifest")+ );+ #[cfg(unix)]+ assert!(!std::path::Path::new(&socket).exists());+}++#[test]+fn deprecated_session_policy_flags_remain_startup_aliases() {+ let directory = tempfile::tempdir().expect("temporary bounded alias test directory");+ let policy = directory.path().join("legacy-session-policy.yaml");+ std::fs::write(+ &policy,+ r#"+version: 3+resources: {}+allow:+ tools: [start_session]+"#,+ )+ .expect("write v3 manifest without bounded lifetime fields");+ let socket = test_socket(&directory, "bounded-deprecated-aliases");+ let output = rejected_serve(+ &socket,+ &[+ "--permission-mode",+ "bounded",+ "--session-policy",+ &policy.display().to_string(),+ "--approve-session-policy",+ ],);+assert!(!output.status.success());- assert!(String::from_utf8_lossy(&output.stderr).contains("requires --approve-session-policy"));+ let stderr = String::from_utf8_lossy(&output.stderr);+ assert!(+ stderr.contains("requires capability manifest expires_after and idle_timeout"),+ "deprecated aliases did not reach bounded manifest validation: {stderr}"+ );#[cfg(unix)]assert!(!std::path::Path::new(&socket).exists());}#[test]-fn session_policy_cannot_be_smuggled_into_standard_mode() {+fn capability_manifest_without_acknowledgement_fails_in_standard_mode() {let directory = tempfile::tempdir().expect("temporary standard test directory");- let policy = write_valid_session_policy(&directory);+ let policy = write_valid_capability_manifest(&directory);let socket = test_socket(&directory, "standard-session-policy");let output = rejected_serve(&socket,&["--permission-mode","standard",- "--session-policy",+ "--capability-manifest",&policy,- "--approve-session-policy",],);assert!(!output.status.success());- assert!(String::from_utf8_lossy(&output.stderr).contains("valid only with"));+ assert!(+ String::from_utf8_lossy(&output.stderr).contains("requires --approve-capability-manifest")+ );+ #[cfg(unix)]+ assert!(!std::path::Path::new(&socket).exists());+}++#[test]+fn capability_manifest_acknowledgement_without_manifest_fails_closed() {+ let directory = tempfile::tempdir().expect("temporary standard test directory");+ let socket = test_socket(&directory, "standard-manifest-ack-only");+ let output = rejected_serve(+ &socket,+ &[+ "--permission-mode",+ "standard",+ "--approve-capability-manifest",+ ],+ );+ assert!(!output.status.success());+ assert!(String::from_utf8_lossy(&output.stderr).contains("requires --capability-manifest"));#[cfg(unix)]assert!(!std::path::Path::new(&socket).exists());}@@ -239,16 +298,16 @@ fn session_policy_cannot_be_smuggled_into_standard_mode() {#[test]fn legacy_existing_profile_approval_cannot_bypass_bounded_indicator() {let directory = tempfile::tempdir().expect("temporary bounded test directory");- let policy = write_valid_session_policy(&directory);+ let policy = write_valid_capability_manifest(&directory);let socket = test_socket(&directory, "bounded-legacy-approval");let output = rejected_serve(&socket,&["--permission-mode","bounded",- "--session-policy",+ "--capability-manifest",&policy,- "--approve-session-policy",+ "--approve-capability-manifest","--allow-legacy-existing-profile-approval",],);@@ -266,7 +325,7 @@ fn autonomous_mode_name_remains_a_bounded_compatibility_alias() {let output = rejected_serve(&socket, &["--permission-mode", "autonomous"]);assert!(!output.status.success());assert!(String::from_utf8_lossy(&output.stderr)- .contains("permission mode bounded requires --session-policy"));+ .contains("permission mode bounded requires --capability-manifest"));#[cfg(unix)]assert!(!std::path::Path::new(&socket).exists());}diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/private_worker_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/private_worker_test.rsindex 985447f5e1..14029e08f1 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/private_worker_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/private_worker_test.rs@@ -18,6 +18,7 @@ fn worker_options() -> PrivateWorkerOptions {SessionPermissionMode::Unrestricted,],compatibility_mode: SessionPermissionMode::Standard,+ compatibility_capability_manifest_path: None,compatibility_bounded_manifest_path: None,unrestricted_acknowledged: true,max_session_ttl_seconds: 60,@@ -50,6 +51,7 @@ async fn private_worker_owns_one_runtime_without_a_reconnect_endpoint() {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -127,6 +129,7 @@ async fn private_worker_inherits_the_interactive_linux_display_scope() {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -147,6 +150,7 @@ async fn private_worker_inherits_the_interactive_linux_display_scope() {mode: SessionPermissionMode::Unrestricted,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -241,6 +245,8 @@ async fn embedded_service_binds_authority_to_the_original_host_connection() {startup_timeout_ms: Some(10_000),shutdown_timeout_ms: Some(2_000),permission_mode: Some(EmbeddedPermissionMode::Standard),+ capability_manifest_path: None,+ approve_capability_manifest: false,session_policy_path: None,approve_session_policy: false,dangerously_bypass_approvals: false,@@ -257,6 +263,7 @@ async fn embedded_service_binds_authority_to_the_original_host_connection() {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,}).unwrap();@@ -298,6 +305,7 @@ fn service_untrusted_child_probe() {mode: SessionPermissionMode::Standard,ttl_seconds: 60,idle_ttl_seconds: 30,+ capability_manifest_path: None,bounded_manifest_path: None,});assert!(diff --git a/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts b/libs/cua-driver/typescript/src/native/cua_driver_sdk.tsindex 0dda3d795e..53e0bd65c8 100644--- a/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts+++ b/libs/cua-driver/typescript/src/native/cua_driver_sdk.ts@@ -151,7 +151,11 @@ export type RuntimeAuthorizationOptions = {*/compatibilityMode: SessionPermissionMode,/**- * Required only when `compatibility_mode` is bounded.+ * Optional in standard and unrestricted; required when compatibility mode is bounded.+ */+ compatibilityCapabilityManifestPath?: string,+ /**+ * Deprecated alias for `compatibility_capability_manifest_path`.*/compatibilityBoundedManifestPath?: string,unrestrictedAcknowledged: boolean,@@ -164,6 +168,7 @@ export type RuntimeAuthorizationOptions = {*/export const RuntimeAuthorizationOptions = (() => {const defaults = () => ({+ compatibilityCapabilityManifestPath: undefined,});const create = (() => {return uniffiCreateRecord<RuntimeAuthorizationOptions, ReturnType<typeof defaults>>(defaults);@@ -182,6 +187,7 @@ const FfiConverterTypeRuntimeAuthorizationOptions = (() => {return {allowedModes: FfiConverterSequenceTypeSessionPermissionMode.read(from),compatibilityMode: FfiConverterTypeSessionPermissionMode.read(from),+ compatibilityCapabilityManifestPath: FfiConverterOptionalString.read(from),compatibilityBoundedManifestPath: FfiConverterOptionalString.read(from),unrestrictedAcknowledged: FfiConverterBool.read(from),maxSessionTtlSeconds: FfiConverterUInt64.read(from),@@ -191,6 +197,7 @@ const FfiConverterTypeRuntimeAuthorizationOptions = (() => {write(value: TypeName, into: RustBuffer): void {FfiConverterSequenceTypeSessionPermissionMode.write(value.allowedModes, into);FfiConverterTypeSessionPermissionMode.write(value.compatibilityMode, into);+ FfiConverterOptionalString.write(value.compatibilityCapabilityManifestPath, into);FfiConverterOptionalString.write(value.compatibilityBoundedManifestPath, into);FfiConverterBool.write(value.unrestrictedAcknowledged, into);FfiConverterUInt64.write(value.maxSessionTtlSeconds, into);@@ -199,6 +206,7 @@ const FfiConverterTypeRuntimeAuthorizationOptions = (() => {allocationSize(value: TypeName): number {return FfiConverterSequenceTypeSessionPermissionMode.allocationSize(value.allowedModes) +FfiConverterTypeSessionPermissionMode.allocationSize(value.compatibilityMode) ++ FfiConverterOptionalString.allocationSize(value.compatibilityCapabilityManifestPath) +FfiConverterOptionalString.allocationSize(value.compatibilityBoundedManifestPath) +FfiConverterBool.allocationSize(value.unrestrictedAcknowledged) +FfiConverterUInt64.allocationSize(value.maxSessionTtlSeconds) +@@ -900,6 +908,11 @@ export type EmbeddedDriverHostOptions = {startupTimeoutMs?: bigint,shutdownTimeoutMs?: bigint,permissionMode?: EmbeddedPermissionMode,+ capabilityManifestPath?: string,+ approveCapabilityManifest: boolean,+ /**+ * Deprecated aliases retained for compatibility.+ */sessionPolicyPath?: string,approveSessionPolicy: boolean,dangerouslyBypassApprovals: boolean,@@ -912,6 +925,8 @@ export type EmbeddedDriverHostOptions = {*/export const EmbeddedDriverHostOptions = (() => {const defaults = () => ({+ capabilityManifestPath: undefined,+ approveCapabilityManifest: false,});const create = (() => {return uniffiCreateRecord<EmbeddedDriverHostOptions, ReturnType<typeof defaults>>(defaults);@@ -934,6 +949,8 @@ const FfiConverterTypeEmbeddedDriverHostOptions = (() => {startupTimeoutMs: FfiConverterOptionalUInt64.read(from),shutdownTimeoutMs: FfiConverterOptionalUInt64.read(from),permissionMode: FfiConverterOptionalTypeEmbeddedPermissionMode.read(from),+ capabilityManifestPath: FfiConverterOptionalString.read(from),+ approveCapabilityManifest: FfiConverterBool.read(from),sessionPolicyPath: FfiConverterOptionalString.read(from),approveSessionPolicy: FfiConverterBool.read(from),dangerouslyBypassApprovals: FfiConverterBool.read(from),@@ -948,6 +965,8 @@ const FfiConverterTypeEmbeddedDriverHostOptions = (() => {FfiConverterOptionalUInt64.write(value.startupTimeoutMs, into);FfiConverterOptionalUInt64.write(value.shutdownTimeoutMs, into);FfiConverterOptionalTypeEmbeddedPermissionMode.write(value.permissionMode, into);+ FfiConverterOptionalString.write(value.capabilityManifestPath, into);+ FfiConverterBool.write(value.approveCapabilityManifest, into);FfiConverterOptionalString.write(value.sessionPolicyPath, into);FfiConverterBool.write(value.approveSessionPolicy, into);FfiConverterBool.write(value.dangerouslyBypassApprovals, into);@@ -961,6 +980,8 @@ const FfiConverterTypeEmbeddedDriverHostOptions = (() => {FfiConverterOptionalUInt64.allocationSize(value.startupTimeoutMs) +FfiConverterOptionalUInt64.allocationSize(value.shutdownTimeoutMs) +FfiConverterOptionalTypeEmbeddedPermissionMode.allocationSize(value.permissionMode) ++ FfiConverterOptionalString.allocationSize(value.capabilityManifestPath) ++ FfiConverterBool.allocationSize(value.approveCapabilityManifest) +FfiConverterOptionalString.allocationSize(value.sessionPolicyPath) +FfiConverterBool.allocationSize(value.approveSessionPolicy) +FfiConverterBool.allocationSize(value.dangerouslyBypassApprovals) +@@ -1215,6 +1236,10 @@ export type TrustedSessionOptions = {mode: SessionPermissionMode,ttlSeconds: bigint,idleTtlSeconds: bigint,+ capabilityManifestPath?: string,+ /**+ * Deprecated alias for `capability_manifest_path`.+ */boundedManifestPath?: string}@@ -1223,6 +1248,7 @@ export type TrustedSessionOptions = {*/export const TrustedSessionOptions = (() => {const defaults = () => ({+ capabilityManifestPath: undefined,});const create = (() => {return uniffiCreateRecord<TrustedSessionOptions, ReturnType<typeof defaults>>(defaults);@@ -1243,6 +1269,7 @@ const FfiConverterTypeTrustedSessionOptions = (() => {mode: FfiConverterTypeSessionPermissionMode.read(from),ttlSeconds: FfiConverterUInt64.read(from),idleTtlSeconds: FfiConverterUInt64.read(from),+ capabilityManifestPath: FfiConverterOptionalString.read(from),boundedManifestPath: FfiConverterOptionalString.read(from)};}@@ -1251,6 +1278,7 @@ const FfiConverterTypeTrustedSessionOptions = (() => {FfiConverterTypeSessionPermissionMode.write(value.mode, into);FfiConverterUInt64.write(value.ttlSeconds, into);FfiConverterUInt64.write(value.idleTtlSeconds, into);+ FfiConverterOptionalString.write(value.capabilityManifestPath, into);FfiConverterOptionalString.write(value.boundedManifestPath, into);}allocationSize(value: TypeName): number {@@ -1258,6 +1286,7 @@ const FfiConverterTypeTrustedSessionOptions = (() => {FfiConverterTypeSessionPermissionMode.allocationSize(value.mode) +FfiConverterUInt64.allocationSize(value.ttlSeconds) +FfiConverterUInt64.allocationSize(value.idleTtlSeconds) ++ FfiConverterOptionalString.allocationSize(value.capabilityManifestPath) +FfiConverterOptionalString.allocationSize(value.boundedManifestPath);}