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.

ci(cua-driver): pin Bullseye security bootstrap to Debian Snapshot (#3599)

Francesco Bonaccic759e3726d58
diff --git a/.github/scripts/tests/test_driver_linux_bootstrap.py b/.github/scripts/tests/test_driver_linux_bootstrap.py
new file mode 100644
index 0000000000..e869e516ab
--- /dev/null
+++ b/.github/scripts/tests/test_driver_linux_bootstrap.py
@@ -0,0 +1,87 @@
+"""Guard the pre-checkout bootstrap; native container CI proves installation."""
+
+from pathlib import Path
+import re
+import shlex
+import subprocess
+import textwrap
+import unittest
+
+
+REPO_ROOT = Path(__file__).resolve().parents[3]
+WORKFLOW = REPO_ROOT / ".github/workflows/cd-rust-cua-driver.yml"
+
+
+class TestDriverLinuxBootstrap(unittest.TestCase):
+ @classmethod
+ def setUpClass(cls) -> None:
+ workflow = WORKFLOW.read_text()
+ # This block must remain self-contained because it runs before checkout.
+ block = re.search(
+ r" - name: Install base tooling \(container is bare\)\n"
+ r" run: \|\n((?: .*\n|\n)+)",
+ workflow,
+ )
+ if block is None:
+ raise AssertionError("release bootstrap block not found")
+ cls.bootstrap = textwrap.dedent(block[1])
+
+ def test_shell_syntax(self) -> None:
+ subprocess.run(["sh", "-n"], input=self.bootstrap, text=True, check=True)
+
+ def test_only_frozen_signed_sources_disable_expiry(self) -> None:
+ sources = re.search(
+ r"cat > /etc/apt/sources.list <<'EOF'\n(.*?)\nEOF", self.bootstrap, re.S
+ )
+ self.assertIsNotNone(sources)
+ lines = sources[1].splitlines()
+ self.assertEqual(len(lines), 3)
+ suites = set()
+ for line in lines:
+ source = re.fullmatch(
+ r"deb \[check-valid-until=no "
+ r"signed-by=/usr/share/keyrings/debian-archive-keyring.gpg\] "
+ r"http://snapshot.debian.org/archive/(debian|debian-security)/"
+ r"20260901T000000Z/ (bullseye(?:-updates|-security)?) main",
+ line,
+ )
+ self.assertIsNotNone(source, line)
+ archive, suite = source.groups()
+ self.assertEqual(
+ archive, "debian-security" if suite == "bullseye-security" else "debian"
+ )
+ suites.add(suite)
+ self.assertEqual(suites, {"bullseye", "bullseye-updates", "bullseye-security"})
+ remaining = self.bootstrap.replace(sources[1], "")
+ self.assertNotRegex(remaining.lower(), r"check-valid-until|check-date")
+ self.assertNotRegex(
+ self.bootstrap.lower(),
+ r"trusted\s*=|allow-unauthenticated|allowinsecure|allow-insecure|"
+ r"allowweak|allow-weak|verify-peer|verify-host",
+ )
+
+ def test_apt_uses_only_snapshot_sources_and_full_dependencies(self) -> None:
+ commands = [
+ shlex.split(line)
+ for line in self.bootstrap.replace("\\\n", " ").splitlines()
+ if line.startswith("apt-get ")
+ ]
+ self.assertEqual(commands[0], ["apt-get", "-o", "Dir::Etc::sourceparts=-", "update"])
+ self.assertEqual(
+ commands[1][:6],
+ ["apt-get", "-o", "Dir::Etc::sourceparts=-", "install", "-y", "--no-install-recommends"],
+ )
+ self.assertEqual(len(commands), 2)
+ self.assertEqual(
+ set(commands[1][6:]),
+ {
+ "git", "ca-certificates", "curl", "python3", "build-essential", "pkg-config",
+ "libx11-dev", "libxi-dev", "libxtst-dev", "libxext-dev", "libwayland-dev",
+ "libxkbcommon-dev",
+ },
+ )
+ self.assertLess(self.bootstrap.index("\nEOF\n"), self.bootstrap.index("apt-get "))
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/.github/workflows/cd-rust-cua-driver.yml b/.github/workflows/cd-rust-cua-driver.yml
index 5fb2cd12f0..cb74953ae9 100644
--- a/.github/workflows/cd-rust-cua-driver.yml
+++ b/.github/workflows/cd-rust-cua-driver.yml
@@ -176,12 +176,21 @@ jobs:
# is bare. Install git + the build toolchain before anything else.
- name: Install base tooling (container is bare)
run: |
- apt-get update
+ # Freeze bullseye indexes and packages together: the live security
+ # mirror can advertise packages it no longer serves. HTTP bootstraps
+ # ca-certificates; APT still verifies Debian signatures and hashes.
+ cat > /etc/apt/sources.list <<'EOF'
+ deb [check-valid-until=no signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://snapshot.debian.org/archive/debian/20260901T000000Z/ bullseye main
+ deb [check-valid-until=no signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://snapshot.debian.org/archive/debian/20260901T000000Z/ bullseye-updates main
+ deb [check-valid-until=no signed-by=/usr/share/keyrings/debian-archive-keyring.gpg] http://snapshot.debian.org/archive/debian-security/20260901T000000Z/ bullseye-security main
+ EOF
+ # Ignore any additional image-provided sources for this bootstrap.
+ apt-get -o Dir::Etc::sourceparts=- update
# PipeWire ScreenCast capture remains Nix/modern-build only because
# bullseye's 0.3.19 headers are too old for libspa-sys 0.8. Portal
# RemoteDesktop/libei input is pure Rust plus libxkbcommon and ships
# in these portable release binaries.
- apt-get install -y --no-install-recommends \
+ apt-get -o Dir::Etc::sourceparts=- install -y --no-install-recommends \
git ca-certificates curl python3 build-essential pkg-config \
libx11-dev libxi-dev libxtst-dev libxext-dev libwayland-dev \
libxkbcommon-dev
diff --git a/.github/workflows/ci-driver-linux-bootstrap.yml b/.github/workflows/ci-driver-linux-bootstrap.yml
new file mode 100644
index 0000000000..019ae509d9
--- /dev/null
+++ b/.github/workflows/ci-driver-linux-bootstrap.yml
@@ -0,0 +1,59 @@
+name: "CI: Driver Linux dependency bootstrap"
+
+on:
+ pull_request:
+ paths:
+ - ".github/workflows/cd-rust-cua-driver.yml"
+ - ".github/workflows/ci-driver-linux-bootstrap.yml"
+ - ".github/scripts/tests/test_driver_linux_bootstrap.py"
+
+permissions:
+ contents: read
+
+jobs:
+ bootstrap:
+ name: Debian 11 bootstrap (${{ matrix.arch }})
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - arch: amd64
+ runner: ubuntu-latest
+ - arch: arm64
+ runner: ubuntu-24.04-arm
+ runs-on: ${{ matrix.runner }}
+ timeout-minutes: 15
+ steps:
+ - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
+ - name: Check snapshot and authentication contract
+ run: python3 .github/scripts/tests/test_driver_linux_bootstrap.py
+ - name: Extract the exact release-workflow bootstrap
+ run: |
+ python3 -m venv "$RUNNER_TEMP/bootstrap-parser"
+ "$RUNNER_TEMP/bootstrap-parser/bin/pip" install PyYAML==6.0.3
+ "$RUNNER_TEMP/bootstrap-parser/bin/python" - <<'PY'
+ import os
+ from pathlib import Path
+ import yaml
+
+ workflow = yaml.safe_load(Path('.github/workflows/cd-rust-cua-driver.yml').read_text())
+ job = workflow['jobs']['build-linux']
+ assert job['container']['image'] == 'debian:11'
+ steps = [step for step in job['steps'] if step.get('name') == 'Install base tooling (container is bare)']
+ assert len(steps) == 1
+ Path(os.environ['RUNNER_TEMP'], 'driver-bootstrap.sh').write_text('set -eu\n' + steps[0]['run'])
+ PY
+ - name: Install dependencies on the native architecture
+ env:
+ EXPECTED_ARCH: ${{ matrix.arch }}
+ run: |
+ docker pull debian:11
+ docker image inspect debian:11 --format '{{json .RepoDigests}}'
+ docker run --rm -i -e EXPECTED_ARCH debian:11 sh -e -c '
+ test "$(dpkg --print-architecture)" = "$EXPECTED_ARCH"
+ uname -m
+ sh -e -s
+ dpkg-query -W git ca-certificates curl python3 build-essential pkg-config libx11-dev libxi-dev libxtst-dev libxext-dev libwayland-dev libxkbcommon-dev
+ ldd --version
+ test "$(getconf GNU_LIBC_VERSION)" = "glibc 2.31"
+ ' < "$RUNNER_TEMP/driver-bootstrap.sh"