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
fix(cua-driver): sign the macOS Node runtime in release archives (#4280)
Francesco Bonacci3f1ad0bf8bd2
diff --git a/.github/scripts/tests/test_cua_driver_release_safety_wiring.py b/.github/scripts/tests/test_cua_driver_release_safety_wiring.pyindex 56fe2d744b..01d22a613c 100644--- a/.github/scripts/tests/test_cua_driver_release_safety_wiring.py+++ b/.github/scripts/tests/test_cua_driver_release_safety_wiring.py@@ -125,6 +125,8 @@ def test_signature_jobs_verify_exact_candidate_archives(cd: dict) -> None:assert job["with"]["source"] == "artifacts"assert job["with"]["version"] == "${{ needs.release-attribution-preflight.outputs.version }}"assert "expect_macos" not in job["with"] and "expect_windows" not in job["with"]+ # Candidate archives must carry a signed Node runtime (#4168).+ assert "legacy_unsigned_node_runtime" not in job["with"]assert needs(macos) == {"release-attribution-preflight", "build-macos-universal"}assert needs(windows) == {"release-attribution-preflight", "build-windows"}assert macos["with"]["verify_macos"] is True and macos["with"]["verify_windows"] is False@@ -198,9 +200,18 @@ def test_no_gate_is_bypassed_by_a_status_override(cd: dict) -> None:def test_signature_workflow_checks_what_the_operating_systems_check() -> None:workflow = load(SIGNATURES)trigger = workflow[True]["workflow_call"]["inputs"] # PyYAML parses `on` as True- assert set(trigger) == {"version", "source", "verify_macos", "verify_windows", "expect_macos", "expect_windows"}+ assert set(trigger) == {+ "version",+ "source",+ "verify_macos",+ "verify_windows",+ "expect_macos",+ "expect_windows",+ "legacy_unsigned_node_runtime",+ }assert trigger["expect_macos"]["default"] == "pass"assert trigger["expect_windows"]["default"] == "pass"+ assert trigger["legacy_unsigned_node_runtime"]["default"] is Falseassert workflow["permissions"] == {"contents": "read"}macos = workflow["jobs"]["macos"]@@ -213,9 +224,15 @@ def test_signature_workflow_checks_what_the_operating_systems_check() -> None:windows_verify = step(windows, "Verify Windows Authenticode signatures")["run"]assert "verify_cua_driver_release_signatures.py windows" in windows_verifyassert '--signer "Cua AI, Inc."' in windows_verify- for run in (macos_verify, windows_verify):+ assert (+ 'if [[ "$LEGACY_UNSIGNED_NODE_RUNTIME" == "true" ]]; then\n'+ " OPTIONS+=(--legacy-unsigned-node-runtime)\n"+ "fi"+ ) in macos_verify+ assert macos_verify.count("--legacy-unsigned-node-runtime") == 1+ for run, options in ((macos_verify, "OPTIONS"), (windows_verify, "ANNOTATE")):# GitHub runs `bash -e`; the status must be captured, not aborted on.- assert '${ANNOTATE[@]+"${ANNOTATE[@]}"} || STATUS=$?' in run+ assert '${%s[@]+"${%s[@]}"} || STATUS=$?' % (options, options) in runassert run.index("STATUS=0") < run.index("|| STATUS=$?")assert "expect_verification_result.sh \"$EXPECT\" \"$STATUS\"" in runassert step(macos, "Download candidate darwin archives")["with"]["name"] == "cua-driver-rs-darwin"@@ -234,7 +251,19 @@ def test_signature_team_matches_the_pinned_signing_team() -> None:def test_self_test_proves_the_gate_in_both_directions() -> None:workflow = load(SELF_TEST)jobs = workflow["jobs"]- assert jobs["signed-release"]["with"] == {"version": "0.28.2", "source": "release"}+ # 0.28.2 predates the signed Node runtime (#4168): it passes only in+ # legacy mode, and the strict gate must reject its real archives.+ assert jobs["signed-release"]["with"] == {+ "version": "0.28.2",+ "source": "release",+ "legacy_unsigned_node_runtime": True,+ }+ assert jobs["unsigned-node-runtime"]["with"] == {+ "version": "0.28.2",+ "source": "release",+ "verify_windows": False,+ "expect_macos": "fail",+ }assert jobs["unsigned-release"]["with"] == {"version": "0.28.3","source": "release",diff --git a/.github/scripts/tests/test_verify_cua_driver_release_signatures.py b/.github/scripts/tests/test_verify_cua_driver_release_signatures.pyindex 6a836faf54..75b3fd3bfd 100644--- a/.github/scripts/tests/test_verify_cua_driver_release_signatures.py+++ b/.github/scripts/tests/test_verify_cua_driver_release_signatures.py@@ -47,22 +47,30 @@ def _add(tar: tarfile.TarFile, name: str, data: bytes = b"\xcf\xfa\xed\xfe") ->tar.addfile(info, io.BytesIO(data))+STANDALONE_MACHO = (+ "cua-driver",+ "cua-cursor-theme",+ "libcua_driver_sdk.dylib",+ "cua_driver_node_runtime.node",+)++def make_darwin_artifacts(root: Path, version: str = VERSION, *, omit: str = "") -> Path:root.mkdir(parents=True, exist_ok=True)for label in ("darwin-arm64", "darwin-x86_64", "darwin-universal"):stage = f"cua-driver-rs-{version}-{label}"with tarfile.open(root / f"{stage}.tar.gz", "w:gz") as tar:- for name in ("cua-driver", "cua-cursor-theme", "libcua_driver_sdk.dylib"):+ for name in STANDALONE_MACHO:if name != omit:_add(tar, f"{stage}/{name}")- _add(tar, f"{stage}/cua_driver_node_runtime.node")if omit != "CuaDriver.app":_add(tar, f"{stage}/CuaDriver.app/Contents/Info.plist", b"<plist/>")_add(tar, f"{stage}/CuaDriver.app/Contents/MacOS/cua-driver")_add(tar, f"{stage}/CuaDriver.app/Contents/MacOS/cua-cursor-theme")with tarfile.open(root / f"cua-driver-rs-{version}-darwin-universal-binary.tar.gz", "w:gz") as tar:- for name in ("cua-driver", "cua-cursor-theme", "libcua_driver_sdk.dylib"):- _add(tar, name)+ for name in STANDALONE_MACHO:+ if name != omit:+ _add(tar, name)return root@@ -76,9 +84,11 @@ class FakeMacTools:notarized: bool = True,stapled: bool = True,adhoc_names: tuple[str, ...] = (),+ unsigned_names: tuple[str, ...] = (),team: str = TEAM,) -> None:self.signed = signed+ self.unsigned_names = unsigned_namesself.notarized = notarizedself.stapled = stapledself.adhoc_names = adhoc_names@@ -95,7 +105,7 @@ class FakeMacTools:return CommandResult(0, "")adhoc = not self.signed or target.name in self.adhoc_namesif tool == "codesign" and "--verify" in argv:- if not self.signed:+ if not self.signed or target.name in self.unsigned_names:return CommandResult(1, f"{target}: code object is not signed at all")return CommandResult(0, f"{target}: valid on disk")if tool == "codesign":@@ -122,10 +132,34 @@ def test_notarized_release_passes(tmp_path: Path) -> None:assert all(call[:5] == ["spctl", "-a", "-vvv", "-t", "exec"] for call in spctl)deep = [call for call in tools.calls if "--deep" in call]assert all(Path(call[-1]).name == "CuaDriver.app" for call in deep) and len(deep) == 3- # Every archive's standalone Mach-O copies are checked too.- verified = {Path(call[-1]).name for call in tools.calls if "--verify" in call}- assert {"cua-driver", "cua-cursor-theme", "libcua_driver_sdk.dylib"} <= verified- assert "cua_driver_node_runtime.node" not in verified+ # Every archive's standalone Mach-O copies are checked too, including the+ # Node runtime (#4168).+ verified = [+ Path(call[-1]).name+ for call in tools.calls+ if "--verify" in call and "CuaDriver.app" not in Path(call[-1]).parts+ ]+ for name in STANDALONE_MACHO:+ assert verified.count(name) == 4, name+++def test_unsigned_node_runtime_fails_unless_checking_a_legacy_release(tmp_path: Path) -> None:+ # 0.28.2 through 0.30.2 shipped a notarized app next to an unsigned+ # cua_driver_node_runtime.node (#4168).+ root = make_darwin_artifacts(tmp_path / "a")+ tools = FakeMacTools(unsigned_names=("cua_driver_node_runtime.node",))++ report = verify_macos(root, VERSION, run=tools)+ assert len(report.failures) == 4+ assert all(+ "cua_driver_node_runtime.node: codesign --verify failed" in failure+ for failure in report.failures+ )++ tools = FakeMacTools(unsigned_names=("cua_driver_node_runtime.node",))+ report = verify_macos(root, VERSION, legacy_unsigned_node_runtime=True, run=tools)+ assert report.failures == []+ assert not any(Path(call[-1]).name == "cua_driver_node_runtime.node" for call in tools.calls)def test_unsigned_release_like_0_28_3_fails(tmp_path: Path) -> None:@@ -149,6 +183,10 @@ def test_unsigned_release_like_0_28_3_fails(tmp_path: Path) -> None:(FakeMacTools(team="ZZZZZZZZZZ"), "team identifier is not YCK386LBJ7"),(FakeMacTools(adhoc_names=("CuaDriver.app",)), "signature is ad hoc"),(FakeMacTools(adhoc_names=("libcua_driver_sdk.dylib",)), "hardened runtime is not enabled"),+ (+ FakeMacTools(adhoc_names=("cua_driver_node_runtime.node",)),+ "cua_driver_node_runtime.node: team identifier is not YCK386LBJ7",+ ),],)def test_each_macos_signature_requirement_is_enforced(@@ -158,7 +196,9 @@ def test_each_macos_signature_requirement_is_enforced(assert any(message in failure for failure in report.failures), report.failures[email protected]("omit", ["CuaDriver.app", "cua-driver", "libcua_driver_sdk.dylib"])+ "omit", ["CuaDriver.app", "cua-driver", "libcua_driver_sdk.dylib", "cua_driver_node_runtime.node"]+)def test_missing_bundle_or_binary_fails(tmp_path: Path, omit: str) -> None:report = verify_macos(make_darwin_artifacts(tmp_path / "a", omit=omit), VERSION, run=FakeMacTools()@@ -283,6 +323,14 @@ def test_cli_exit_status_and_annotations(tmp_path: Path, monkeypatch, capsys) ->assert "::error" not in errassert "must not be published or installed" in err+ legacy = FakeMacTools(unsigned_names=("cua_driver_node_runtime.node",))+ monkeypatch.setattr(gate, "run_command", legacy)+ assert main(["macos", "--artifacts", str(root), "--version", VERSION]) == 1+ assert (+ main(["macos", "--artifacts", str(root), "--version", VERSION, "--legacy-unsigned-node-runtime"])+ == 0+ )+def test_cli_fails_when_no_archive_matches(tmp_path: Path) -> None:(tmp_path / "empty").mkdir()diff --git a/.github/scripts/verify_cua_driver_release_signatures.py b/.github/scripts/verify_cua_driver_release_signatures.pyindex 2b69ce041c..f3256169fc 100644--- a/.github/scripts/verify_cua_driver_release_signatures.py+++ b/.github/scripts/verify_cua_driver_release_signatures.py@@ -12,9 +12,15 @@ macOS (``macos``, run on a macOS runner)signature from the pinned team, be accepted by ``spctl -a -t exec`` withsource ``Notarized Developer ID``, and have a stapled notarization ticket(``xcrun stapler validate``). The standalone ``cua-driver``,- ``cua-cursor-theme``, and ``libcua_driver_sdk.dylib`` copies must carry the- same team's hardened-runtime signature. Any ``.pkg`` or ``.dmg`` asset must- be notarized and stapled too.+ ``cua-cursor-theme``, ``libcua_driver_sdk.dylib``, and+ ``cua_driver_node_runtime.node`` copies must carry the same team's+ hardened-runtime signature. Any ``.pkg`` or ``.dmg`` asset must be+ notarized and stapled too.++ Releases published before #4168 shipped an unsigned+ ``cua_driver_node_runtime.node``. ``--legacy-unsigned-node-runtime`` skips+ only that file, for checking those older releases; candidate and newly+ published archives are always verified without it.Windows (``windows``, run on a Windows runner)Every PE file (``.exe``, ``.dll``, ``.node``) inside a Windows archive must@@ -43,10 +49,10 @@ RELEASE_TEAM_ID = "YCK386LBJ7"RELEASE_SIGNER = "Cua AI, Inc."DARWIN_LABELS = ("darwin-arm64", "darwin-x86_64", "darwin-universal")WINDOWS_ARCHES = ("x86_64", "arm64")-# Mach-O files that the release pipeline signs with the Developer ID identity.-# cua_driver_node_runtime.node is loaded by Node and is not Developer ID signed-# by the current pipeline, so it is intentionally not listed here.-SIGNED_MACHO_FILES = ("cua-driver", "cua-cursor-theme", "libcua_driver_sdk.dylib")+# Standalone Mach-O files that the release pipeline signs with the Developer ID+# identity. Every one of them ships in every darwin archive.+NODE_RUNTIME = "cua_driver_node_runtime.node"+SIGNED_MACHO_FILES = ("cua-driver", "cua-cursor-theme", "libcua_driver_sdk.dylib", NODE_RUNTIME)APP_EXECUTABLES = ("Contents/MacOS/cua-driver", "Contents/MacOS/cua-cursor-theme")PE_SUFFIXES = (".exe", ".dll", ".node")@@ -169,11 +175,17 @@ def verify_macos(version: str,team_id: str = RELEASE_TEAM_ID,*,+ legacy_unsigned_node_runtime: bool = False,run: Runner | None = None,workdir: Path | None = None,) -> Report:run = run or run_commandreport = Report()+ signed_files = tuple(+ name+ for name in SIGNED_MACHO_FILES+ if not (legacy_unsigned_node_runtime and name == NODE_RUNTIME)+ )archives = sorted(artifacts.rglob(f"cua-driver-rs-{version}-darwin-*.tar.gz"))by_name = {archive.name: archive for archive in archives}expected = [f"cua-driver-rs-{version}-{label}.tar.gz" for label in DARWIN_LABELS]@@ -214,7 +226,7 @@ def verify_macos()else:report.fail(f"{label}: {executable} is missing")- for file_name in SIGNED_MACHO_FILES:+ for file_name in signed_files:target = root / file_nameif not target.is_file():report.fail(f"{name}: {file_name} is missing")@@ -336,6 +348,11 @@ def main(argv: Sequence[str] | None = None) -> int:subcommands = parser.add_subparsers(dest="platform", required=True)macos = subcommands.add_parser("macos", help="verify darwin archives (run on macOS)")macos.add_argument("--team-id", default=RELEASE_TEAM_ID)+ macos.add_argument(+ "--legacy-unsigned-node-runtime",+ action="store_true",+ help=f"skip {NODE_RUNTIME}, which releases published before #4168 left unsigned",+ )windows = subcommands.add_parser("windows", help="verify Windows archives (run on Windows)")windows.add_argument("--signer", default=RELEASE_SIGNER)for command in (macos, windows):@@ -352,7 +369,12 @@ def main(argv: Sequence[str] | None = None) -> int:print(f"error: artifact directory {args.artifacts} does not exist", file=sys.stderr)return 2if args.platform == "macos":- report = verify_macos(args.artifacts, args.version, args.team_id)+ report = verify_macos(+ args.artifacts,+ args.version,+ args.team_id,+ legacy_unsigned_node_runtime=args.legacy_unsigned_node_runtime,+ )else:report = verify_windows(args.artifacts, args.version, args.signer)diff --git a/.github/workflows/cd-rust-cua-driver.yml b/.github/workflows/cd-rust-cua-driver.ymlindex 2a35aa6f38..35a5ee5a4a 100644--- a/.github/workflows/cd-rust-cua-driver.yml+++ b/.github/workflows/cd-rust-cua-driver.yml@@ -780,6 +780,10 @@ jobs:--sign "$IDENTITY" release/universal/cua-cursor-themecodesign --force --timestamp --options runtime \--sign "$IDENTITY" release/universal/libcua_driver_sdk.dylib+ # Node loads this addon; every archive ships it next to the SDK+ # dylib, so it carries the same identity (#4168).+ codesign --force --timestamp --options runtime \+ --sign "$IDENTITY" release/universal/cua_driver_node_runtime.nodecodesign --verify --strict --verbose=2 release/universal/cua-drivercodesign -d --entitlements - --xml release/universal/cua-driver \> release/actual-cua-driver-entitlements.plist@@ -796,6 +800,7 @@ jobs:PYcodesign --verify --strict --verbose=2 release/universal/cua-cursor-themecodesign --verify --strict --verbose=2 release/universal/libcua_driver_sdk.dylib+ codesign --verify --strict --verbose=2 release/universal/cua_driver_node_runtime.node- name: Assemble CuaDriver.app bundleworking-directory: libs/cua-driver/rustrun: |diff --git a/.github/workflows/ci-cua-driver-release-signatures.yml b/.github/workflows/ci-cua-driver-release-signatures.ymlindex 64ef8e5fc2..27dea46f5c 100644--- a/.github/workflows/ci-cua-driver-release-signatures.yml+++ b/.github/workflows/ci-cua-driver-release-signatures.yml@@ -4,6 +4,10 @@ name: "CI: Cua Driver release signature gate"# assets: 0.28.2 (notarized) must pass, and 0.28.3 (published with an unsigned# macOS app, see #4109, now withdrawn) must be rejected on macOS. Its Windows# binaries are Authenticode-signed, so Windows must pass for both.+#+# 0.28.2 predates #4168 and ships an unsigned cua_driver_node_runtime.node, so+# it passes only in legacy mode, and the strict gate that candidate archives+# face must reject it.on:pull_request:@@ -28,6 +32,16 @@ jobs:with:version: "0.28.2"source: release+ legacy_unsigned_node_runtime: true++ unsigned-node-runtime:+ name: unsigned 0.28.2 Node runtime is rejected+ uses: ./.github/workflows/cua-driver-release-signatures.yml+ with:+ version: "0.28.2"+ source: release+ verify_windows: false+ expect_macos: failunsigned-release:name: unsigned 0.28.3 is rejecteddiff --git a/.github/workflows/cua-driver-release-signatures.yml b/.github/workflows/cua-driver-release-signatures.ymlindex 3995a1a223..697fb1d347 100644--- a/.github/workflows/cua-driver-release-signatures.yml+++ b/.github/workflows/cua-driver-release-signatures.yml@@ -5,7 +5,8 @@ name: "Release gate: Cua Driver signatures"## macOS every CuaDriver.app is Developer ID signed by the pinned team,# accepted by Gatekeeper as "Notarized Developer ID", and stapled;-# bare Mach-O binaries carry the same hardened-runtime signature.+# bare Mach-O binaries, including the Node runtime addon, carry the+# same hardened-runtime signature.# Windows every PE file in every zip has a valid, timestamped Authenticode# signature from Cua AI, Inc.#@@ -43,6 +44,11 @@ on:required: falsedefault: passtype: string+ legacy_unsigned_node_runtime:+ description: "Skip cua_driver_node_runtime.node, which releases published before #4168 left unsigned"+ required: false+ default: false+ type: booleanexpect_windows:description: "pass, or fail for a negative control"required: false@@ -86,17 +92,21 @@ jobs:env:VERSION: ${{ inputs.version }}EXPECT: ${{ inputs.expect_macos }}+ LEGACY_UNSIGNED_NODE_RUNTIME: ${{ inputs.legacy_unsigned_node_runtime }}run: |set -euo pipefaills -l signature-artifacts- ANNOTATE=()- if [[ "$EXPECT" == "fail" ]]; then ANNOTATE=(--no-annotations); fi+ OPTIONS=()+ if [[ "$EXPECT" == "fail" ]]; then OPTIONS+=(--no-annotations); fi+ if [[ "$LEGACY_UNSIGNED_NODE_RUNTIME" == "true" ]]; then+ OPTIONS+=(--legacy-unsigned-node-runtime)+ fiSTATUS=0python3 .github/scripts/verify_cua_driver_release_signatures.py macos \--artifacts signature-artifacts \--version "$VERSION" \--team-id YCK386LBJ7 \- ${ANNOTATE[@]+"${ANNOTATE[@]}"} || STATUS=$?+ ${OPTIONS[@]+"${OPTIONS[@]}"} || STATUS=$?bash .github/scripts/expect_verification_result.sh "$EXPECT" "$STATUS" "macOS signatures for $VERSION"windows:diff --git a/scripts/ci/README.md b/scripts/ci/README.mdindex 3e20554302..88af44b7fd 100644--- a/scripts/ci/README.md+++ b/scripts/ci/README.md@@ -392,9 +392,11 @@ To check a published release on a Mac:gh release download cua-driver-rs-v0.28.2 --repo trycua/cua --dir /tmp/cua-release \--pattern 'cua-driver-rs-0.28.2-darwin-*.tar.gz'python3 .github/scripts/verify_cua_driver_release_signatures.py macos \- --artifacts /tmp/cua-release --version 0.28.2+ --artifacts /tmp/cua-release --version 0.28.2 --legacy-unsigned-node-runtime```+Releases published before #4168 ship an unsigned `cua_driver_node_runtime.node`, so checking one of them needs `--legacy-unsigned-node-runtime`. That flag skips only the Node runtime. Release candidates are always verified without it.+To check Windows, run the `windows` subcommand on a Windows machine.### Runbook: roll the installers back to the last good release