Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

fix(cua-driver): harden telemetry release paths (#2214)

Francesco Bonacci06fcc0fb3bdf
diff --git a/.github/scripts/tests/test_cua_driver_release_wiring.py b/.github/scripts/tests/test_cua_driver_release_wiring.py
index 2c6ef716a3..c7dfc69442 100644
--- a/.github/scripts/tests/test_cua_driver_release_wiring.py
+++ b/.github/scripts/tests/test_cua_driver_release_wiring.py
@@ -137,9 +137,38 @@ class TestCuaDriverReleaseWiring(unittest.TestCase):
self.assertLess(hint, shell.index('mv -Tf "$TMP_LINK" "$CURRENT_LINK"'))
powershell = self.read("libs/cua-driver/scripts/install.ps1")
- hint = powershell.index("Set-Content -LiteralPath (Join-Path $HomeDir '.telemetry_install_channel')")
+ hint = powershell.index("Set-Content -LiteralPath $telemetryHintPath")
self.assertLess(hint, powershell.index("Ensure-Junction $CurrentDir $versionedDir"))
+ def test_release_installers_gate_channel_hint_on_effective_consent(self) -> None:
+ shell = self.read("libs/cua-driver/scripts/_install-rust.sh")
+ self.assertIn(
+ "for telemetry_env_name in CUA_DRIVER_RS_TELEMETRY_ENABLED CUA_TELEMETRY_ENABLED",
+ shell,
+ )
+ self.assertIn('[[ "$TELEMETRY_HINT_FROM_ENV" == "0"', shell)
+ self.assertIn('"telemetry_enabled"', shell)
+ self.assertIn('[[ "$TELEMETRY_HINT_ENABLED" == "1" ]]', shell)
+
+ powershell = self.read("libs/cua-driver/scripts/install.ps1")
+ self.assertIn(
+ "@('CUA_DRIVER_RS_TELEMETRY_ENABLED', 'CUA_TELEMETRY_ENABLED')",
+ powershell,
+ )
+ self.assertIn("Properties['telemetry_enabled']", powershell)
+ self.assertIn("if ($telemetryHintEnabled)", powershell)
+
+ def test_release_and_skill_installers_do_not_depend_on_github_latest(self) -> None:
+ workflow = self.read(".github/workflows/cd-rust-cua-driver.yml")
+ self.assertIn("prerelease: true", workflow)
+ self.assertIn("make_latest: false", workflow)
+
+ windows_skill = self.read(
+ "libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md"
+ )
+ self.assertIn("https://cua.ai/driver/install.ps1", windows_skill)
+ self.assertNotIn("/releases/latest/download/install.ps1", windows_skill)
+
def test_lifecycle_telemetry_runs_outside_foreground_command(self) -> None:
main = self.read("libs/cua-driver/rust/crates/cua-driver/src/main.rs")
telemetry = self.read(
diff --git a/docs/content/docs/reference/cua-driver/cli-reference.mdx b/docs/content/docs/reference/cua-driver/cli-reference.mdx
index 5440b24ab2..c3baddc9e8 100644
--- a/docs/content/docs/reference/cua-driver/cli-reference.mdx
+++ b/docs/content/docs/reference/cua-driver/cli-reference.mdx
@@ -7,7 +7,7 @@ description: Command-line interface specification for Cua Driver
AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
Generated by: npx tsx scripts/docs-generators/cua-driver.ts
Source: cua-driver dump-docs
- Version: 0.7.1
+ Version: 0.8.0
*/}
Cross-platform computer-use automation driver. Install via the official script:
@@ -16,7 +16,7 @@ Cross-platform computer-use automation driver. Install via the official script:
curl -fsSL https://cua.ai/driver/install.sh | bash
```
-Documented against Cua Driver **0.7.1**. Run `cua-driver --version` for your installed version.
+Documented against Cua Driver **0.8.0**. Run `cua-driver --version` for your installed version.
The macOS-only `cua-driver permissions` command is documented separately in [macOS permissions](/reference/cua-driver/macos-permissions).
diff --git a/docs/content/docs/reference/cua-driver/mcp-tools.mdx b/docs/content/docs/reference/cua-driver/mcp-tools.mdx
index bbbac596c2..5b7a795309 100644
--- a/docs/content/docs/reference/cua-driver/mcp-tools.mdx
+++ b/docs/content/docs/reference/cua-driver/mcp-tools.mdx
@@ -7,7 +7,7 @@ description: Reference for every MCP tool Cua Driver exposes
AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
Generated by: npx tsx scripts/docs-generators/cua-driver.ts
Source: cua-driver dump-docs
- Version: 0.7.1
+ Version: 0.8.0
*/}
import { Callout } from 'fumadocs-ui/components/callout';
diff --git a/docs/content/docs/reference/cua-driver/telemetry.mdx b/docs/content/docs/reference/cua-driver/telemetry.mdx
index f79f6a6ce3..e08af8467e 100644
--- a/docs/content/docs/reference/cua-driver/telemetry.mdx
+++ b/docs/content/docs/reference/cua-driver/telemetry.mdx
@@ -29,6 +29,18 @@ cua-driver telemetry reset-id
Use `uninstall --purge` when uninstalling if you also want to remove retained Cua Driver state.
+## Separate update check
+
+The telemetry setting does not control Cua Driver's update check. On `mcp`, `serve`, and `doctor` startup, Cua Driver may make a content-free request to the public GitHub Releases API and cache the result locally for 20 hours. This request does not include the telemetry installation ID or command usage.
+
+Disable the update check separately when you need to prevent that GitHub request and cache write:
+
+```bash
+CUA_DRIVER_RS_UPDATE_CHECK=false cua-driver mcp
+```
+
+Set the same environment variable in your MCP server configuration to keep the update check disabled across sessions.
+
## Inspect events locally
`inspect` builds the event without sending a network request. It replaces the installation ID with a redacted placeholder.
diff --git a/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md b/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md
index 2ae238b2f7..a71c5d10dd 100644
--- a/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md
+++ b/libs/cua-driver/rust/Skills/cua-driver/WINDOWS.md
@@ -474,7 +474,7 @@ your prior tool calls earned.
added to the user PATH by the install script.
If missing, point the user at:
```powershell
- irm https://github.com/trycua/cua/releases/latest/download/install.ps1 | iex
+ irm https://cua.ai/driver/install.ps1 | iex
```
and stop.
2. **The daemon must run in an interactive session (Session 1+),
diff --git a/libs/cua-driver/scripts/_install-rust.sh b/libs/cua-driver/scripts/_install-rust.sh
index 5b2a90d217..dce8725888 100644
--- a/libs/cua-driver/scripts/_install-rust.sh
+++ b/libs/cua-driver/scripts/_install-rust.sh
@@ -616,8 +616,42 @@ case "$INSTALL_CHANNEL" in
install_script|update_apply|python_package|first_run) ;;
*) INSTALL_CHANNEL="install_script" ;;
esac
-mkdir -p "$HOME_DIR"
-printf '%s\n' "$INSTALL_CHANNEL" > "$HOME_DIR/.telemetry_install_channel"
+
+# Mirror the runtime's consent precedence before writing the attribution hint:
+# environment override, compatibility override, persisted preference, default-on.
+# This keeps an opted-out install free of telemetry state even when the detached
+# install-event hook returns before reading the hint.
+TELEMETRY_HINT_ENABLED=1
+TELEMETRY_HINT_FROM_ENV=0
+for telemetry_env_name in CUA_DRIVER_RS_TELEMETRY_ENABLED CUA_TELEMETRY_ENABLED; do
+ telemetry_env_value="${!telemetry_env_name:-}"
+ telemetry_env_value="$(printf '%s' "$telemetry_env_value" | tr '[:upper:]' '[:lower:]' | sed 's/^[[:space:]]*//; s/[[:space:]]*$//')"
+ case "$telemetry_env_value" in
+ 1|true|yes|on)
+ TELEMETRY_HINT_ENABLED=1
+ TELEMETRY_HINT_FROM_ENV=1
+ break
+ ;;
+ 0|false|no|off)
+ TELEMETRY_HINT_ENABLED=0
+ TELEMETRY_HINT_FROM_ENV=1
+ break
+ ;;
+ esac
+done
+if [[ "$TELEMETRY_HINT_FROM_ENV" == "0" && -f "$HOME_DIR/config.json" ]]; then
+ TELEMETRY_CONFIG_VALUE="$(sed -nE 's/.*"telemetry_enabled"[[:space:]]*:[[:space:]]*(true|false).*/\1/p' "$HOME_DIR/config.json" | tail -n 1)"
+ case "$TELEMETRY_CONFIG_VALUE" in
+ true) TELEMETRY_HINT_ENABLED=1 ;;
+ false) TELEMETRY_HINT_ENABLED=0 ;;
+ esac
+fi
+if [[ "$TELEMETRY_HINT_ENABLED" == "1" ]]; then
+ mkdir -p "$HOME_DIR"
+ printf '%s\n' "$INSTALL_CHANNEL" > "$HOME_DIR/.telemetry_install_channel"
+else
+ rm -f "$HOME_DIR/.telemetry_install_channel"
+fi
# macOS: install the .app to /Applications first, then symlink the
# bin into the bundle so `~/.local/bin/cua-driver` resolves into
diff --git a/libs/cua-driver/scripts/install.ps1 b/libs/cua-driver/scripts/install.ps1
index ba2c41d0ba..101a3cb069 100644
--- a/libs/cua-driver/scripts/install.ps1
+++ b/libs/cua-driver/scripts/install.ps1
@@ -1123,9 +1123,51 @@ $installChannel = $env:CUA_DRIVER_INSTALL_CHANNEL
if (-not $installChannel -or $installChannel -notin $allowedChannels) {
$installChannel = "install_script"
}
-New-Item -ItemType Directory -Force -Path $HomeDir | Out-Null
-Set-Content -LiteralPath (Join-Path $HomeDir '.telemetry_install_channel') `
- -Value $installChannel -Encoding Ascii -NoNewline
+
+# Mirror the runtime's consent precedence before writing the attribution hint:
+# environment override, compatibility override, persisted preference, default-on.
+$telemetryHintEnabled = $true
+$telemetryHintFromEnvironment = $false
+foreach ($telemetryEnvironmentName in @('CUA_DRIVER_RS_TELEMETRY_ENABLED', 'CUA_TELEMETRY_ENABLED')) {
+ $telemetryEnvironmentValue = [Environment]::GetEnvironmentVariable($telemetryEnvironmentName)
+ if ($null -eq $telemetryEnvironmentValue) {
+ continue
+ }
+ $telemetryEnvironmentValue = $telemetryEnvironmentValue.Trim().ToLowerInvariant()
+ if ($telemetryEnvironmentValue -in @('1', 'true', 'yes', 'on')) {
+ $telemetryHintEnabled = $true
+ $telemetryHintFromEnvironment = $true
+ break
+ }
+ if ($telemetryEnvironmentValue -in @('0', 'false', 'no', 'off')) {
+ $telemetryHintEnabled = $false
+ $telemetryHintFromEnvironment = $true
+ break
+ }
+}
+if (-not $telemetryHintFromEnvironment) {
+ $telemetryConfigPath = Join-Path $HomeDir 'config.json'
+ if (Test-Path -LiteralPath $telemetryConfigPath) {
+ try {
+ $telemetryConfig = Get-Content -LiteralPath $telemetryConfigPath -Raw | ConvertFrom-Json
+ $telemetryPreference = $telemetryConfig.PSObject.Properties['telemetry_enabled']
+ if ($null -ne $telemetryPreference -and $telemetryPreference.Value -is [bool]) {
+ $telemetryHintEnabled = $telemetryPreference.Value
+ }
+ }
+ catch {
+ # Match the runtime: malformed config falls through to default-on.
+ }
+ }
+}
+$telemetryHintPath = Join-Path $HomeDir '.telemetry_install_channel'
+if ($telemetryHintEnabled) {
+ New-Item -ItemType Directory -Force -Path $HomeDir | Out-Null
+ Set-Content -LiteralPath $telemetryHintPath -Value $installChannel -Encoding Ascii -NoNewline
+}
+else {
+ Remove-Item -LiteralPath $telemetryHintPath -Force -ErrorAction SilentlyContinue
+}
# Wire up the junction chain. The inner junction (current → releases\<v>)
# is what makes the upgrade atomic; the outer junction (bin → current)