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)!: remove browser approval tokens (#3185)
Francesco Bonacci0d7c011eb315
diff --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 48a70cbf17..c42d6df99d 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@@ -39,12 +39,12 @@ person's normal profile to DevTools.## Prepare an isolated browser when requiredIf inspection returns `browser_requires_setup`, call `browser_prepare` as a-separate approved operation. It starts another Chromium process with a-driver-owned profile; it never copies, modifies, restarts, or terminates the-selected user profile.--In an MCP client, approve the destructive tool call through the client's normal-approval UI:+separate operation. Isolated-profile preparation follows the runtime's+permission mode and optional capability manifest. In `standard` it is a+routine operation, in `bounded` it must match the manifest, and in+`unrestricted` it relies on the launcher's dangerous acknowledgement. It+starts another Chromium process with a driver-owned profile; it never copies,+modifies, restarts, or terminates the selected user profile.```jsoncbrowser_prepare({@@ -59,17 +59,9 @@ The response includes `prepared_pid`. Call `list_windows` for that new process,then bind its window with `get_browser_state`. An `isolated_new` profile isremoved when its owning session ends. Use`profile: {"mode":"isolated_named","name":"research"}` only when the-automation profile must survive across sessions.--For direct CLI or raw-socket use, mint a five-minute, single-use token from an-interactive terminal first:--```bash-cua-driver browser-approve --pid 844 --profile-mode isolated_new-```--Pass the returned token as `approval_token` in the otherwise identical-`browser_prepare` call. `get_browser_state` never performs this setup itself.+automation profile must survive across sessions. `allow_launch: true` states+that this call may create the separate process; it does not widen runtime+authorization. `get_browser_state` never performs setup itself.## Attach to an existing Chrome or Edge profilediff --git a/docs/content/docs/reference/cua-driver/browser-profile-attachment.mdx b/docs/content/docs/reference/cua-driver/browser-profile-attachment.mdxindex fa86cd9164..9e96c6c92f 100644--- a/docs/content/docs/reference/cua-driver/browser-profile-attachment.mdx+++ b/docs/content/docs/reference/cua-driver/browser-profile-attachment.mdx@@ -40,11 +40,6 @@ proves transport provenance, not approval to use an authenticated browserprofile. A standalone standard-mode runtime without a launch grant or hostcallback fails closed.-The old `browser-approve` file artifact is disabled by default. A trusted-launcher can temporarily enable it with-`--allow-legacy-existing-profile-approval`. The artifact is same-user writable-and is not protected human consent.-## Success resultA successful call returns `action: "attached_existing_profile"` and an@@ -73,7 +68,7 @@ A successful call returns `action: "attached_existing_profile"` and anAll fields are `false` when the endpoint was already available. The driver doesnot return the profile identity, endpoint address, port, connection generation,-grant identifier, or approval artifact.+grant identifier, or internal authorization details.A refusal after setup begins may include `detail.setup_side_effects`. This usesthe same setup fields and adds `restored_remote_debugging` when the driver had@@ -150,8 +145,7 @@ for why Cua Driver uses CDP and which risks remain outside the driver.Host authorization events contain only bounded metadata and the structuredoutcome. They do not include browser screenshots or accessibility snapshots.Public results, recordings, and telemetry must not contain profile paths or-hashes, endpoint URLs or ports, approval tokens, page content, tab URLs,-cookies, or storage.+hashes, endpoint URLs or ports, page content, tab URLs, cookies, or storage.The content-free browser operation and refusal fields are documented in[Telemetry and privacy](/reference/cua-driver/telemetry#structured-browser-refusals).diff --git a/docs/content/docs/reference/cua-driver/cli-reference.mdx b/docs/content/docs/reference/cua-driver/cli-reference.mdxindex aeef9605cd..c991aa8a8f 100644--- a/docs/content/docs/reference/cua-driver/cli-reference.mdx+++ b/docs/content/docs/reference/cua-driver/cli-reference.mdx@@ -107,7 +107,6 @@ The daemon owns per-process state such as element-index caches, recording state,| Name | Description || ---- | ----------- || `--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-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. |diff --git a/docs/content/docs/reference/cua-driver/mcp-tools.mdx b/docs/content/docs/reference/cua-driver/mcp-tools.mdxindex 7fef799920..74e72697bd 100644--- a/docs/content/docs/reference/cua-driver/mcp-tools.mdx+++ b/docs/content/docs/reference/cua-driver/mcp-tools.mdx@@ -879,12 +879,11 @@ Read-only browser inspection. Mode 1 (bind): pass pid + window_id of a native br### `browser_prepare`-Explicitly prepare an owned DevTools endpoint for a browser pid. Existing endpoints are detected without side effects. Acting setup for an isolated profile requires host approval or a short-lived setup token plus allow_launch=true. It launches a separate browser and never copies, modifies, or terminates the requested user profile. Existing-profile attachment is explicit and follows the runtime's immutable permission mode: standard requires an explicit --grant existing-profile launch grant or an embedding authorization host, bounded requires a launch-approved exact resource manifest, and unrestricted requires explicit trusted startup risk acceptance. Ordinary MCP transport approval never proves profile authorization. On proven platforms, an authorized request also permits one bounded exact-window setup: open the recognized browser product's fixed remote-debugging page, toggle its uniquely matched per-instance checkbox, prove the PID-owned loopback endpoint, and close the temporary tab. Every visible effect is reported; ambiguity is refused.+Explicitly prepare an owned DevTools endpoint for a browser pid. Existing endpoints are detected without side effects. Acting setup for an isolated profile follows the runtime permission mode and optional capability manifest. It requires allow_launch=true, launches a separate browser, and never copies, modifies, or terminates the requested user profile. Existing-profile attachment is explicit and follows the runtime's immutable permission mode: standard requires an explicit --grant existing-profile launch grant or an embedding authorization host, bounded requires a launch-approved exact resource manifest, and unrestricted requires explicit trusted startup risk acceptance. Ordinary MCP transport approval never proves profile authorization. On proven platforms, an authorized request also permits one bounded exact-window setup: open the recognized browser product's fixed remote-debugging page, toggle its uniquely matched per-instance checkbox, prove the PID-owned loopback endpoint, and close the temporary tab. Every visible effect is reported; ambiguity is refused.**Arguments:**- `allow_launch` (boolean, optional): Allow a separate driver-owned isolated Chromium process to be launched (default false).-- `approval_token` (string, optional): Legacy single-use setup token. Existing-profile use is disabled unless a trusted launcher explicitly enables the same-user-writable compatibility path.- `pid` (integer, required): Browser process id to prepare.- `profile` (object, optional)- `session` (string, optional): For multi-call work, prefer a short public session label and repeat it on every call that accepts it. Omit it to use the authenticated transport's implicit lifecycle session. Browser targets, tabs, and refs belong to the resolved lifecycle session.diff --git a/docs/content/docs/reference/cua-driver/permission-modes.mdx b/docs/content/docs/reference/cua-driver/permission-modes.mdxindex 79ad43b9a2..876dcd0e6b 100644--- a/docs/content/docs/reference/cua-driver/permission-modes.mdx+++ b/docs/content/docs/reference/cua-driver/permission-modes.mdx@@ -124,6 +124,11 @@ not open a Cua confirmation card for routine actions.Path canonicalization, browser-origin validation, process identity checks, andmanaged or user policy still apply when standard permits an operation.+Driver-owned isolated browser preparation follows the selected mode and any+optional capability manifest. Standard allows it as a routine operation,+bounded requires it to match the manifest, and unrestricted relies on the+launcher's dangerous acknowledgement.+## Existing logged-in Chromium profilesAn existing profile can contain live cookies and authenticated sites. Standard@@ -152,8 +157,6 @@ Other valid authorization paths are:`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- launcher explicitly enables it.An MCP transport marker, model-supplied Boolean, environment variable, orordinary tool argument is never an attachment grant.diff --git a/libs/cua-driver/compat-fixtures/cli.json b/libs/cua-driver/compat-fixtures/cli.jsonindex f496c32f5a..2dd1c67f1e 100644--- a/libs/cua-driver/compat-fixtures/cli.json+++ b/libs/cua-driver/compat-fixtures/cli.json@@ -2,7 +2,7 @@"help_lines": ["cross-platform computer-use automation driver","Usage: cua-driver [SUBCOMMAND] [OPTIONS]",- "Subcommands: mcp, list-tools, describe, call, serve, stop, revoke, status, config, telemetry, recording, update, check-update, doctor, diagnose, permissions, autostart, skills, browser-approve, manifest"+ "Subcommands: mcp, list-tools, describe, call, serve, stop, revoke, status, config, telemetry, recording, update, check-update, doctor, diagnose, permissions, autostart, skills, manifest"],"manifest": {"schema_version": "1",diff --git a/libs/cua-driver/rust/Skills/cua-driver/BROWSER.md b/libs/cua-driver/rust/Skills/cua-driver/BROWSER.mdindex 3adafa6e02..97903b313b 100644--- a/libs/cua-driver/rust/Skills/cua-driver/BROWSER.md+++ b/libs/cua-driver/rust/Skills/cua-driver/BROWSER.md@@ -107,15 +107,17 @@ Prefer an isolated profile when the task does not need the user's existingcookies or login state:```bash-# Direct CLI/raw clients mint this token interactively. MCP hosts can use their-# destructive-tool approval flow instead.-cua-driver browser-approve --pid 4242 --profile-mode isolated_new-cua-driver browser_prepare \'{"pid":4242,"session":"browser-run-1","allow_launch":true,- "profile":{"mode":"isolated_new"},"approval_token":"<token>"}'+ "profile":{"mode":"isolated_new"}}'```+Isolated preparation follows the runtime permission mode and optional+capability manifest. Standard mode treats it as routine, bounded mode requires+a matching manifest, and unrestricted mode requires the launcher's dangerous+acknowledgement. `allow_launch: true` states that this call may create the+separate process; it does not widen runtime authorization.+Use `isolated_named` with a path-safe `name` for a reusable driver-managedprofile. Preparation launches a separate browser and never copies, modifies,or terminates the requested personal profile. The result returns adiff --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 4112d3edac..fa8b72c041 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@@ -14,8 +14,6 @@ use serde_json::Value;pub const PERMISSION_MODE_ENV: &str = "CUA_DRIVER_PERMISSION_MODE";pub const DANGEROUS_BYPASS_ENV: &str = "CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS";pub const DISABLE_UNRESTRICTED_ENV: &str = "CUA_DRIVER_DISABLE_UNRESTRICTED";-pub const LEGACY_EXISTING_PROFILE_APPROVAL_ENV: &str =- "CUA_DRIVER_ALLOW_LEGACY_EXISTING_PROFILE_APPROVAL";pub const RISK_METADATA_VERSION: &str = "1";static LAUNCH_GRANTS: OnceLock<BTreeSet<String>> = OnceLock::new();@@ -193,6 +191,18 @@ impl AdapterProfileBehavior {}const EXISTING_PROFILE_OPERATIONS: &[&str] = &["browser_prepare[strategy.kind=existing_profile]"];+const ISOLATED_BROWSER_OPERATIONS: &[&str] = &["browser_prepare[profile.mode=isolated]"];+const ISOLATED_BROWSER_SCOPE_KEYS: &[&str] = &[+ "daemon_generation",+ "public_session",+ "transport_session",+ "pid",+ "profile_mode",+ "profile_name",+ "permission_mode",+ "managed_policy_sha256",+ "user_policy_sha256",+];const EXISTING_PROFILE_SCOPE_KEYS: &[&str] = &["daemon_generation","public_session",@@ -366,6 +376,23 @@ const SESSION_REVOCATION: &[&str] = &[];pub const ENFORCEMENT_ADAPTERS: &[EnforcementAdapterDescriptor] = &[+ EnforcementAdapterDescriptor {+ id: "browser_prepare.isolated",+ operations: ISOLATED_BROWSER_OPERATIONS,+ state: RiskEnforcement::Active,+ risk_class: RiskClass::R1,+ resource_kind: "driver_owned_browser_profile",+ scope_keys: ISOLATED_BROWSER_SCOPE_KEYS,+ grant_type: None,+ idle_ttl_seconds: None,+ absolute_ttl_seconds: None,+ authorization_requirement: "profile_behavior_and_optional_capability_manifest",+ revocation_triggers: SESSION_REVOCATION,+ refusal_code: Some("authorization_required"),+ authorization_source: "built_in_standard; unattended_bounded_profile; trusted_unrestricted_mode; optional_capability_manifest_ceiling",+ enforcement_by_mode: AdapterEnforcement::uniform(RiskEnforcement::Active),+ profile_behavior: AdapterProfileBehavior::Routine,+ },EnforcementAdapterDescriptor {id: "browser_prepare.existing_profile",operations: EXISTING_PROFILE_OPERATIONS,@@ -669,6 +696,13 @@ pub fn enforcement_adapters_for_call(&& args.pointer("/strategy/kind").and_then(Value::as_str) == Some("existing_profile"){add("browser_prepare.existing_profile");+ } else if tool == "browser_prepare"+ && matches!(+ args.pointer("/profile/mode").and_then(Value::as_str),+ Some("isolated_new" | "isolated_named")+ )+ {+ add("browser_prepare.isolated");}if matches!(@@ -898,7 +932,7 @@ pub fn classify_tool_call(tool: &str, args: &Value) -> RiskAssessment {} else {RiskAssessment {class: RiskClass::R1,- enforcement: RiskEnforcement::MetadataOnly,+ enforcement: RiskEnforcement::Active,operation_sensitive: true,}}@@ -1172,10 +1206,6 @@ pub enum PermissionModeError {UnexpectedSessionPolicy,#[error("permission mode unrestricted is disabled by managed startup configuration")]UnrestrictedDisabled,- #[error(- "--allow-legacy-existing-profile-approval is valid only with --permission-mode standard"- )]- UnexpectedLegacyApproval,}fn parse_permission_mode(@@ -1208,21 +1238,6 @@ fn env_flag(name: &str) -> bool {})}-/// Temporary migration escape hatch for the same-user-writable browser-/// approval artifact. It is deliberately outside the public tool protocol and-/// must never be described as protected human consent.-pub fn legacy_existing_profile_approval_enabled() -> bool {- // Core's browser unit fixtures exercise the legacy artifact's binding,- // setup, reconnect, and cleanup mechanics directly. Integration tests- // compile this crate without `cfg(test)` and own the production-default- // refusal contract.- #[cfg(test)]- return true;-- #[cfg(not(test))]- env_flag(LEGACY_EXISTING_PROFILE_APPROVAL_ENV)-}-static CONFIGURED_PERMISSION_MODE: OnceLock<Result<PermissionMode, String>> = OnceLock::new();/// Return the immutable process permission mode. An unset mode is `standard`.@@ -1245,9 +1260,6 @@ pub fn validate_startup_authorization() -> anyhow::Result<()> {if mode == PermissionMode::Unrestricted && env_flag(DISABLE_UNRESTRICTED_ENV) {return Err(PermissionModeError::UnrestrictedDisabled.into());}- if mode != PermissionMode::Standard && env_flag(LEGACY_EXISTING_PROFILE_APPROVAL_ENV) {- return Err(PermissionModeError::UnexpectedLegacyApproval.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 {@@ -1337,7 +1349,6 @@ pub fn status_json_with_provider(authorization_host: Option<&'static str>) -> se"managed_policy_valid": managed_policy.is_ok(),"managed_policy_sha256": managed_policy_sha256,"built_in_ceiling": "reviewed_tool_and_risk_map_v1",- "legacy_existing_profile_approval": legacy_existing_profile_approval_enabled(),"risk_metadata_version": RISK_METADATA_VERSION,"active_risk_enforcement": adapter_ids_with_state(RiskEnforcement::Active),"metadata_only_risk_enforcement": adapter_ids_with_state(RiskEnforcement::MetadataOnly),@@ -1432,7 +1443,7 @@ mod tests {}#[test]- fn existing_profile_is_the_first_actively_enforced_risk_operation() {+ fn browser_prepare_operations_are_actively_enforced() {assert_eq!(advertised_risk_for("browser_prepare").enforcement,RiskEnforcement::Active,@@ -1450,7 +1461,7 @@ mod tests {&serde_json::json!({"profile": {"mode": "isolated_new"}}),);assert_eq!(isolated.class, RiskClass::R1);- assert_eq!(isolated.enforcement, RiskEnforcement::MetadataOnly);+ assert_eq!(isolated.enforcement, RiskEnforcement::Active);}#[test]@@ -1583,6 +1594,7 @@ mod tests {assert_eq!(adapter_ids_with_state(RiskEnforcement::Active),vec![+ "browser_prepare.isolated","browser_prepare.existing_profile","private_observation","desktop_input",@@ -1607,6 +1619,7 @@ mod tests {assert_eq!(adapter_ids_with_state_for_mode(PermissionMode::Standard, RiskEnforcement::Active),vec![+ "browser_prepare.isolated","browser_prepare.existing_profile","private_observation","desktop_input",@@ -1642,6 +1655,7 @@ mod tests {};for id in [+ "browser_prepare.isolated","private_observation","desktop_input","file_transfer_and_output",@@ -1781,6 +1795,20 @@ mod tests {);assert!(ids("page", serde_json::json!({})).is_empty());assert!(ids("page", serde_json::json!({"action": "unknown"})).is_empty());+ assert_eq!(+ ids(+ "browser_prepare",+ serde_json::json!({"profile": {"mode": "isolated_new"}})+ ),+ vec!["browser_prepare.isolated"]+ );+ assert_eq!(+ ids(+ "browser_prepare",+ serde_json::json!({"strategy": {"kind": "existing_profile"}})+ ),+ vec!["browser_prepare.existing_profile"]+ );assert_eq!(ids("browser_dialog", serde_json::json!({"action": "accept"})),vec!["browser_consequential_action"]@@ -1866,6 +1894,7 @@ mod tests {assert_eq!(status["active_risk_enforcement"],serde_json::json!([+ "browser_prepare.isolated","browser_prepare.existing_profile","private_observation","desktop_input",@@ -1890,6 +1919,7 @@ mod tests {assert_eq!(status["effective_active_risk_enforcement"],serde_json::json!([+ "browser_prepare.isolated","browser_prepare.existing_profile","private_observation","desktop_input",diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/approval.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/approval.rsdeleted file mode 100644index 87669abf59..0000000000--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/approval.rs+++ /dev/null@@ -1,299 +0,0 @@-//! Explicit approval evidence for mutating browser preparation.-//!-//! MCP-host approval is carried on an internal transport marker. Direct CLI-//! and raw callers instead use a short-lived, single-use artifact minted by-//! the interactive `browser-approve` command. Public tool arguments never-//! treat a Boolean as consent.--use std::fs::{self, OpenOptions};-use std::io::Write;-use std::path::PathBuf;-use std::time::{Duration, SystemTime, UNIX_EPOCH};--use serde::{Deserialize, Serialize};-use uuid::Uuid;--use super::platform::{PrepareProfile, PrepareProfileMode};-use super::refusal::{BrowserRefusal, BrowserRefusalCode};--pub const MCP_HOST_APPROVAL_ARG: &str = "_cua_browser_prepare_mcp_host_approved";-pub const MAX_APPROVAL_TTL: Duration = Duration::from_secs(5 * 60);--#[derive(Debug, Serialize, Deserialize)]-struct IsolatedApprovalArtifact {- schema: String,- token: String,- pid: i64,- profile: PrepareProfile,- expires_unix_ms: u128,-}--/// Exact public operation authorized by an interactive existing-profile-/// approval. Transport identity is intentionally absent: the daemon binds it-/// when consuming the artifact and minting its in-memory grant.-#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]-pub struct ExistingProfileApprovalScope {- pub pid: i64,- pub window_id: u64,- pub session: String,-}--#[derive(Debug, Serialize, Deserialize)]-struct ExistingProfileApprovalArtifact {- schema: String,- token: String,- scope: ExistingProfileApprovalScope,- expires_unix_ms: u128,-}--fn refusal(message: impl Into<String>) -> BrowserRefusal {- BrowserRefusal::new(BrowserRefusalCode::BrowserConsentRequired, message)-}--fn now_unix_ms() -> Result<u128, BrowserRefusal> {- SystemTime::now()- .duration_since(UNIX_EPOCH)- .map(|duration| duration.as_millis())- .map_err(|_| refusal("the system clock cannot validate browser preparation approval"))-}--fn approval_root() -> PathBuf {- std::env::temp_dir().join("cua-driver-browser-approvals-v1")-}--fn artifact_path(token: &str) -> Result<PathBuf, BrowserRefusal> {- let parsed = Uuid::parse_str(token)- .map_err(|_| refusal("browser preparation approval token is malformed or expired"))?;- Ok(approval_root().join(format!("{parsed}.json")))-}--pub fn validate_profile(profile: &PrepareProfile) -> Result<(), BrowserRefusal> {- match profile.mode {- PrepareProfileMode::IsolatedNew => {- if profile.name.is_some() {- return Err(refusal("profile.name is not valid with mode=isolated_new"));- }- }- PrepareProfileMode::IsolatedNamed => {- let Some(name) = profile.name.as_deref() else {- return Err(refusal("profile.name is required with mode=isolated_named"));- };- if name.is_empty()- || name.len() > 64- || !name- .bytes()- .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_'))- {- return Err(refusal(- "profile.name must be 1-64 ASCII letters, digits, '-' or '_'",- ));- }- }- }- Ok(())-}--/// Mint approval evidence after an interactive caller has confirmed the exact-/// operation. The returned token is the only public value passed to the tool.-pub fn mint_prepare_approval(pid: i64, profile: PrepareProfile) -> Result<String, BrowserRefusal> {- validate_profile(&profile)?;- let token = Uuid::new_v4().to_string();- let root = approval_root();- fs::create_dir_all(&root)- .map_err(|error| refusal(format!("could not create approval directory: {error}")))?;- #[cfg(unix)]- {- use std::os::unix::fs::PermissionsExt;- fs::set_permissions(&root, fs::Permissions::from_mode(0o700))- .map_err(|error| refusal(format!("could not restrict approval directory: {error}")))?;- }-- let artifact = IsolatedApprovalArtifact {- schema: "cua-browser-prepare-approval-v1".to_owned(),- token: token.clone(),- pid,- profile,- expires_unix_ms: now_unix_ms()? + MAX_APPROVAL_TTL.as_millis(),- };- let path = artifact_path(&token)?;- let mut options = OpenOptions::new();- options.write(true).create_new(true);- #[cfg(unix)]- {- use std::os::unix::fs::OpenOptionsExt;- options.mode(0o600);- }- let mut file = options- .open(path)- .map_err(|error| refusal(format!("could not create approval artifact: {error}")))?;- let bytes = serde_json::to_vec(&artifact)- .map_err(|error| refusal(format!("could not encode approval artifact: {error}")))?;- file.write_all(&bytes)- .and_then(|_| file.sync_all())- .map_err(|error| refusal(format!("could not persist approval artifact: {error}")))?;- Ok(token)-}--fn persist_artifact<T: Serialize>(token: &str, artifact: &T) -> Result<(), BrowserRefusal> {- let root = approval_root();- fs::create_dir_all(&root)- .map_err(|error| refusal(format!("could not create approval directory: {error}")))?;- #[cfg(unix)]- {- use std::os::unix::fs::PermissionsExt;- fs::set_permissions(&root, fs::Permissions::from_mode(0o700))- .map_err(|error| refusal(format!("could not restrict approval directory: {error}")))?;- }- let path = artifact_path(token)?;- let mut options = OpenOptions::new();- options.write(true).create_new(true);- #[cfg(unix)]- {- use std::os::unix::fs::OpenOptionsExt;- options.mode(0o600);- }- let mut file = options- .open(path)- .map_err(|error| refusal(format!("could not create approval artifact: {error}")))?;- let bytes = serde_json::to_vec(artifact)- .map_err(|error| refusal(format!("could not encode approval artifact: {error}")))?;- file.write_all(&bytes)- .and_then(|_| file.sync_all())- .map_err(|error| refusal(format!("could not persist approval artifact: {error}")))-}--/// Mint a single-use artifact for the exact existing-profile request shown to-/// the person at the interactive approval boundary.-pub fn mint_existing_profile_approval(- scope: ExistingProfileApprovalScope,-) -> Result<String, BrowserRefusal> {- if scope.pid <= 0 || scope.window_id == 0 || scope.session.trim().is_empty() {- return Err(refusal(- "existing-profile approval requires a positive pid/window_id and explicit session",- ));- }- let token = Uuid::new_v4().to_string();- let artifact = ExistingProfileApprovalArtifact {- schema: "cua-browser-existing-profile-approval-v1".to_owned(),- token: token.clone(),- scope,- expires_unix_ms: now_unix_ms()? + MAX_APPROVAL_TTL.as_millis(),- };- persist_artifact(&token, &artifact)?;- Ok(token)-}--/// Consume approval evidence. The artifact is removed before any semantic-/// validation so malformed, mismatched, and expired attempts are single-use.-pub fn consume_prepare_approval(- token: &str,- pid: i64,- profile: &PrepareProfile,-) -> Result<(), BrowserRefusal> {- validate_profile(profile)?;- let path = artifact_path(token)?;- let bytes = fs::read(&path)- .map_err(|_| refusal("browser preparation approval token is missing or expired"))?;- fs::remove_file(&path)- .map_err(|error| refusal(format!("could not consume approval artifact: {error}")))?;- let artifact: IsolatedApprovalArtifact = serde_json::from_slice(&bytes)- .map_err(|_| refusal("browser preparation approval artifact is invalid"))?;- if artifact.schema != "cua-browser-prepare-approval-v1"- || artifact.token != token- || artifact.pid != pid- || artifact.profile != *profile- || artifact.expires_unix_ms < now_unix_ms()?- {- return Err(refusal(- "browser preparation approval does not match this pid/profile request or has expired",- ));- }- Ok(())-}--/// Consume an existing-profile artifact before validating it. A mismatch is-/// deliberately destructive so an artifact can never become a probing oracle.-pub fn consume_existing_profile_approval(- token: &str,- scope: &ExistingProfileApprovalScope,-) -> Result<(), BrowserRefusal> {- let path = artifact_path(token)?;- let bytes = fs::read(&path)- .map_err(|_| refusal("browser preparation approval token is missing or expired"))?;- fs::remove_file(&path)- .map_err(|error| refusal(format!("could not consume approval artifact: {error}")))?;- let artifact: ExistingProfileApprovalArtifact = serde_json::from_slice(&bytes)- .map_err(|_| refusal("browser preparation approval artifact is invalid"))?;- if artifact.schema != "cua-browser-existing-profile-approval-v1"- || artifact.token != token- || artifact.scope != *scope- || artifact.expires_unix_ms < now_unix_ms()?- {- return Err(refusal(- "browser preparation approval does not match this pid/window/session request or has expired",- ));- }- Ok(())-}--#[cfg(test)]-mod tests {- use super::*;-- fn named(name: &str) -> PrepareProfile {- PrepareProfile {- mode: PrepareProfileMode::IsolatedNamed,- name: Some(name.to_owned()),- }- }-- #[test]- fn approval_is_bound_and_single_use() {- let profile = named("approval-test");- let token = mint_prepare_approval(42, profile.clone()).unwrap();- consume_prepare_approval(&token, 42, &profile).unwrap();- assert!(consume_prepare_approval(&token, 42, &profile).is_err());- }-- #[test]- fn mismatch_consumes_the_artifact() {- let profile = named("approval-mismatch");- let token = mint_prepare_approval(42, profile.clone()).unwrap();- assert!(consume_prepare_approval(&token, 7, &profile).is_err());- assert!(consume_prepare_approval(&token, 42, &profile).is_err());- }-- #[test]- fn named_profile_is_path_safe() {- for name in ["", "../Default", "a/b", "with space", "."] {- assert!(validate_profile(&named(name)).is_err(), "accepted {name:?}");- }- validate_profile(&named("research_2026-07")).unwrap();- }-- #[test]- fn existing_profile_approval_is_exact_and_single_use() {- let scope = ExistingProfileApprovalScope {- pid: 42,- window_id: 7,- session: "approval-existing".to_owned(),- };- let token = mint_existing_profile_approval(scope.clone()).unwrap();- consume_existing_profile_approval(&token, &scope).unwrap();- assert!(consume_existing_profile_approval(&token, &scope).is_err());- }-- #[test]- fn existing_profile_mismatch_consumes_artifact() {- let scope = ExistingProfileApprovalScope {- pid: 42,- window_id: 7,- session: "approval-existing-mismatch".to_owned(),- };- let token = mint_existing_profile_approval(scope.clone()).unwrap();- let mut wrong = scope.clone();- wrong.window_id = 8;- assert!(consume_existing_profile_approval(&token, &wrong).is_err());- assert!(consume_existing_profile_approval(&token, &scope).is_err());- }-}diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/mod.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/mod.rsindex 022eb0ad3d..c401844f02 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/mod.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/mod.rs@@ -35,7 +35,6 @@//! is re-proven before any mutation; frames whose identity or//! capability cannot be proven are omitted or refused, never guessed.-pub mod approval;pub mod binding;pub mod cdp_ws;pub mod download;@@ -61,8 +60,8 @@ pub use engine::BrowserEngine;pub use platform::{BrowserConsentOutcome, BrowserConsentRequest, BrowserPlatform, BrowserVisualAction,BrowserVisualActionKind, ExistingProfileSetupOutcome, ExistingProfileSetupRequest,- PrepareAction, PrepareAttachment, PrepareAttachmentKind, PrepareAuthorization, PrepareOutcome,- PrepareProfile, PrepareProfileMode, PrepareRequest, PrepareSideEffects, PrepareStrategy,+ PrepareAction, PrepareAttachment, PrepareAttachmentKind, PrepareOutcome, PrepareProfile,+ PrepareProfileMode, PrepareRequest, PrepareSideEffects, PrepareStrategy,};pub use refusal::{BrowserRefusal, BrowserRefusalCode};pub use setup_descriptor::{diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/platform.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/platform.rsindex 1a42d9c720..8e071f8ae7 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/platform.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/platform.rs@@ -38,12 +38,6 @@ pub enum PrepareStrategy {ExistingProfile,}-#[derive(Debug, Clone, PartialEq, Eq)]-pub enum PrepareAuthorization {- McpHost,- ApprovalArtifact(String),-}-/// Caller context for an explicit `browser_prepare` call. Prepare is never/// implicit: `get_browser_state` must not trigger it.#[derive(Debug, Clone)]@@ -57,7 +51,6 @@ pub struct PrepareRequest {/// this independently from the public capability session so either proxy/// disconnect or explicit `end_session` can reap a spawned browser.pub transport_session: Option<String>,- pub authorization: Option<PrepareAuthorization>,/// Omitted for the legacy isolated-profile compatibility form.pub strategy: Option<PrepareStrategy>,pub profile: Option<PrepareProfile>,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 4155728881..bfde6d2417 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@@ -11,16 +11,12 @@ use std::time::{Duration, Instant};use serde::{Deserialize, Serialize};-use super::approval::{- consume_existing_profile_approval, consume_prepare_approval, validate_profile,- ExistingProfileApprovalScope,-};use super::engine::unsupported_engine_refusal;use super::platform::{BrowserConsentOutcome, BrowserConsentRequest, ExistingProfileSetupOutcome,ExistingProfileSetupRequest, PrepareAction, PrepareAttachment, PrepareAttachmentKind,- PrepareAuthorization, PrepareOutcome, PrepareProfile, PrepareProfileMode, PrepareRequest,- PrepareSideEffects, PrepareStrategy,+ PrepareOutcome, PrepareProfile, PrepareProfileMode, PrepareRequest, PrepareSideEffects,+ PrepareStrategy,};use super::refusal::{BrowserRefusal, BrowserRefusalCode};use super::types::{@@ -31,6 +27,39 @@ use super::BrowserEngine;const PROFILE_MARKER: &str = ".cua-driver-owned-profile.json";const PROFILE_SCHEMA: &str = "cua-driver-browser-profile-v1";+fn validate_profile(profile: &PrepareProfile) -> Result<(), BrowserRefusal> {+ match profile.mode {+ PrepareProfileMode::IsolatedNew => {+ if profile.name.is_some() {+ return Err(refusal(+ BrowserRefusalCode::BrowserConsentRequired,+ "profile.name is not valid with mode=isolated_new",+ ));+ }+ }+ PrepareProfileMode::IsolatedNamed => {+ let Some(name) = profile.name.as_deref() else {+ return Err(refusal(+ BrowserRefusalCode::BrowserConsentRequired,+ "profile.name is required with mode=isolated_named",+ ));+ };+ if name.is_empty()+ || name.len() > 64+ || !name+ .bytes()+ .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_'))+ {+ return Err(refusal(+ BrowserRefusalCode::BrowserConsentRequired,+ "profile.name must be 1-64 ASCII letters, digits, '-' or '_'",+ ));+ }+ }+ }+ Ok(())+}+async fn claim_with_optional_consent<T, Claim, Consent>(claim: &mut Pin<Box<Claim>>,consent: Consent,@@ -670,19 +699,6 @@ impl BrowserEngine {)})?;validate_profile(profile_request)?;- match request.authorization.as_ref() {- Some(PrepareAuthorization::McpHost) => {}- Some(PrepareAuthorization::ApprovalArtifact(token)) => {- consume_prepare_approval(token, request.pid, profile_request)?;- }- None => {- return Err(refusal(- BrowserRefusalCode::BrowserConsentRequired,- "browser preparation needs MCP host approval or a fresh browser-approve token",- ))- }- }-let classification = self.platform.classify_browser(request.pid).await?;if !classification.supports_cdp || classification.engine != BrowserEngineFamily::Chromium {return Err(unsupported_engine_refusal(@@ -769,7 +785,6 @@ impl BrowserEngine {Protected,BoundedManifest,LaunchGrant,- LegacyArtifact,Unrestricted,}@@ -779,11 +794,6 @@ impl BrowserEngine {"strategy=existing_profile requires an exact window_id approval anchor",)})?;- let scope = ExistingProfileApprovalScope {- pid: request.pid,- window_id,- session: request.session.clone(),- };let mode = crate::tool::current_dispatch_authorization_context().map(|context| context.mode()).map(Ok)@@ -824,27 +834,6 @@ impl BrowserEngine {ConsentPath::LaunchGrant} else if self.approval_broker.provider_id().is_some() {ConsentPath::Protected- } else if crate::authorization::legacy_existing_profile_approval_enabled() {- match request.authorization.as_ref() {- Some(PrepareAuthorization::ApprovalArtifact(token)) => {- consume_existing_profile_approval(token, &scope)?;- ConsentPath::LegacyArtifact- }- // The ordinary MCP destructive-tool marker proves transport- // provenance, not a person's approval of their authenticated- // profile. It is deliberately insufficient here.- Some(PrepareAuthorization::McpHost) | None => {- return Err(refusal(- BrowserRefusalCode::BrowserConsentRequired,- "legacy existing-profile compatibility requires a fresh operation-bound browser-approve artifact",- )- .with_detail(serde_json::json!({- "approval_request_id": uuid::Uuid::new_v4().to_string(),- "approval_command": "cua-driver browser-approve --strategy existing_profile --pid <pid> --window-id <window_id> --session <session>",- "legacy_approval_enabled": true,- })));- }- }} else {return Err(refusal(BrowserRefusalCode::BrowserConsentRequired,@@ -853,7 +842,6 @@ impl BrowserEngine {.with_detail(serde_json::json!({"permission_mode": mode.as_str(),"authorization_required": true,- "legacy_approval_enabled": false,"authorization_host": self.approval_broker.provider_id(),})));};diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/tools.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/tools.rsindex 60ea062159..b787a24d76 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/tools.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/tools.rs@@ -14,13 +14,10 @@ use crate::protocol::{Content, ToolResult};use crate::tool::{ProtectedResourceOwnership, Tool, ToolDef, ToolRegistry};use crate::tool_args::ArgsExt;-use super::approval::MCP_HOST_APPROVAL_ARG;use super::cdp_ws::CdpConnection;use super::download::BrowserDownloadTool;use super::engine::{BrowserEngine, BrowserTabScreenshot};-use super::platform::{- BrowserVisualActionKind, PrepareAuthorization, PrepareProfile, PrepareRequest, PrepareStrategy,-};+use super::platform::{BrowserVisualActionKind, PrepareProfile, PrepareRequest, PrepareStrategy};use super::pointer::BrowserPointerTool;use super::refusal::{BrowserRefusal, BrowserRefusalCode};use super::session_schema as schema_session;@@ -586,8 +583,8 @@ impl BrowserPrepareTool {name: "browser_prepare".into(),description: "Explicitly prepare an owned DevTools endpoint for a browser \pid. Existing endpoints are detected without side effects. Acting setup \- for an isolated profile requires host approval or a short-lived setup \- token plus allow_launch=true. It launches a separate browser and never \+ for an isolated profile follows the runtime permission mode and optional \+ capability manifest. It requires allow_launch=true, launches a separate browser, and never \copies, modifies, or terminates the requested user profile. Existing-profile \attachment is explicit and follows the runtime's immutable permission mode: \standard requires an explicit --grant existing-profile launch grant or an \@@ -605,10 +602,6 @@ impl BrowserPrepareTool {"properties": {"pid": { "type": "integer", "description": "Browser process id to prepare." },"window_id": { "type": "integer", "description": "Exact native window approval anchor; required for strategy.kind=existing_profile." },- "approval_token": {- "type": "string",- "description": "Legacy single-use setup token. Existing-profile use is disabled unless a trusted launcher explicitly enables the same-user-writable compatibility path."- },"allow_launch": {"type": "boolean","description": "Allow a separate driver-owned isolated Chromium process to be launched (default false)."@@ -679,24 +672,11 @@ impl Tool for BrowserPrepareTool {}},};- let approval_token = args.opt_str("approval_token");- let authorization = if strategy == Some(PrepareStrategy::ExistingProfile) {- approval_token.map(PrepareAuthorization::ApprovalArtifact)- } else if args- .get(MCP_HOST_APPROVAL_ARG)- .and_then(Value::as_bool)- .unwrap_or(false)- {- Some(PrepareAuthorization::McpHost)- } else {- approval_token.map(PrepareAuthorization::ApprovalArtifact)- };let request = PrepareRequest {pid,window_id: args.opt_u64("window_id"),session,transport_session: args.opt_str("_transport_session_id"),- authorization,strategy,profile,allow_launch: args.opt_bool("allow_launch").unwrap_or(false),@@ -2617,7 +2597,7 @@ mod tests {.expect("browser_prepare properties");assert!(!prepare_properties.contains_key("consent"));assert!(!prepare_properties.contains_key("allow_restart"));- assert!(!prepare_properties.contains_key(MCP_HOST_APPROVAL_ARG));+ assert!(!prepare_properties.contains_key("approval_token"));let dialog = BrowserDialogTool::new(e.clone());assert_eq!(@@ -2826,7 +2806,7 @@ mod tests {}#[tokio::test]- async fn prepare_requires_non_forgeable_approval_for_acting_setup() {+ async fn isolated_prepare_uses_runtime_authorization_without_a_token() {let tool = BrowserPrepareTool::new(engine());let result = tool.invoke(json!({@@ -2838,47 +2818,38 @@ mod tests {.await;assert_eq!(structured(&result)["refusal"]["code"],- "browser_consent_required"+ "browser_route_unavailable");}#[tokio::test]- async fn ordinary_mcp_marker_never_approves_an_existing_profile() {+ async fn existing_profile_requires_runtime_authorization() {let tool = BrowserPrepareTool::new(engine());let result = tool.invoke(json!({"pid": 1,"window_id": 7,"strategy": { "kind": "existing_profile" },- "session": "existing-profile-run",- MCP_HOST_APPROVAL_ARG: true+ "session": "existing-profile-run"})).await;let structured = structured(&result);assert_eq!(structured["refusal"]["code"], "browser_consent_required");- assert!(structured["refusal"]["detail"]["approval_request_id"]- .as_str()- .is_some());+ assert_eq!(+ structured["refusal"]["detail"]["authorization_required"],+ true+ );}#[tokio::test]async fn existing_strategy_conflicts_fail_before_platform_setup() {let tool = BrowserPrepareTool::new(engine());- let token = crate::browser::approval::mint_existing_profile_approval(- crate::browser::approval::ExistingProfileApprovalScope {- pid: 1,- window_id: 7,- session: "existing-conflict".to_owned(),- },- )- .unwrap();let result = tool.invoke(json!({"pid": 1,"window_id": 7,"strategy": { "kind": "existing_profile" },"profile": { "mode": "isolated_new" },- "approval_token": token,"session": "existing-conflict"})).await;diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/v2_tests.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/v2_tests.rsindex 1c7b507f0c..032d2b6cbd 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/browser/v2_tests.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/browser/v2_tests.rs@@ -886,27 +886,6 @@ async fn fixture() -> Fixture {fixture_with(|_| {}).await}-async fn existing_profile_only_fixture() -> Fixture {- let state = Arc::new(StdMutex::new(FixtureState::default()));- let server = MockCdpServer::start(fixture_handler(state.clone())).await;- let setup_invoked = Arc::new(AtomicBool::new(false));- let engine = BrowserEngine::new(Arc::new(FixturePlatform {- ws_url: server.ws_url(),- trusted_input_limited: false,- managed_endpoint_visible: false,- existing_endpoint_visible: Arc::new(AtomicBool::new(true)),- setup_invoked: setup_invoked.clone(),- setup_aborted: Arc::new(AtomicBool::new(false)),- stall_consent: false,- }));- Fixture {- state,- _server: server,- engine,- setup_invoked,- }-}-struct FixtureProtectedProvider {consent_seen: AtomicBool,}@@ -963,15 +942,20 @@ async fn existing_profile_setup_fixture() -> (Fixture, Arc<AtomicBool>) {let state = Arc::new(StdMutex::new(FixtureState::default()));let server = MockCdpServer::start(fixture_handler(state.clone())).await;let setup_invoked = Arc::new(AtomicBool::new(false));- let engine = BrowserEngine::new(Arc::new(FixturePlatform {- ws_url: server.ws_url(),- trusted_input_limited: false,- managed_endpoint_visible: false,- existing_endpoint_visible: Arc::new(AtomicBool::new(false)),- setup_invoked: setup_invoked.clone(),- setup_aborted: Arc::new(AtomicBool::new(false)),- stall_consent: false,- }));+ let engine = BrowserEngine::new_with_protected_consent_provider(+ Arc::new(FixturePlatform {+ ws_url: server.ws_url(),+ trusted_input_limited: false,+ managed_endpoint_visible: false,+ existing_endpoint_visible: Arc::new(AtomicBool::new(false)),+ setup_invoked: setup_invoked.clone(),+ setup_aborted: Arc::new(AtomicBool::new(false)),+ stall_consent: false,+ }),+ Some(Arc::new(FixtureProtectedProvider {+ consent_seen: AtomicBool::new(false),+ })),+ );(Fixture {state,@@ -1009,23 +993,14 @@ async fn bind(f: &Fixture) -> (String, String) {async fn approved_existing_profile_attach_claims_then_binds_one_generation() {// Match Chrome's per-instance toggle: the endpoint is discoverable only// through the approved existing-profile route, never as driver-managed.- let f = existing_profile_only_fixture().await;- let token = super::approval::mint_existing_profile_approval(- super::approval::ExistingProfileApprovalScope {- pid: 1,- window_id: 7,- session: SESSION.to_owned(),- },- )- .unwrap();+ let (f, provider) = protected_existing_profile_fixture().await;let prepare = BrowserPrepareTool::new(f.engine.clone()).invoke(json!({"pid": 1,"window_id": 7,"session": SESSION,"_transport_session_id": "transport-v2-attach",- "strategy": { "kind": "existing_profile" },- "approval_token": token+ "strategy": { "kind": "existing_profile" }})).await;let prepared = structured(&prepare);@@ -1034,6 +1009,7 @@ async fn approved_existing_profile_attach_claims_then_binds_one_generation() {assert_eq!(prepared["attachment"]["kind"], "existing_profile");assert_eq!(prepared["attachment"]["capabilities_invalidated"], true);assert_eq!(prepared["side_effects"]["displayed_consent_prompt"], false);+ assert!(provider.consent_seen.load(Ordering::SeqCst));assert!(!f.setup_invoked.load(Ordering::SeqCst));let state = GetBrowserStateTool::new(f.engine.clone())@@ -1087,21 +1063,12 @@ async fn protected_provider_accepts_exact_attach_and_session_end_revokes_the_gra#[tokio::test]async fn approved_existing_profile_setup_reports_exact_side_effects() {let (f, setup_invoked) = existing_profile_setup_fixture().await;- let token = super::approval::mint_existing_profile_approval(- super::approval::ExistingProfileApprovalScope {- pid: 1,- window_id: 7,- session: SESSION.to_owned(),- },- )- .unwrap();let prepare = BrowserPrepareTool::new(f.engine.clone()).invoke(json!({"pid": 1,"window_id": 7,"session": SESSION,- "strategy": { "kind": "existing_profile" },- "approval_token": token+ "strategy": { "kind": "existing_profile" }})).await;let prepared = structured(&prepare);@@ -1134,31 +1101,27 @@ async fn refused_consent_cancels_stalled_claim_before_revoking_grant() {let (_stream, _) = listener.accept().await.unwrap();tokio::time::sleep(std::time::Duration::from_secs(10)).await;});- let engine = BrowserEngine::new(Arc::new(FixturePlatform {- ws_url: format!("ws://{address}/devtools/browser"),- trusted_input_limited: false,- managed_endpoint_visible: false,- existing_endpoint_visible: Arc::new(AtomicBool::new(false)),- setup_invoked: Arc::new(AtomicBool::new(false)),- setup_aborted: Arc::new(AtomicBool::new(false)),- stall_consent: false,- }));- let token = super::approval::mint_existing_profile_approval(- super::approval::ExistingProfileApprovalScope {- pid: 1,- window_id: 7,- session: SESSION.to_owned(),- },- )- .unwrap();+ let engine = BrowserEngine::new_with_protected_consent_provider(+ Arc::new(FixturePlatform {+ ws_url: format!("ws://{address}/devtools/browser"),+ trusted_input_limited: false,+ managed_endpoint_visible: false,+ existing_endpoint_visible: Arc::new(AtomicBool::new(false)),+ setup_invoked: Arc::new(AtomicBool::new(false)),+ setup_aborted: Arc::new(AtomicBool::new(false)),+ stall_consent: false,+ }),+ Some(Arc::new(FixtureProtectedProvider {+ consent_seen: AtomicBool::new(false),+ })),+ );let prepared = tokio::time::timeout(std::time::Duration::from_secs(3),BrowserPrepareTool::new(engine).invoke(json!({"pid": 1,"window_id": 7,"session": SESSION,- "strategy": { "kind": "existing_profile" },- "approval_token": token+ "strategy": { "kind": "existing_profile" }})),).await@@ -1180,31 +1143,27 @@ async fn cancelled_prepare_aborts_the_exact_pending_setup() {tokio::time::sleep(std::time::Duration::from_secs(10)).await;});let setup_aborted = Arc::new(AtomicBool::new(false));- let engine = BrowserEngine::new(Arc::new(FixturePlatform {- ws_url: format!("ws://{address}/devtools/browser"),- trusted_input_limited: false,- managed_endpoint_visible: false,- existing_endpoint_visible: Arc::new(AtomicBool::new(false)),- setup_invoked: Arc::new(AtomicBool::new(false)),- setup_aborted: setup_aborted.clone(),- stall_consent: true,- }));- let token = super::approval::mint_existing_profile_approval(- super::approval::ExistingProfileApprovalScope {- pid: 1,- window_id: 7,- session: SESSION.to_owned(),- },- )- .unwrap();+ let engine = BrowserEngine::new_with_protected_consent_provider(+ Arc::new(FixturePlatform {+ ws_url: format!("ws://{address}/devtools/browser"),+ trusted_input_limited: false,+ managed_endpoint_visible: false,+ existing_endpoint_visible: Arc::new(AtomicBool::new(false)),+ setup_invoked: Arc::new(AtomicBool::new(false)),+ setup_aborted: setup_aborted.clone(),+ stall_consent: true,+ }),+ Some(Arc::new(FixtureProtectedProvider {+ consent_seen: AtomicBool::new(false),+ })),+ );let cancelled = tokio::time::timeout(std::time::Duration::from_millis(750),BrowserPrepareTool::new(engine).invoke(json!({"pid": 1,"window_id": 7,"session": SESSION,- "strategy": { "kind": "existing_profile" },- "approval_token": token+ "strategy": { "kind": "existing_profile" }})),).await;diff --git a/libs/cua-driver/rust/crates/cua-driver-core/src/server.rs b/libs/cua-driver/rust/crates/cua-driver-core/src/server.rsindex c59ec38f3a..30b31c3f62 100644--- a/libs/cua-driver/rust/crates/cua-driver-core/src/server.rs+++ b/libs/cua-driver/rust/crates/cua-driver-core/src/server.rs@@ -918,14 +918,6 @@ async fn handle_request_inner();}}- if call.name == "browser_prepare" {- if let Some(arguments) = call.args.as_object_mut() {- arguments.insert(- crate::browser::approval::MCP_HOST_APPROVAL_ARG.to_owned(),- serde_json::Value::Bool(true),- );- }- }if call.name == "browser_download" {if let Some(arguments) = call.args.as_object_mut() {arguments.insert(@@ -1216,8 +1208,7 @@ mod observation_tests {("browser_prepare",serde_json::json!({- "strategy": {"kind": "existing_profile"},- "approval_token": "private-token"+ "strategy": {"kind": "existing_profile"}}),ToolOperation::BrowserPrepareExistingProfile,),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 f5815a3eae..8c83a3ec2c 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@@ -520,7 +520,6 @@ impl Drop for RuntimeCleanup {pub struct TrustedInvocationEvidence {session_id: Option<String>,transport_session_id: Option<String>,- browser_prepare_mcp_host_approved: bool,browser_download_mcp_host_approved: bool,}@@ -537,10 +536,6 @@ impl TrustedInvocationEvidence {.remove("_transport_session_id").and_then(|value| value.as_str().map(str::to_owned)).filter(|value| !value.is_empty());- evidence.browser_prepare_mcp_host_approved = arguments- .remove(crate::browser::approval::MCP_HOST_APPROVAL_ARG)- .and_then(|value| value.as_bool())- == Some(true);evidence.browser_download_mcp_host_approved = arguments.remove(crate::browser::download::MCP_HOST_DOWNLOAD_APPROVAL_ARG).and_then(|value| value.as_bool())@@ -563,12 +558,6 @@ impl TrustedInvocationEvidence {Value::String(session.clone()),);}- if self.browser_prepare_mcp_host_approved {- arguments.insert(- crate::browser::approval::MCP_HOST_APPROVAL_ARG.to_owned(),- Value::Bool(true),- );- }if self.browser_download_mcp_host_approved {arguments.insert(crate::browser::download::MCP_HOST_DOWNLOAD_APPROVAL_ARG.to_owned(),@@ -3962,7 +3951,6 @@ resources:"session": "public","_session_id": "trusted-owner","_transport_session_id": "transport-a",- "_cua_browser_prepare_mcp_host_approved": true,"_cua_browser_download_mcp_host_approved": true,"_protected_process_fingerprint": {"pid": 1},"files": ["/does/not/matter"]@@ -3993,10 +3981,6 @@ resources:.get("_transport_session_id").and_then(serde_json::Value::as_str).is_some_and(|value| value.ends_with(":transport-a")));- assert_eq!(- received["_cua_browser_prepare_mcp_host_approved"],- serde_json::Value::Bool(true)- );assert_eq!(received["_cua_browser_download_mcp_host_approved"],serde_json::Value::Bool(true)@@ -4442,13 +4426,6 @@ fn recording_args_for(tool_name: &str, args: &Value) -> Value {if let Some(arguments) = redacted.as_object_mut() {match tool_name {"browser_prepare" => {- if arguments.contains_key("approval_token") {- arguments.insert(- "approval_token".to_owned(),- Value::String("[redacted]".to_owned()),- );- }- arguments.remove("_cua_browser_prepare_mcp_host_approved");arguments.remove("_transport_session_id");}"browser_dialog" => {@@ -4553,7 +4530,7 @@ mod capability_tests {use super::*;#[test]- fn browser_prepare_recording_redacts_authority_and_transport_secrets() {+ fn browser_prepare_recording_redacts_transport_identity() {let recorded = recording_args_for("browser_prepare",&serde_json::json!({@@ -4561,15 +4538,9 @@ mod capability_tests {"window_id": 7,"session": "public-session","strategy": {"kind": "existing_profile"},- "approval_token": "one-use-secret",- "_cua_browser_prepare_mcp_host_approved": true,"_transport_session_id": "private-transport",}),);- assert_eq!(recorded["approval_token"], "[redacted]");- assert!(recorded- .get("_cua_browser_prepare_mcp_host_approved")- .is_none());assert!(recorded.get("_transport_session_id").is_none());assert_eq!(recorded["pid"], 42);assert_eq!(recorded["window_id"], 7);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 38b120ab69..8f40c8ba02 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@@ -9,8 +9,7 @@ use crate::runtime::{DriverRuntime, RuntimeCreateError, RuntimeOptions, RuntimeSuse crate::{DriverError, DriverMetadata};use cua_driver_core::{authorization::{- PermissionMode, DANGEROUS_BYPASS_ENV, DISABLE_UNRESTRICTED_ENV,- LEGACY_EXISTING_PROFILE_APPROVAL_ENV, PERMISSION_MODE_ENV,+ PermissionMode, DANGEROUS_BYPASS_ENV, DISABLE_UNRESTRICTED_ENV, PERMISSION_MODE_ENV,},session_authorization::{DelegatedSessionRequest, SessionModeCeiling},session_manifest::{@@ -251,13 +250,6 @@ fn validate_explicit_authorization_sources());}- if environment_flag(LEGACY_EXISTING_PROFILE_APPROVAL_ENV) {- return Err(AbiFailure::new(- CuaDriverStatus::InvalidArgument,- "explicit runtime authorization conflicts with the legacy existing-profile approval escape hatch",- ));- }-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()diff --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 9597aae8cf..aa1aa8d307 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@@ -861,7 +861,6 @@ pub(crate) fn inherited_managed_environment_name(name: &str) -> bool {"CUA_DRIVER_PERMISSION_MODE"| "CUA_DRIVER_DANGEROUSLY_BYPASS_APPROVALS"| "CUA_DRIVER_DISABLE_UNRESTRICTED"- | "CUA_DRIVER_ALLOW_LEGACY_EXISTING_PROFILE_APPROVAL"| "CUA_DRIVER_SESSION_POLICY_FILE"| "CUA_DRIVER_SESSION_POLICY_APPROVED"| "CUA_DRIVER_CAPABILITY_MANIFEST_FILE"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 e388a44f29..9be141bf31 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@@ -34,9 +34,6 @@ fn child_configuration_probe() {SessionPermissionMode::Standard,SessionPermissionMode::Unrestricted,])),- "legacy_approval" => {- CuaDriver::create_configured(options(vec![SessionPermissionMode::Standard]))- }other => panic!("unknown probe case {other}"),};@@ -46,7 +43,7 @@ fn child_configuration_probe() {panic!("matching environment was rejected: {error}");}}- "conflicting_mode" | "managed_disable" | "legacy_approval" => {+ "conflicting_mode" | "managed_disable" => {assert!(result.is_err(), "contradictory environment was accepted")}_ => unreachable!(),@@ -61,7 +58,6 @@ fn run_probe(case: &str, environment: &[(&str, &str)]) {.env_remove("CUA_DRIVER_PERMISSION_MODE").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")@@ -92,8 +88,4 @@ fn explicit_runtime_configuration_rejects_contradictory_environment() {"managed_disable",&[("CUA_DRIVER_DISABLE_UNRESTRICTED", "1")],);- run_probe(- "legacy_approval",- &[("CUA_DRIVER_ALLOW_LEGACY_EXISTING_PROFILE_APPROVAL", "1")],- );}diff --git a/libs/cua-driver/rust/crates/cua-driver-testkit/src/e2e.rs b/libs/cua-driver/rust/crates/cua-driver-testkit/src/e2e.rsindex 848a7607da..eb07f5c804 100644--- a/libs/cua-driver/rust/crates/cua-driver-testkit/src/e2e.rs+++ b/libs/cua-driver/rust/crates/cua-driver-testkit/src/e2e.rs@@ -2162,7 +2162,6 @@ mod tests {br#"{"tool":"browser_prepare","arguments":{- "approval_token":"[redacted]","pid":1,"window_id":2,"strategy":{"kind":"existing_profile"}diff --git a/libs/cua-driver/rust/crates/cua-driver/src/cli.rs b/libs/cua-driver/rust/crates/cua-driver/src/cli.rsindex 7875e34569..eb9693c25e 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/cli.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/cli.rs@@ -55,9 +55,6 @@ pub enum Command {permission_mode: Option<String>,/// Deliberate unrestricted-mode selector and risk acknowledgement.dangerously_bypass_approvals: bool,- /// Temporary trusted-launcher compatibility path for the forgeable- /// file-backed existing-profile approval artifact.- allow_legacy_existing_profile_approval: bool,/// Immutable narrow-only capability manifest selected by the trusted/// launcher. Required in bounded mode and optional in other profiles.capability_manifest: Option<String>,@@ -188,16 +185,6 @@ pub enum Command {CursorTheme {args: Vec<String>,},- /// Mint a short-lived, single-use approval token for a direct/raw- /// `browser_prepare` call. This command requires an interactive terminal.- BrowserApprove {- pid: i64,- strategy: Option<String>,- window_id: Option<u64>,- session: Option<String>,- profile_mode: Option<String>,- profile_name: Option<String>,- },}pub enum TelemetryCommand {@@ -251,7 +238,6 @@ const SERVE_ONLY_AUTHORIZATION_FLAGS: &[&str] = &["--session-policy","--approve-session-policy","--dangerously-bypass-approvals",- "--allow-legacy-existing-profile-approval","--no-permissions-gate",];@@ -321,7 +307,6 @@ fn finite_command_name_from_args(args: &[String]) -> Option<&'static str> {Some("autostart") => Some("autostart"),Some("skills") => Some("skills"),Some("cursor-theme") => Some("cursor_theme"),- Some("browser-approve") => Some("browser_approve"),Some("config") => Some("config"),Some(_) => Some("call"),}@@ -483,7 +468,7 @@ pub fn parse_command() -> Command {env!("CARGO_PKG_VERSION"));println!("Usage: cua-driver [SUBCOMMAND] [OPTIONS]");- println!("Subcommands: mcp, list-tools, describe, call, serve, stop, revoke, status, config, telemetry, recording, update, check-update, doctor, diagnose, permissions, autostart, skills, browser-approve, manifest, channel, cursor-theme, sessions");+ println!("Subcommands: mcp, list-tools, describe, call, serve, stop, revoke, status, config, telemetry, recording, update, check-update, doctor, diagnose, permissions, autostart, skills, manifest, channel, cursor-theme, sessions");println!();println!("permissions options (macOS):");println!(" cua-driver permissions status Report Accessibility + Screen Recording status. Read-only (no prompt).");@@ -524,16 +509,6 @@ pub fn parse_command() -> Command {println!(" cua-driver skills path Print where the local skill pack lives.");println!(" --from main (install only) Fetch latest from main branch instead of the tagged release.");println!();- println!("browser preparation approval:");- println!(" cua-driver browser-approve --pid <pid> --profile-mode isolated_new");- println!(" cua-driver browser-approve --pid <pid> --profile-mode isolated_named --profile-name <name>");- println!(" Interactively mint a five-minute, single-use token for a");- println!(" direct CLI/raw browser_prepare call. MCP hosts use their");- println!(" destructive-tool approval flow instead.");- println!(" cua-driver browser-approve --strategy existing_profile --pid <pid>");- println!(" --window-id <window_id> --session <session>");- println!(" Approve attachment to one exact existing browser request.");- println!();println!("agent authorization (serve only):");println!(" --permission-mode <mode> standard (default), bounded, or unrestricted.");println!(@@ -545,9 +520,6 @@ pub fn parse_command() -> Command {);println!(" The mode is fixed for the daemon lifetime and cannot");println!(" be changed by a tool call.");- println!(" --allow-legacy-existing-profile-approval");- println!(" Temporary migration flag for the forgeable file-backed");- println!(" approval artifact; never treated as protected consent.");println!(" This is separate from --no-permissions-gate, which only");println!(" controls the macOS OS-permission onboarding UI."@@ -657,12 +629,7 @@ pub fn parse_command() -> Command {let screenshot_out_file = flag_value(&args, "--screenshot-out-file");let mcp_client = flag_value(&args, "--client");let socket = flag_value(&args, "--socket");- let approval_pid = flag_value(&args, "--pid");- let approval_strategy = flag_value(&args, "--strategy");- let approval_window_id = flag_value(&args, "--window-id");let approval_session = flag_value(&args, "--session");- let approval_profile_mode = flag_value(&args, "--profile-mode");- let approval_profile_name = flag_value(&args, "--profile-name");let grants = flag_values(&args, "--grant");// `--embedded` / `--host-bundle-id` export to the environment rather@@ -755,9 +722,6 @@ pub fn parse_command() -> Command {dangerously_bypass_approvals: args.iter().any(|a| a == "--dangerously-bypass-approvals"),- allow_legacy_existing_profile_approval: args- .iter()- .any(|a| a == "--allow-legacy-existing-profile-approval"),capability_manifest: aliased_flag_value(&args,"--capability-manifest",@@ -970,24 +934,6 @@ pub fn parse_command() -> Command {args: args[index + 1..].to_vec(),}}- Some("browser-approve") => {- let pid = approval_pid- .as_deref()- .and_then(|value| value.parse::<i64>().ok())- .filter(|pid| *pid > 0)- .unwrap_or_else(|| {- eprintln!("browser-approve requires --pid <positive integer>");- process::exit(64);- });- Command::BrowserApprove {- pid,- strategy: approval_strategy,- window_id: approval_window_id.and_then(|value| value.parse::<u64>().ok()),- session: approval_session,- profile_mode: approval_profile_mode,- profile_name: approval_profile_name,- }- }Some(first) => {// Implicit call: unrecognised first positional → treat as tool name.// Same parse-error handling as the explicit `call` branch above. See #1637.@@ -1024,114 +970,6 @@ pub fn parse_command() -> Command {}}-pub fn run_browser_approve(- pid: i64,- strategy: Option<&str>,- window_id: Option<u64>,- session: Option<&str>,- profile_mode: Option<&str>,- profile_name: Option<&str>,-) {- use std::io::{IsTerminal as _, Write as _};-- if !std::io::stdin().is_terminal() || !std::io::stderr().is_terminal() {- eprintln!("browser-approve requires an interactive terminal; approval cannot be piped or scripted");- process::exit(1);- }- if let Some(strategy) = strategy {- if strategy != "existing_profile" {- eprintln!("unsupported browser approval strategy {strategy:?}; use existing_profile");- process::exit(64);- }- if profile_mode.is_some() || profile_name.is_some() {- eprintln!("--strategy existing_profile cannot be combined with profile flags");- process::exit(64);- }- let Some(window_id) = window_id.filter(|window_id| *window_id > 0) else {- eprintln!("existing-profile approval requires --window-id <positive integer>");- process::exit(64);- };- let Some(session) = session.filter(|session| !session.trim().is_empty()) else {- eprintln!("existing-profile approval requires --session <explicit session>");- process::exit(64);- };- eprintln!("Approve CUA Driver to attach to this existing Chromium profile?");- eprintln!(" browser pid: {pid}");- eprintln!(" native window id: {window_id}");- eprintln!(" caller session: {session}");- eprintln!(- "This grant stays in daemon memory, expires, and never authorizes arbitrary dialogs."- );- eprint!("Type APPROVE to continue: ");- let _ = std::io::stderr().flush();- let mut confirmation = String::new();- if std::io::stdin().read_line(&mut confirmation).is_err()- || confirmation.trim() != "APPROVE"- {- eprintln!("browser attachment approval declined; no artifact was created");- process::exit(1);- }- let scope = cua_driver_core::browser::approval::ExistingProfileApprovalScope {- pid,- window_id,- session: session.to_owned(),- };- match cua_driver_core::browser::approval::mint_existing_profile_approval(scope) {- Ok(token) => println!("{token}"),- Err(error) => {- eprintln!("{}", error.message);- process::exit(1);- }- }- return;- }- if window_id.is_some() || session.is_some() {- eprintln!("--window-id/--session require --strategy existing_profile");- process::exit(64);- }- let profile_mode = profile_mode.unwrap_or_else(|| {- eprintln!("browser-approve requires --profile-mode isolated_new|isolated_named");- process::exit(64);- });- let mode = match profile_mode {- "isolated_new" => cua_driver_core::browser::PrepareProfileMode::IsolatedNew,- "isolated_named" => cua_driver_core::browser::PrepareProfileMode::IsolatedNamed,- other => {- eprintln!("unsupported profile mode {other:?}; use isolated_new or isolated_named");- process::exit(64);- }- };- let profile = cua_driver_core::browser::PrepareProfile {- mode,- name: profile_name.map(str::to_owned),- };- if let Err(error) = cua_driver_core::browser::approval::validate_profile(&profile) {- eprintln!("{}", error.message);- process::exit(64);- }- eprintln!("Approve CUA Driver to launch a separate driver-owned Chromium profile?");- eprintln!(" source pid: {pid}");- eprintln!(" profile mode: {profile_mode}");- if let Some(name) = profile_name {- eprintln!(" profile name: {name}");- }- eprintln!("The existing browser process and its profile will not be modified or terminated.");- eprint!("Type APPROVE to continue: ");- let _ = std::io::stderr().flush();- let mut confirmation = String::new();- if std::io::stdin().read_line(&mut confirmation).is_err() || confirmation.trim() != "APPROVE" {- eprintln!("browser preparation approval declined; no artifact was created");- process::exit(1);- }- match cua_driver_core::browser::approval::mint_prepare_approval(pid, profile) {- Ok(token) => println!("{token}"),- Err(error) => {- eprintln!("{}", error.message);- process::exit(1);- }- }-}-/// Return the value of `--flag value` from argv, or `None`.fn flag_value(args: &[String], flag: &str) -> Option<String> {let mut it = args.iter();@@ -1589,7 +1427,6 @@ pub fn build_manifest() -> serde_json::Value {{ "name": "--permission-mode", "type": "string", "description": "Immutable daemon authorization mode: standard, bounded, or unrestricted." },{ "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": "--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." },@@ -3291,7 +3128,6 @@ fn cli_docs_json() -> serde_json::Value {],"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-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},diff --git a/libs/cua-driver/rust/crates/cua-driver/src/main.rs b/libs/cua-driver/rust/crates/cua-driver/src/main.rsindex 91ced04596..a28e69454c 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/main.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/main.rs@@ -48,7 +48,6 @@ fn init_logging() {fn configure_startup_permission_mode(permission_mode: Option<&str>,dangerously_bypass_approvals: bool,- allow_legacy_existing_profile_approval: bool,capability_manifest: Option<&str>,approve_capability_manifest: bool,grants: &[String],@@ -70,12 +69,6 @@ fn configure_startup_permission_mode(if dangerously_bypass_approvals {std::env::set_var(cua_driver_core::authorization::DANGEROUS_BYPASS_ENV, "1");}- if allow_legacy_existing_profile_approval {- std::env::set_var(- cua_driver_core::authorization::LEGACY_EXISTING_PROFILE_APPROVAL_ENV,- "1",- );- }if let Some(path) = capability_manifest {std::env::set_var(cua_driver_core::session_manifest::CAPABILITY_MANIFEST_FILE_ENV,@@ -512,7 +505,6 @@ fn main() {socket,permission_mode,dangerously_bypass_approvals,- allow_legacy_existing_profile_approval,capability_manifest,approve_capability_manifest,no_permissions_gate,@@ -522,7 +514,6 @@ fn main() {if let Err(error) = configure_startup_permission_mode(permission_mode.as_deref(),dangerously_bypass_approvals,- allow_legacy_existing_profile_approval,capability_manifest.as_deref(),approve_capability_manifest,&grants,@@ -758,23 +749,6 @@ fn main() {cli::Command::CursorTheme { args } => {run_cursor_theme_command(&args);}- cli::Command::BrowserApprove {- pid,- strategy,- window_id,- session,- profile_mode,- profile_name,- } => {- cli::run_browser_approve(- pid,- strategy.as_deref(),- window_id,- session.as_deref(),- profile_mode.as_deref(),- profile_name.as_deref(),- );- }cli::Command::Config {subcommand,key,@@ -801,7 +775,7 @@ fn main() {let result = match mcp_uses_direct_runtime(socket.as_deref(), direct) {Ok(true) => {if let Err(error) =- configure_startup_permission_mode(None, false, false, None, false, &grants)+ configure_startup_permission_mode(None, false, None, false, &grants){Err(error)} else {@@ -904,7 +878,6 @@ fn main() -> anyhow::Result<()> {socket,permission_mode,dangerously_bypass_approvals,- allow_legacy_existing_profile_approval,capability_manifest,approve_capability_manifest,no_permissions_gate,@@ -914,7 +887,6 @@ fn main() -> anyhow::Result<()> {configure_startup_permission_mode(permission_mode.as_deref(),dangerously_bypass_approvals,- allow_legacy_existing_profile_approval,capability_manifest.as_deref(),approve_capability_manifest,&grants,@@ -1033,24 +1005,6 @@ fn main() -> anyhow::Result<()> {cli::Command::CursorTheme { args } => {run_cursor_theme_command(&args);}- cli::Command::BrowserApprove {- pid,- strategy,- window_id,- session,- profile_mode,- profile_name,- } => {- cli::run_browser_approve(- pid,- strategy.as_deref(),- window_id,- session.as_deref(),- profile_mode.as_deref(),- profile_name.as_deref(),- );- return Ok(());- }cli::Command::Config {subcommand,key,@@ -1077,7 +1031,7 @@ fn main() -> anyhow::Result<()> {version_check::maybe_announce_update();let result = match mcp_uses_direct_runtime(socket.as_deref(), direct) {Ok(true) => {- configure_startup_permission_mode(None, false, false, None, false, &grants)?;+ configure_startup_permission_mode(None, false, None, false, &grants)?;telemetry::capture_mcp_startup_completed("sdk_owned_runtime","not_applicable",diff --git a/libs/cua-driver/rust/crates/cua-driver/src/serve.rs b/libs/cua-driver/rust/crates/cua-driver/src/serve.rsindex 5fdd982701..318cb0398b 100644--- a/libs/cua-driver/rust/crates/cua-driver/src/serve.rs+++ b/libs/cua-driver/rust/crates/cua-driver/src/serve.rs@@ -145,14 +145,6 @@ fn is_active_proxy_session(session: Option<&str>) -> bool {}fn inject_browser_approvals(tool_name: &str, args: &mut serde_json::Value, session: Option<&str>) {- if tool_name == "browser_prepare" && is_active_proxy_session(session) {- if let Some(arguments) = args.as_object_mut() {- arguments.insert(- cua_driver_core::browser::approval::MCP_HOST_APPROVAL_ARG.to_owned(),- serde_json::Value::Bool(true),- );- }- }if tool_name == "browser_download" && is_active_proxy_session(session) {if let Some(arguments) = args.as_object_mut() {arguments.insert(@@ -2486,7 +2478,6 @@ mod service_authorization_status_tests {#[cfg(test)]mod session_boundary_tests {use super::{active_proxy_sessions, apply_session_identity, inject_browser_approvals};- use cua_driver_core::browser::approval::MCP_HOST_APPROVAL_ARG;use cua_driver_core::browser::download::MCP_HOST_DOWNLOAD_APPROVAL_ARG;use serde_json::json;@@ -2539,30 +2530,8 @@ mod session_boundary_tests {}#[test]- fn browser_prepare_approval_requires_a_live_proxy_session() {+ fn browser_download_approval_requires_a_live_proxy_session() {let session = "approval-boundary-test";- let mut raw_args = json!({"pid": 42});- inject_browser_approvals("browser_prepare", &mut raw_args, Some(session));- assert!(raw_args.get(MCP_HOST_APPROVAL_ARG).is_none());-- active_proxy_sessions()- .lock()- .unwrap()- .insert(session.to_owned());- let mut proxy_args = json!({"pid": 42});- inject_browser_approvals("browser_prepare", &mut proxy_args, Some(session));- active_proxy_sessions().lock().unwrap().remove(session);- assert_eq!(proxy_args[MCP_HOST_APPROVAL_ARG], true);-- let mut other_tool = json!({"pid": 42});- active_proxy_sessions()- .lock()- .unwrap()- .insert(session.to_owned());- inject_browser_approvals("get_browser_state", &mut other_tool, Some(session));- active_proxy_sessions().lock().unwrap().remove(session);- assert!(other_tool.get(MCP_HOST_APPROVAL_ARG).is_none());-let mut raw_download = json!({"destination_root": "/private/path"});inject_browser_approvals("browser_download", &mut raw_download, Some(session));assert!(raw_download.get(MCP_HOST_DOWNLOAD_APPROVAL_ARG).is_none());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 a3c599003d..a697901e8e 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@@ -305,56 +305,25 @@ fn revoke_cli_ends_the_exact_live_session() {}#[test]-fn forged_legacy_artifact_cannot_authorize_existing_profile_in_standard_mode() {+fn standard_mode_refuses_existing_profile_without_a_launch_grant() {let mut driver = CliDriver::new();assert!(driver.available(), "test daemon failed to start");- let token = uuid::Uuid::new_v4().to_string();- let approval_root = std::env::temp_dir().join("cua-driver-browser-approvals-v1");- std::fs::create_dir_all(&approval_root).expect("create legacy approval directory");- let artifact_path = approval_root.join(format!("{token}.json"));- let expires_unix_ms = std::time::SystemTime::now()- .duration_since(std::time::UNIX_EPOCH)- .unwrap()- .as_millis()- + 60_000;- std::fs::write(- &artifact_path,- serde_json::to_vec(&serde_json::json!({- "schema": "cua-browser-existing-profile-approval-v1",- "token": token,- "scope": {- "pid": 42,- "window_id": 7,- "session": "forged-standard-attach"- },- "expires_unix_ms": expires_unix_ms- }))- .unwrap(),- )- .expect("write syntactically valid forged legacy artifact");-let response = driver.call("browser_prepare",serde_json::json!({"pid": 42,"window_id": 7,"session": "forged-standard-attach",- "strategy": { "kind": "existing_profile" },- "approval_token": token+ "strategy": { "kind": "existing_profile" }}),);- let _ = std::fs::remove_file(&artifact_path);assert_eq!(response.structured()["status"], "refused");assert_eq!(response.structured()["refusal"]["code"],"browser_consent_required");- assert_eq!(- response.structured()["refusal"]["detail"]["legacy_approval_enabled"],- false- );assert!(response.structured()["refusal"]["message"].as_str()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 7dda802d8e..801c8591db 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@@ -363,29 +363,6 @@ fn capability_manifest_acknowledgement_without_manifest_fails_closed() {assert!(!std::path::Path::new(&socket).exists());}-#[test]-fn legacy_existing_profile_approval_cannot_bypass_bounded_indicator() {- let directory = tempfile::tempdir().expect("temporary bounded test directory");- let policy = write_valid_capability_manifest(&directory);- let socket = test_socket(&directory, "bounded-legacy-approval");- let output = rejected_serve(- &socket,- &[- "--permission-mode",- "bounded",- "--capability-manifest",- &policy,- "--approve-capability-manifest",- "--allow-legacy-existing-profile-approval",- ],- );- assert!(!output.status.success());- assert!(String::from_utf8_lossy(&output.stderr)- .contains("valid only with --permission-mode standard"));- #[cfg(unix)]- assert!(!std::path::Path::new(&socket).exists());-}-#[test]fn autonomous_mode_name_remains_a_bounded_compatibility_alias() {let directory = tempfile::tempdir().expect("temporary mode alias test directory");diff --git a/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rs b/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rsindex 7100a9a496..f06effb428 100644--- a/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rs+++ b/libs/cua-driver/rust/crates/cua-driver/tests/standalone_browser_behavior_test.rs@@ -2260,11 +2260,6 @@ fn run_prepare_isolated_launch(spec: &BrowserSpec) {"browser_prepare disclosed its private profile path: {}",prepared.raw);- assert!(- !prepared_json.contains("approval_token"),- "{}",- prepared.raw- );let prepared_pid = prepared.structured()["prepared_pid"].as_u64()@@ -2502,11 +2497,6 @@ fn run_existing_profile_attach(spec: &BrowserSpec) {"{}",prepared.raw);- assert!(- !public_result.contains("approval_token"),- "{}",- prepared.raw- );assert!(!public_result.contains(&fixture._profile.path().display().to_string()),"{}",@@ -2655,11 +2645,6 @@ fn run_existing_profile_setup(spec: &BrowserSpec) {let public_result = prepared.raw.to_string();assert!(!public_result.contains("ws://"), "{}", prepared.raw);- assert!(- !public_result.contains("approval_token"),- "{}",- prepared.raw- );assert!(!public_result.contains(&fixture._profile.path().display().to_string()),"{}",