Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Authenticate RC artifacts before qualification
rcourtman70c1d0a178f5
diff --git a/.github/workflows/qualify-secure-runtime-release.yml b/.github/workflows/qualify-secure-runtime-release.ymlindex 0135986266..29b0d41873 100644--- a/.github/workflows/qualify-secure-runtime-release.yml+++ b/.github/workflows/qualify-secure-runtime-release.yml@@ -79,7 +79,11 @@ jobs:TAG: ${{ steps.release.outputs.tag }}run: |set -euo pipefail- mkdir -p "$RUNNER_TEMP/secure-runtime-release" "$RUNNER_TEMP/secure-runtime-evidence"+ mkdir -p \+ "$RUNNER_TEMP/secure-runtime-downloads" \+ "$RUNNER_TEMP/secure-runtime-evidence" \+ "$RUNNER_TEMP/secure-runtime-harness" \+ "$RUNNER_TEMP/secure-runtime-preexecution"for asset in \checksums.txt \release-build-provenance.sigstore.json \@@ -97,21 +101,59 @@ jobs:pulse-agent-runner-linux-amd64; dogh release download "${TAG}" \--repo "${GITHUB_REPOSITORY}" \- --dir "$RUNNER_TEMP/secure-runtime-release" \+ --dir "$RUNNER_TEMP/secure-runtime-downloads" \--pattern "${asset}"done- chmod 0755 \- "$RUNNER_TEMP/secure-runtime-release"/pulse-secure-runtime-collector-v*-linux-amd64 \- "$RUNNER_TEMP/secure-runtime-release"/pulse-agent-linux-amd64 \- "$RUNNER_TEMP/secure-runtime-release"/pulse-agent-helper-linux-amd64 \- "$RUNNER_TEMP/secure-runtime-release"/pulse-agent-runner-linux-amd64++ - name: Pre-authenticate exact qualification packet+ env:+ GH_TOKEN: ${{ github.token }}+ PULSE_UPDATE_SIGNING_PUBLIC_KEY: ${{ vars.PULSE_UPDATE_SIGNING_PUBLIC_KEY }}+ QUALIFIED_COMMIT: ${{ steps.source.outputs.commit }}+ RELEASE_ID: ${{ steps.release.outputs.release_id }}+ TAG: ${{ steps.release.outputs.tag }}+ run: |+ set -euo pipefail+ download_dir="$RUNNER_TEMP/secure-runtime-downloads"+ verification_dir="$RUNNER_TEMP/secure-runtime-preexecution"+ test -n "${PULSE_UPDATE_SIGNING_PUBLIC_KEY}"+ update_fingerprint="$(+ go run ./scripts/release_update_key.go fingerprint \+ --public-key "${PULSE_UPDATE_SIGNING_PUBLIC_KEY}"+ )"+ python3 scripts/release_control/secure_runtime_attestation_v6.py \+ --verify-release-packet-only \+ --checkout "${GITHUB_WORKSPACE}" \+ --commit "${QUALIFIED_COMMIT}" \+ --main-ref origin/main \+ --collector-v1 "${download_dir}/pulse-secure-runtime-collector-v1-linux-amd64" \+ --collector-v2 "${download_dir}/pulse-secure-runtime-collector-v2-linux-amd64" \+ --collector-v3 "${download_dir}/pulse-secure-runtime-collector-v3-linux-amd64" \+ --collector-v4 "${download_dir}/pulse-agent-linux-amd64" \+ --helper "${download_dir}/pulse-agent-helper-linux-amd64" \+ --runner "${download_dir}/pulse-agent-runner-linux-amd64" \+ --collector-v1-signature "${download_dir}/pulse-secure-runtime-collector-v1-linux-amd64.sig" \+ --collector-v2-signature "${download_dir}/pulse-secure-runtime-collector-v2-linux-amd64.sig" \+ --collector-v3-signature "${download_dir}/pulse-secure-runtime-collector-v3-linux-amd64.sig" \+ --collector-v4-signature "${download_dir}/pulse-agent-linux-amd64.sig" \+ --release-candidate-tag "${TAG}" \+ --release-repository "${GITHUB_REPOSITORY}" \+ --release-id "${RELEASE_ID}" \+ --release-checksums "${download_dir}/checksums.txt" \+ --release-assembly-provenance "${download_dir}/release-build-provenance.sigstore.json" \+ --release-compiler-provenance "${download_dir}/secure-runtime-compiler-provenance.sigstore.json" \+ --release-build-contract "${download_dir}/secure-runtime-build-contract-v1.json" \+ --expected-release-update-key-fingerprint "${update_fingerprint}" \+ --expected-architecture amd64 \+ --verified-packet-dir "$RUNNER_TEMP/secure-runtime-verified" \+ --output "${verification_dir}/preexecution-verification.json"- name: Build exact-source qualification harnessrun: |set -euo pipefailCGO_ENABLED=0 GOOS=linux GOARCH=amd64 \go test -c \- -o "$RUNNER_TEMP/secure-runtime-release/installtests-linux-amd64.test" \+ -o "$RUNNER_TEMP/secure-runtime-harness/installtests-linux-amd64.test" \./scripts/installtests- name: Build disposable systemd host image@@ -151,7 +193,8 @@ jobs:--tmpfs /run/lock \--volume /sys/fs/cgroup:/sys/fs/cgroup:rw \--volume "${GITHUB_WORKSPACE}:/workspace:ro" \- --volume "$RUNNER_TEMP/secure-runtime-release:/release:ro" \+ --volume "$RUNNER_TEMP/secure-runtime-verified:/release:ro" \+ --volume "$RUNNER_TEMP/secure-runtime-harness:/harness:ro" \--volume "$RUNNER_TEMP/secure-runtime-evidence:/evidence:rw" \pulse-secure-runtime-systemd:ubuntu-24.04for attempt in $(seq 1 30); do@@ -186,7 +229,7 @@ jobs:--env PULSE_SECURE_RUNTIME_TRANSCRIPT=/evidence/transcript.jsonl \--env "PULSE_SECURE_RUNTIME_TRANSCRIPT_RECORD_PATH=docs/release-control/v6/internal/records/secure-agent-runtime-systemd-transcript-v6-${TAG}.jsonl" \"${container}" \- sh -c 'cd /workspace/scripts/installtests && exec /release/installtests-linux-amd64.test -test.run "^TestSecureRuntimeSystemdLab$" -test.count=1 -test.v'+ sh -c 'cd /workspace/scripts/installtests && exec /harness/installtests-linux-amd64.test -test.run "^TestSecureRuntimeSystemdLab$" -test.count=1 -test.v'elapsed="$(( $(date +%s) - start_epoch ))"if [[ "${elapsed}" -lt 1 ]]; then elapsed=1; fiecho "elapsed_seconds=${elapsed}" >> "$GITHUB_OUTPUT"@@ -194,14 +237,19 @@ jobs:- name: Create release-candidate secure-runtime attestationenv:GH_TOKEN: ${{ github.token }}+ PULSE_UPDATE_SIGNING_PUBLIC_KEY: ${{ vars.PULSE_UPDATE_SIGNING_PUBLIC_KEY }}QUALIFIED_COMMIT: ${{ steps.source.outputs.commit }}RELEASE_ID: ${{ steps.release.outputs.release_id }}TAG: ${{ steps.release.outputs.tag }}run: |set -euo pipefail- release_dir="$RUNNER_TEMP/secure-runtime-release"+ release_dir="$RUNNER_TEMP/secure-runtime-verified"evidence_dir="$RUNNER_TEMP/secure-runtime-evidence"- update_fingerprint="$(jq -er '.update_key_fingerprint' "${release_dir}/secure-runtime-build-contract-v1.json")"+ test -n "${PULSE_UPDATE_SIGNING_PUBLIC_KEY}"+ update_fingerprint="$(+ go run ./scripts/release_update_key.go fingerprint \+ --public-key "${PULSE_UPDATE_SIGNING_PUBLIC_KEY}"+ )"python3 scripts/release_control/secure_runtime_attestation_v6.py \--checkout "${GITHUB_WORKSPACE}" \--commit "${QUALIFIED_COMMIT}" \@@ -239,7 +287,9 @@ jobs:uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1with:name: secure-runtime-qualification-${{ steps.release.outputs.tag }}-${{ steps.source.outputs.commit }}- path: ${{ runner.temp }}/secure-runtime-evidence/+ path: |+ ${{ runner.temp }}/secure-runtime-evidence/+ ${{ runner.temp }}/secure-runtime-preexecution/preexecution-verification.jsonif-no-files-found: errorretention-days: 90compression-level: 0diff --git a/docs/AGENT_SECURITY.md b/docs/AGENT_SECURITY.mdindex daa9252624..a0e2fd2fb7 100644--- a/docs/AGENT_SECURITY.md+++ b/docs/AGENT_SECURITY.md@@ -230,6 +230,17 @@ provider hosts, container-runtime parity, appliance qualification, exact releaseartifacts, and external review are still required before the profile can becomethe general default.+Exact-release qualification authenticates before it executes. The workflow+copies the six candidate binaries, four collector signatures, checksum+manifest, assembly and compiler provenance, and build contract into a private+snapshot. It verifies the immutable release identity, canonical source and tag,+hosted compiler chain, production update key, and every digest against those+copies. Only then does it make the binary snapshot executable and mount it+read-only into the privileged disposable systemd host. A failed or mutated+packet never reaches Docker. The post-run attester re-verifies those same+snapshot paths against the receipt. No qualifying RC containing this boundary+has been published yet.+### Safe-profile support and qualification matrix`Qualified` below means the named evidence exercised the behavior on a realdiff --git a/docs/release-control/v6/internal/AGENT_PRIVILEGE_BOUNDARY_PLAN.md b/docs/release-control/v6/internal/AGENT_PRIVILEGE_BOUNDARY_PLAN.mdindex 6f6017873e..ee8a1ea2a4 100644--- a/docs/release-control/v6/internal/AGENT_PRIVILEGE_BOUNDARY_PLAN.md+++ b/docs/release-control/v6/internal/AGENT_PRIVILEGE_BOUNDARY_PLAN.md@@ -213,10 +213,17 @@ candidate assembly requires its current collector, helper, and runner to matchthe ordinary release payload byte for byte, then publishes the three predecessorcollectors, compiler provenance, and build contract through the normal signedrelease packet. A published prerelease automatically runs the twenty-scenario-lab on a disposable systemd host and invokes this verifier with all four-release signatures. No qualifying RC containing this wiring has been published-yet, so current evidence remains committed-main, artifact-bound, and-self-attested; a local tag still cannot upgrade it to RC status.+lab on a disposable systemd host. Before any candidate byte can reach that+privileged container, the workflow copies all six binaries, four collector+signatures, checksum and provenance sidecars, and the build contract into a+private snapshot and verifies the immutable release, canonical tag and source,+hosted compiler chain, exact digests, and production update key against those+copies. Only the verified snapshot becomes executable and is mounted read-only.+failed or mutated packets never reach Docker. The post-run attester consumes+the same snapshot paths and all four release signatures. No qualifying RC+containing this wiring has been published yet, so current evidence remains+committed-main, artifact-bound, and self-attested; a local tag still cannot+upgrade it to RC status.Schema-v6 committed-main classification is likewise not caller-relative. Theattester accepts only `origin/main`, requires the canonical Pulse origin URL,diff --git a/docs/release-control/v6/internal/subsystems/deployment-installability.md b/docs/release-control/v6/internal/subsystems/deployment-installability.mdindex 5eb1241028..b589f30175 100644--- a/docs/release-control/v6/internal/subsystems/deployment-installability.md+++ b/docs/release-control/v6/internal/subsystems/deployment-installability.md@@ -838,6 +838,18 @@ artifact-selection behaviour.step-local environment variables across steps.Private signing material and publication credentials must never enter thePVE compilation job.+ Post-publication secure-runtime qualification must authenticate before it+ executes. `.github/workflows/qualify-secure-runtime-release.yml` may download+ caller-owned release assets only into a non-executable holding directory.+ `scripts/release_control/secure_runtime_attestation_v6.py` must copy the six+ binaries, four collector signatures, checksum manifest, assembly and+ compiler provenance, and build contract into one private snapshot, verify+ the immutable release/tag/source identity, hosted compiler chain, canonical+ build contract, production update-key signatures, and exact digests against+ those copies, and publish the snapshot only after every check passes. The+ privileged systemd container must mount that exact snapshot read-only and+ must never execute directly from the download directory. The post-run+ attester must consume the same snapshot paths.PVE jobs must consume their runner users' persistent local Go and npm cachesdirectly; disposable-runner Actions cache restore/save phases must remaindisabled because archiving those same caches adds network work after thediff --git a/frontend-modern/public/docs/AGENT_SECURITY.md b/frontend-modern/public/docs/AGENT_SECURITY.mdindex daa9252624..a0e2fd2fb7 100644--- a/frontend-modern/public/docs/AGENT_SECURITY.md+++ b/frontend-modern/public/docs/AGENT_SECURITY.md@@ -230,6 +230,17 @@ provider hosts, container-runtime parity, appliance qualification, exact releaseartifacts, and external review are still required before the profile can becomethe general default.+Exact-release qualification authenticates before it executes. The workflow+copies the six candidate binaries, four collector signatures, checksum+manifest, assembly and compiler provenance, and build contract into a private+snapshot. It verifies the immutable release identity, canonical source and tag,+hosted compiler chain, production update key, and every digest against those+copies. Only then does it make the binary snapshot executable and mount it+read-only into the privileged disposable systemd host. A failed or mutated+packet never reaches Docker. The post-run attester re-verifies those same+snapshot paths against the receipt. No qualifying RC containing this boundary+has been published yet.+### Safe-profile support and qualification matrix`Qualified` below means the named evidence exercised the behavior on a realdiff --git a/scripts/installtests/build_release_assets_test.go b/scripts/installtests/build_release_assets_test.goindex 0e293185cc..45912d077e 100644--- a/scripts/installtests/build_release_assets_test.go+++ b/scripts/installtests/build_release_assets_test.go@@ -2654,10 +2654,22 @@ func TestSecureRuntimeQualificationPacketIsHostedAndReleaseBound(t *testing.T) {if strings.Contains(qualificationWorkflow, "release:\n types: [published]") {t.Fatal("secure-runtime qualification must be explicitly dispatched after immutable publication, not rely on suppressed release events")}+ preauthenticationIndex := strings.Index(qualificationWorkflow, "Pre-authenticate exact qualification packet")+ privilegedExecutionIndex := strings.Index(qualificationWorkflow, "docker run")+ if preauthenticationIndex < 0 || privilegedExecutionIndex < 0 || preauthenticationIndex > privilegedExecutionIndex {+ t.Fatal("secure-runtime release packet must be authenticated before any privileged Docker execution")+ }+ if strings.Contains(qualificationWorkflow, `$RUNNER_TEMP/secure-runtime-downloads:/release:ro`) {+ t.Fatal("privileged qualification must never mount caller-owned downloaded binaries as the executable packet")+ }for _, required := range []string{".immutable == true","ca-certificates curl dbus systemd systemd-sysv util-linux",`for command in curl id nsenter runuser systemctl`,+ "--verify-release-packet-only",+ "--verified-packet-dir",+ "$RUNNER_TEMP/secure-runtime-verified:/release:ro",+ "$RUNNER_TEMP/secure-runtime-harness:/harness:ro","PULSE_SECURE_RUNTIME_SYSTEMD_LAB=disposable-v1","^TestSecureRuntimeSystemdLab$","--release-candidate-tag",diff --git a/scripts/release_control/secure_runtime_attestation_v6.py b/scripts/release_control/secure_runtime_attestation_v6.pyindex 25566c6e08..3e063499fa 100644--- a/scripts/release_control/secure_runtime_attestation_v6.py+++ b/scripts/release_control/secure_runtime_attestation_v6.py@@ -12,6 +12,7 @@ import jsonimport mathimport osimport re+import shutilimport statimport subprocessimport sys@@ -41,6 +42,7 @@ CHECKSUMS_NAME = "checksums.txt"ASSEMBLY_PROVENANCE_NAME = "release-build-provenance.sigstore.json"COMPILER_PROVENANCE_NAME = "secure-runtime-compiler-provenance.sigstore.json"COLLECTOR_SIGNATURE_NAMES = ("collector_v1", "collector_v2", "collector_v3", "collector_v4")+SUPPORTED_RELEASE_ARCHITECTURES = ("amd64", "arm64")REQUIRED_SCENARIOS = ("legacy_root_command_capable_install",@@ -408,6 +410,36 @@ def immutable_signature_snapshot()+def expected_release_asset_names(architecture: str) -> dict[str, str]:+ if architecture not in SUPPORTED_RELEASE_ARCHITECTURES:+ raise v5.AttestationError(+ f"secure-runtime release architecture must be one of {', '.join(SUPPORTED_RELEASE_ARCHITECTURES)}"+ )+ return {+ "collector_v1": f"pulse-secure-runtime-collector-v1-linux-{architecture}",+ "collector_v2": f"pulse-secure-runtime-collector-v2-linux-{architecture}",+ "collector_v3": f"pulse-secure-runtime-collector-v3-linux-{architecture}",+ "collector_v4": f"pulse-agent-linux-{architecture}",+ "helper": f"pulse-agent-helper-linux-{architecture}",+ "runner": f"pulse-agent-runner-linux-{architecture}",+ }+++def expected_release_artifact_versions(tag: str) -> dict[str, str]:+ if not RELEASE_TAG_RE.fullmatch(tag):+ raise v5.AttestationError("release candidate tag must be an exact vX.Y.Z-rc.N tag")+ release_version = tag[1:]+ predecessor_base = release_version.split("-", 1)[0]+ return {+ "collector_v1": f"{predecessor_base}-0.secure.v6.1",+ "collector_v2": f"{predecessor_base}-0.secure.v6.2",+ "collector_v3": f"{predecessor_base}-0.secure.v6.3",+ "collector_v4": release_version,+ "helper": release_version,+ "runner": release_version,+ }++def verify_release_build_contract(*,path: Path,@@ -458,6 +490,11 @@ def verify_release_build_contract(receipt_versions = receipt.get("artifact_versions")if not isinstance(receipt_versions, dict):raise v5.AttestationError("receipt artifact_versions are unavailable")+ architecture = receipt.get("architecture")+ if not isinstance(architecture, str):+ raise v5.AttestationError("receipt architecture is unavailable")+ expected_assets = expected_release_asset_names(architecture)+ expected_versions = expected_release_artifact_versions(tag)verified: dict[str, Any] = {}seen_release_assets: set[str] = set()for name, expected_package in v5.EXPECTED_ARTIFACT_PACKAGES.items():@@ -471,6 +508,10 @@ def verify_release_build_contract(or release_asset in seen_release_assets):raise v5.AttestationError(f"secure-runtime build contract release asset for {name} is invalid")+ if release_asset != expected_assets[name]:+ raise v5.AttestationError(+ f"secure-runtime build contract release asset for {name} does not match the canonical release name"+ )seen_release_assets.add(release_asset)if entry.get("sha256") != artifact_hashes[name] or checksums.get(release_asset) != artifact_hashes[name]:raise v5.AttestationError(f"artifact {name} is not bound to the signed release checksums")@@ -481,7 +522,7 @@ def verify_release_build_contract("tool": "go build","package": expected_package,"target_os": "linux",- "target_arch": receipt.get("architecture"),+ "target_arch": architecture,"cgo_enabled": 0,"trimpath": True,"buildvcs": False,@@ -497,6 +538,8 @@ def verify_release_build_contract(if not isinstance(artifact_version, str) or not artifact_version:raise v5.AttestationError(f"artifact {name} version is invalid")normalized_artifact_version = artifact_version.removeprefix("v")+ if normalized_artifact_version != expected_versions[name]:+ raise v5.AttestationError(f"artifact {name} version does not match the canonical release build")if name.startswith("collector_v"):receipt_version = receipt_versions.get(name)if (@@ -533,6 +576,160 @@ def verify_release_build_contract(return verified+def verify_and_snapshot_release_candidate_packet(+ *,+ checkout: Path,+ qualified_commit: str,+ main_ref: str,+ tag: str,+ repository: str,+ release_id: str,+ checksums_path: Path,+ assembly_provenance_path: Path,+ compiler_provenance_path: Path,+ build_contract_path: Path,+ expected_update_key_fingerprint: str,+ architecture: str,+ artifacts: dict[str, Path],+ collector_signatures: dict[str, Path],+ output_dir: Path,+) -> dict[str, Any]:+ """Authenticate a release packet before any candidate binary is executed.++ Every caller-owned input is copied once into a private directory. All+ release, provenance, checksum, build-contract, and update-signature checks+ operate on those copies. The directory becomes caller-visible only after+ verification succeeds, so the privileged lab can mount exactly the bytes+ that crossed the trust boundary.+ """++ checkout = checkout.resolve()+ resolved_commit = v5.resolve_commit(checkout, qualified_commit, "qualified commit")+ if qualified_commit != resolved_commit:+ raise v5.AttestationError("qualified commit must be the full canonical commit SHA")+ v5.require_detached_clean_checkout(checkout, resolved_commit)+ main_commit = verify_canonical_main_identity(checkout, main_ref)+ v5.require_ancestor(checkout, resolved_commit, CANONICAL_MAIN_REF)++ expected_assets = expected_release_asset_names(architecture)+ expected_versions = expected_release_artifact_versions(tag)+ if set(artifacts) != set(v5.ARTIFACT_ARGUMENTS):+ raise v5.AttestationError("qualification artifact set is incomplete")+ if set(collector_signatures) != set(COLLECTOR_SIGNATURE_NAMES):+ raise v5.AttestationError("collector release signature set is incomplete")++ output_dir = Path(os.path.abspath(output_dir))+ if output_dir.exists() or output_dir.is_symlink():+ raise v5.AttestationError("verified packet output directory must not already exist")+ output_parent = output_dir.parent+ try:+ parent_stat = output_parent.lstat()+ except OSError as exc:+ raise v5.AttestationError(f"unable to inspect verified packet parent directory: {exc}") from exc+ if stat.S_ISLNK(parent_stat.st_mode) or not stat.S_ISDIR(parent_stat.st_mode):+ raise v5.AttestationError("verified packet parent must be a real directory")++ staging = Path(tempfile.mkdtemp(prefix=".pulse-secure-runtime-verified-", dir=output_parent))+ staging.chmod(0o700)+ snapshot_digests: dict[str, str] = {}+ snapshot_artifacts: dict[str, Path] = {}+ snapshot_signatures: dict[str, Path] = {}+ try:+ sidecar_sources = {+ CHECKSUMS_NAME: checksums_path,+ ASSEMBLY_PROVENANCE_NAME: assembly_provenance_path,+ COMPILER_PROVENANCE_NAME: compiler_provenance_path,+ BUILD_CONTRACT_NAME: build_contract_path,+ }+ for filename, source in sidecar_sources.items():+ destination = staging / filename+ snapshot_digests[filename] = copy_release_sidecar(source, destination, filename)++ for name in v5.ARTIFACT_ARGUMENTS:+ source = artifacts[name]+ expected_filename = expected_assets[name]+ if source.name != expected_filename:+ raise v5.AttestationError(+ f"qualification artifact {name} must be named {expected_filename}"+ )+ destination = staging / expected_filename+ snapshot_digests[expected_filename] = copy_immutable_input(+ source, destination, f"qualification artifact {name}"+ )+ snapshot_artifacts[name] = destination++ for name in COLLECTOR_SIGNATURE_NAMES:+ expected_filename = expected_assets[name] + ".sig"+ source = collector_signatures[name]+ if source.name != expected_filename:+ raise v5.AttestationError(+ f"collector release signature {name} must be named {expected_filename}"+ )+ destination = staging / expected_filename+ snapshot_digests[expected_filename] = copy_immutable_input(+ source, destination, f"collector release signature {name}"+ )+ snapshot_signatures[name] = destination++ preexecution_receipt = {+ "architecture": architecture,+ "artifact_versions": {+ name: expected_versions[name] for name in COLLECTOR_SIGNATURE_NAMES+ },+ }+ artifact_hashes = {+ name: snapshot_digests[expected_assets[name]] for name in v5.ARTIFACT_ARGUMENTS+ }+ packet = verify_release_candidate_packet(+ checkout=checkout,+ qualified_commit=resolved_commit,+ tag=tag,+ repository=repository,+ release_id=release_id,+ checksums_path=staging / CHECKSUMS_NAME,+ assembly_provenance_path=staging / ASSEMBLY_PROVENANCE_NAME,+ compiler_provenance_path=staging / COMPILER_PROVENANCE_NAME,+ build_contract_path=staging / BUILD_CONTRACT_NAME,+ expected_update_key_fingerprint=expected_update_key_fingerprint,+ receipt=preexecution_receipt,+ artifacts=snapshot_artifacts,+ artifact_hashes=artifact_hashes,+ collector_signatures=snapshot_signatures,+ )+ for filename, expected_digest in snapshot_digests.items():+ if sha256_file(staging / filename) != expected_digest:+ raise v5.AttestationError(+ f"private verified packet snapshot {filename} changed during verification"+ )+ for path in snapshot_artifacts.values():+ path.chmod(0o500)+ directory_fd = os.open(staging, os.O_RDONLY | getattr(os, "O_DIRECTORY", 0))+ try:+ os.fsync(directory_fd)+ finally:+ os.close(directory_fd)+ staging.rename(output_dir)+ except Exception:+ shutil.rmtree(staging, ignore_errors=True)+ raise++ return {+ "schema_version": 1,+ "verification": "preexecution-release-packet",+ "qualified_commit": resolved_commit,+ "main_ref_verified": main_ref,+ "main_ref_commit_at_verification": main_commit,+ "release_candidate_tag": tag,+ "release_repository": repository,+ "release_id": release_id,+ "architecture": architecture,+ "verified_packet_dir": str(output_dir),+ "snapshot_digests": snapshot_digests,+ "release_packet": packet,+ "safe_to_execute": True,+ }++def verify_release_candidate_packet(*,checkout: Path,@@ -918,16 +1115,19 @@ def parse_args(argv: Sequence[str]) -> argparse.Namespace:parser.add_argument("--checkout", type=Path, required=True)parser.add_argument("--commit", required=True)parser.add_argument("--main-ref", default=CANONICAL_MAIN_REF)- parser.add_argument("--receipt", type=Path, required=True)- parser.add_argument("--receipt-record-path", required=True)- parser.add_argument("--transcript", type=Path, required=True)+ parser.add_argument("--verify-release-packet-only", action="store_true")+ parser.add_argument("--verified-packet-dir", type=Path)+ parser.add_argument("--expected-architecture")+ parser.add_argument("--receipt", type=Path)+ parser.add_argument("--receipt-record-path")+ parser.add_argument("--transcript", type=Path)parser.add_argument("--collector-v1", type=Path, required=True)parser.add_argument("--collector-v2", type=Path, required=True)parser.add_argument("--collector-v3", type=Path, required=True)parser.add_argument("--collector-v4", type=Path, required=True)parser.add_argument("--helper", type=Path, required=True)parser.add_argument("--runner", type=Path, required=True)- parser.add_argument("--elapsed-seconds", type=float, required=True)+ parser.add_argument("--elapsed-seconds", type=float)parser.add_argument("--release-candidate-tag")parser.add_argument("--release-repository")parser.add_argument("--release-id")@@ -970,30 +1170,80 @@ def main(argv: Sequence[str] | None = None) -> int:return 1collector_signatures = dict(zip(COLLECTOR_SIGNATURE_NAMES, signature_arguments, strict=True))try:- attestation = create_attestation(- checkout=args.checkout,- commit=args.commit,- main_ref=args.main_ref,- receipt_path=args.receipt,- receipt_record_path=args.receipt_record_path,- transcript_path=args.transcript,- artifacts=artifacts,- elapsed_seconds=args.elapsed_seconds,- release_candidate_tag=args.release_candidate_tag,- release_repository=args.release_repository,- release_id=args.release_id,- release_checksums_path=args.release_checksums,- release_assembly_provenance_path=args.release_assembly_provenance,- release_compiler_provenance_path=args.release_compiler_provenance,- release_build_contract_path=args.release_build_contract,- expected_release_update_key_fingerprint=args.expected_release_update_key_fingerprint,- collector_signatures=collector_signatures,- )- args.output.write_text(json.dumps(attestation, indent=2) + "\n", encoding="utf-8")+ if args.verify_release_packet_only:+ required_preexecution = {+ "verified packet directory": args.verified_packet_dir,+ "expected architecture": args.expected_architecture,+ "release candidate tag": args.release_candidate_tag,+ "release repository": args.release_repository,+ "release id": args.release_id,+ "release checksums": args.release_checksums,+ "release assembly provenance": args.release_assembly_provenance,+ "release compiler provenance": args.release_compiler_provenance,+ "release build contract": args.release_build_contract,+ "release update-key fingerprint": args.expected_release_update_key_fingerprint,+ "collector signatures": collector_signatures,+ }+ missing = [label for label, value in required_preexecution.items() if value is None]+ if missing:+ raise v5.AttestationError(+ "pre-execution release verification requires " + ", ".join(missing)+ )+ result = verify_and_snapshot_release_candidate_packet(+ checkout=args.checkout,+ qualified_commit=args.commit,+ main_ref=args.main_ref,+ tag=str(args.release_candidate_tag),+ repository=str(args.release_repository),+ release_id=str(args.release_id),+ checksums_path=Path(args.release_checksums),+ assembly_provenance_path=Path(args.release_assembly_provenance),+ compiler_provenance_path=Path(args.release_compiler_provenance),+ build_contract_path=Path(args.release_build_contract),+ expected_update_key_fingerprint=str(+ args.expected_release_update_key_fingerprint+ ),+ architecture=str(args.expected_architecture),+ artifacts=artifacts,+ collector_signatures=dict(collector_signatures),+ output_dir=Path(args.verified_packet_dir),+ )+ success_label = "secure runtime schema-v6 pre-execution verification passed"+ else:+ required_attestation = {+ "receipt": args.receipt,+ "receipt record path": args.receipt_record_path,+ "transcript": args.transcript,+ "elapsed seconds": args.elapsed_seconds,+ }+ missing = [label for label, value in required_attestation.items() if value is None]+ if missing:+ raise v5.AttestationError("attestation requires " + ", ".join(missing))+ result = create_attestation(+ checkout=args.checkout,+ commit=args.commit,+ main_ref=args.main_ref,+ receipt_path=Path(args.receipt),+ receipt_record_path=str(args.receipt_record_path),+ transcript_path=Path(args.transcript),+ artifacts=artifacts,+ elapsed_seconds=float(args.elapsed_seconds),+ release_candidate_tag=args.release_candidate_tag,+ release_repository=args.release_repository,+ release_id=args.release_id,+ release_checksums_path=args.release_checksums,+ release_assembly_provenance_path=args.release_assembly_provenance,+ release_compiler_provenance_path=args.release_compiler_provenance,+ release_build_contract_path=args.release_build_contract,+ expected_release_update_key_fingerprint=args.expected_release_update_key_fingerprint,+ collector_signatures=collector_signatures,+ )+ success_label = "secure runtime schema-v6 attestation passed"+ args.output.write_text(json.dumps(result, indent=2) + "\n", encoding="utf-8")except v5.AttestationError as exc:print(f"secure runtime schema-v6 attestation failed: {exc}", file=sys.stderr)return 1- print(f"secure runtime schema-v6 attestation passed: {args.output}")+ print(f"{success_label}: {args.output}")return 0diff --git a/scripts/release_control/secure_runtime_attestation_v6_test.py b/scripts/release_control/secure_runtime_attestation_v6_test.pyindex a8c3548fbe..91db466794 100644--- a/scripts/release_control/secure_runtime_attestation_v6_test.py+++ b/scripts/release_control/secure_runtime_attestation_v6_test.py@@ -37,8 +37,11 @@ from secure_runtime_attestation_v6 import (SOURCE_MANIFEST_PATH,copy_release_sidecar,create_attestation,+ expected_release_asset_names,+ expected_release_artifact_versions,immutable_artifact_snapshot,parse_args,+ verify_and_snapshot_release_candidate_packet,verify_release_build_contract,verify_canonical_main_identity,verify_release_candidate_packet,@@ -60,10 +63,9 @@ class SecureRuntimeAttestationV6Test(unittest.TestCase):self.receipt = {"architecture": "arm64","artifact_versions": {- "collector_v1": "v6.5.0-lab.1",- "collector_v2": "v6.5.0-lab.2",- "collector_v3": "v6.5.0-lab.3",- "collector_v4": "v6.5.0-lab.4",+ name: version+ for name, version in expected_release_artifact_versions(self.tag).items()+ if name.startswith("collector_v")},}self.artifact_hashes = {@@ -71,8 +73,9 @@ class SecureRuntimeAttestationV6Test(unittest.TestCase):for name in v5.ARTIFACT_ARGUMENTS}self.artifacts = {}+ release_assets = expected_release_asset_names("arm64")for name in v5.ARTIFACT_ARGUMENTS:- path = self.root / f"artifact-{name}"+ path = self.root / release_assets[name]path.write_bytes(name.encode())self.artifacts[name] = pathcontract = self.build_contract()@@ -98,7 +101,7 @@ class SecureRuntimeAttestationV6Test(unittest.TestCase):f"EmbeddedTrustedPublicKeys={self.update_public_keys}")artifacts[name] = {- "release_asset": f"pulse-secure-runtime-{name}-linux-arm64",+ "release_asset": expected_release_asset_names("arm64")[name],"sha256": self.artifact_hashes[name],"build": {"tool": "go build",@@ -290,6 +293,158 @@ class SecureRuntimeAttestationV6Test(unittest.TestCase):snapshots["collector_v1"].chmod(0o600)snapshots["collector_v1"].write_bytes(b"mutated")+ def test_preexecution_verification_publishes_only_verified_private_snapshots(self) -> None:+ contract_path, checksums_path, _ = self.write_contract_and_checksums()+ assembly_provenance_path = self.root / ASSEMBLY_PROVENANCE_NAME+ assembly_provenance_path.write_text("{}\n", encoding="utf-8")+ compiler_provenance_path = self.root / COMPILER_PROVENANCE_NAME+ compiler_provenance_path.write_text("{}\n", encoding="utf-8")+ output_dir = self.root / "verified-packet"+ observed_snapshot_paths: dict[str, Path] = {}++ def verify_snapshots(**kwargs):+ for name, snapshot in kwargs["artifacts"].items():+ self.assertNotEqual(snapshot, self.artifacts[name])+ self.assertEqual(snapshot.read_bytes(), name.encode())+ observed_snapshot_paths[name] = snapshot+ self.artifacts[name].write_bytes(b"caller-owned-input-was-swapped")+ self.assertEqual(snapshot.read_bytes(), name.encode())+ return {+ "release_id": "12345",+ "build_identity": {+ name: {"release_asset": expected_release_asset_names("arm64")[name]}+ for name in v5.ARTIFACT_ARGUMENTS+ },+ "update_key_fingerprint": self.fingerprint,+ }++ with (+ mock.patch.object(v5, "resolve_commit", return_value=self.commit),+ mock.patch.object(v5, "require_detached_clean_checkout"),+ mock.patch.object(v5, "require_ancestor"),+ mock.patch(+ "secure_runtime_attestation_v6.verify_canonical_main_identity",+ return_value=self.commit,+ ),+ mock.patch(+ "secure_runtime_attestation_v6.verify_release_candidate_packet",+ side_effect=verify_snapshots,+ ),+ ):+ result = verify_and_snapshot_release_candidate_packet(+ checkout=self.root,+ qualified_commit=self.commit,+ main_ref=CANONICAL_MAIN_REF,+ tag=self.tag,+ repository=CANONICAL_REPOSITORY,+ release_id="12345",+ checksums_path=checksums_path,+ assembly_provenance_path=assembly_provenance_path,+ compiler_provenance_path=compiler_provenance_path,+ build_contract_path=contract_path,+ expected_update_key_fingerprint=self.fingerprint,+ architecture="arm64",+ artifacts=self.artifacts,+ collector_signatures=self.collector_signatures,+ output_dir=output_dir,+ )++ self.assertTrue(result["safe_to_execute"])+ self.assertEqual(set(observed_snapshot_paths), set(v5.ARTIFACT_ARGUMENTS))+ for name, release_asset in expected_release_asset_names("arm64").items():+ verified = output_dir / release_asset+ self.assertEqual(verified.read_bytes(), name.encode())+ self.assertEqual(verified.stat().st_mode & 0o777, 0o500)+ self.assertEqual(output_dir.stat().st_mode & 0o777, 0o700)++ def test_preexecution_verification_failure_never_publishes_executable_packet(self) -> None:+ contract_path, checksums_path, _ = self.write_contract_and_checksums()+ assembly_provenance_path = self.root / ASSEMBLY_PROVENANCE_NAME+ assembly_provenance_path.write_text("{}\n", encoding="utf-8")+ compiler_provenance_path = self.root / COMPILER_PROVENANCE_NAME+ compiler_provenance_path.write_text("{}\n", encoding="utf-8")+ output_dir = self.root / "verified-packet"++ with (+ mock.patch.object(v5, "resolve_commit", return_value=self.commit),+ mock.patch.object(v5, "require_detached_clean_checkout"),+ mock.patch.object(v5, "require_ancestor"),+ mock.patch(+ "secure_runtime_attestation_v6.verify_canonical_main_identity",+ return_value=self.commit,+ ),+ mock.patch(+ "secure_runtime_attestation_v6.verify_release_candidate_packet",+ side_effect=v5.AttestationError("tampered signature"),+ ),+ self.assertRaisesRegex(v5.AttestationError, "tampered signature"),+ ):+ verify_and_snapshot_release_candidate_packet(+ checkout=self.root,+ qualified_commit=self.commit,+ main_ref=CANONICAL_MAIN_REF,+ tag=self.tag,+ repository=CANONICAL_REPOSITORY,+ release_id="12345",+ checksums_path=checksums_path,+ assembly_provenance_path=assembly_provenance_path,+ compiler_provenance_path=compiler_provenance_path,+ build_contract_path=contract_path,+ expected_update_key_fingerprint=self.fingerprint,+ architecture="arm64",+ artifacts=self.artifacts,+ collector_signatures=self.collector_signatures,+ output_dir=output_dir,+ )+ self.assertFalse(output_dir.exists())++ def test_preexecution_verification_rejects_verified_snapshot_mutation(self) -> None:+ contract_path, checksums_path, _ = self.write_contract_and_checksums()+ assembly_provenance_path = self.root / ASSEMBLY_PROVENANCE_NAME+ assembly_provenance_path.write_text("{}\n", encoding="utf-8")+ compiler_provenance_path = self.root / COMPILER_PROVENANCE_NAME+ compiler_provenance_path.write_text("{}\n", encoding="utf-8")+ output_dir = self.root / "verified-packet"++ def mutate_verified_snapshot(**kwargs):+ snapshot = kwargs["artifacts"]["collector_v1"]+ snapshot.chmod(0o600)+ snapshot.write_bytes(b"mutated-after-verification")+ return {"build_identity": {}, "update_key_fingerprint": self.fingerprint}++ with (+ mock.patch.object(v5, "resolve_commit", return_value=self.commit),+ mock.patch.object(v5, "require_detached_clean_checkout"),+ mock.patch.object(v5, "require_ancestor"),+ mock.patch(+ "secure_runtime_attestation_v6.verify_canonical_main_identity",+ return_value=self.commit,+ ),+ mock.patch(+ "secure_runtime_attestation_v6.verify_release_candidate_packet",+ side_effect=mutate_verified_snapshot,+ ),+ self.assertRaisesRegex(v5.AttestationError, "changed during verification"),+ ):+ verify_and_snapshot_release_candidate_packet(+ checkout=self.root,+ qualified_commit=self.commit,+ main_ref=CANONICAL_MAIN_REF,+ tag=self.tag,+ repository=CANONICAL_REPOSITORY,+ release_id="12345",+ checksums_path=checksums_path,+ assembly_provenance_path=assembly_provenance_path,+ compiler_provenance_path=compiler_provenance_path,+ build_contract_path=contract_path,+ expected_update_key_fingerprint=self.fingerprint,+ architecture="arm64",+ artifacts=self.artifacts,+ collector_signatures=self.collector_signatures,+ output_dir=output_dir,+ )+ self.assertFalse(output_dir.exists())+def test_rejects_head_branch_and_non_rc_release_identities(self) -> None:for value in ("HEAD", "main", "refs/heads/main", "refs/tags/v6.5.0-rc.1", "v6.5.0"):with self.subTest(value=value), self.assertRaisesRegex(v5.AttestationError, "exact vX.Y.Z-rc.N"):@@ -404,6 +559,20 @@ class SecureRuntimeAttestationV6Test(unittest.TestCase):lambda contract: contract["artifacts"]["helper"]["build"].__setitem__("ldflags_sha256", "0" * 64),"ldflags digest",),+ (+ "noncanonical release asset",+ lambda contract: contract["artifacts"]["collector_v1"].__setitem__(+ "release_asset", "renamed-collector"+ ),+ "canonical release name",+ ),+ (+ "noncanonical predecessor version",+ lambda contract: contract["artifacts"]["collector_v2"]["build"].__setitem__(+ "version", "6.5.0-untrusted"+ ),+ "canonical release build",+ ),):contract = self.build_contract()mutate(contract)