myc

Self-custodial remote signer for Radroots apps
git clone https://radroots.dev/git/myc.git
Log | Files | Refs | README | LICENSE

commit 8f9ed4b072a10320d5c0c5c8ffeb639cb4afc94e
parent 98749386e3b39019fecbb0926c7a7c3fb820f761
Author: triesap <tyson@radroots.org>
Date:   Fri, 16 Oct 2026 13:59:18 +0000

build: Bind current Myc sources and artifacts to Rust 1.99

- Adopt the published Lib cohort in exact Cargo and Nix inputs.
- Generate a bounded canonical V4 lock and preserve V3 history.
- Update native provenance without inheriting Nix qualification.
- Verify runtime, API, dependency policy and parser regressions.

Diffstat:
MAGENTS.md | 9++++++++-
MCargo.lock | 39+++++++++++++++++++++------------------
MCargo.toml | 24++++++++++++------------
MREADME | 14++++++++------
Rradroots.service.source-lock.v3.toml -> contracts/release/history/radroots.service.source-lock.v3.toml | 0
Acontracts/release/myc-artifact-contract.v4.json | 144+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acontracts/services_hardening/native_release.v4.json | 140+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mflake.lock | 15++++++++-------
Mflake.nix | 6+++---
Aradroots.service.source_lock.v4.toml | 67+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Msupply-chain/audits.toml | 6+++++-
Mtests/build_policy.rs | 24++++++++++++------------
Mtests/services_hardening_local_signer_transport.rs | 2+-
Mtests/services_hardening_native_release.rs | 32++++++++++++++++++++------------
Mtests/services_hardening_runtime_context.rs | 2+-
Mtests/services_hardening_state_catalog.rs | 2+-
Mtools/xtask/src/main.rs | 125++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
17 files changed, 549 insertions(+), 102 deletions(-)

diff --git a/AGENTS.md b/AGENTS.md @@ -28,8 +28,15 @@ ## 2. Authority and preflight - Before editing, read this file, `README`, `Cargo.toml`, - `radroots.service.source-lock.v3.toml`, the relevant implementation and tests, + `radroots.service.source_lock.v4.toml`, the relevant implementation and tests, and `flake.nix` or migrations when they are in scope. +- Current compiler/source preparation uses the V4 lock and + `contracts/services_hardening/native_release.v4.json`. Nix inputs are bound; + executed current qualification remains separate. Generate a staged migration + with the source-locked Lib `service-source-lock --mode prepare`, verify and + commit it, then require its clean-source check. The unchanged archived V3 + lock and V2/V3 declarations retain historical scope. Step 300 tooling is + replay-only for its original source and does not qualify current inputs. - `.radroots-consumer-root` is the standalone source-lock identity and must remain exactly `myc`. The implemented control-plane contract is `contracts/services_hardening/operator_contract.v1.json`. diff --git a/Cargo.lock b/Cargo.lock @@ -1427,9 +1427,9 @@ dependencies = [ [[package]] name = "negentropy" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81c353b400a5503efdcf398f11a83fb7aa84f59f5d76fc4bf5bbc1e4f5366caa" +checksum = "a3d66662cb5ca384d4991509755ed5a42dd8e31c4282bf881938e506fc3146ec" [[package]] name = "nostr" @@ -1752,7 +1752,7 @@ checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" [[package]] name = "radroots_blossom" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "mediatype", "serde", @@ -1764,7 +1764,7 @@ dependencies = [ [[package]] name = "radroots_core" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "rust_decimal", "serde", @@ -1773,7 +1773,7 @@ dependencies = [ [[package]] name = "radroots_event" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "hex", "jiff-tzdb", @@ -1791,7 +1791,7 @@ dependencies = [ [[package]] name = "radroots_event_codec" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "hex", "radroots_blossom", @@ -1808,7 +1808,7 @@ dependencies = [ [[package]] name = "radroots_identity" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "k256", "serde", @@ -1818,7 +1818,7 @@ dependencies = [ [[package]] name = "radroots_nostr" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "nostr", "radroots_event", @@ -1832,7 +1832,7 @@ dependencies = [ [[package]] name = "radroots_nostr_connect" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "nostr", "radroots_event", @@ -1848,7 +1848,7 @@ dependencies = [ [[package]] name = "radroots_protocol" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "serde", ] @@ -1856,7 +1856,7 @@ dependencies = [ [[package]] name = "radroots_runtime_paths" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "rustix", "serde", @@ -1866,7 +1866,7 @@ dependencies = [ [[package]] name = "radroots_secrets" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "chacha20poly1305", "serde", @@ -1878,7 +1878,7 @@ dependencies = [ [[package]] name = "radroots_service_host" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "bytes", "fs2", @@ -1899,7 +1899,7 @@ dependencies = [ [[package]] name = "radroots_service_sqlite" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "fs2", "futures", @@ -1917,7 +1917,7 @@ dependencies = [ [[package]] name = "radroots_storage" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "radroots_event", "radroots_event_codec", @@ -1930,7 +1930,7 @@ dependencies = [ [[package]] name = "radroots_trade" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "radroots_core", "radroots_event", @@ -1940,7 +1940,7 @@ dependencies = [ [[package]] name = "radroots_transport" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "radroots_event", "radroots_identity", @@ -1951,7 +1951,7 @@ dependencies = [ [[package]] name = "radroots_transport_nostr" version = "0.1.0-alpha" -source = "git+https://github.com/radrootslabs/lib?rev=055096853fca95e15d0f813d33a14aca13be3881#055096853fca95e15d0f813d33a14aca13be3881" +source = "git+https://github.com/radrootslabs/lib?rev=386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a#386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" dependencies = [ "async-wsocket", "futures", @@ -1961,11 +1961,14 @@ dependencies = [ "radroots_nostr", "radroots_protocol", "radroots_transport", + "rustls", "serde_json", "sha2", "tokio", + "tokio-rustls", "tokio-tungstenite", "url", + "webpki-roots 0.26.11", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml @@ -18,7 +18,7 @@ default-members = ["."] [workspace.metadata.radroots.service_source_lock] service = "myc" host_feature_profile = "service-host" -nix_material = "qualified" +nix_material = "bound" config_contract_version = 1 state_contract_version = 12 admin_contract_version = 1 @@ -58,17 +58,17 @@ futures-executor = "0.3" hex = "0.4" jsonschema = { version = "0.48.1", default-features = false } nostr = { version = "0.44.2", features = ["nip04", "nip44", "nip46", "nip49"] } -radroots_identity = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" } -radroots_nostr = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", features = ["events"] } -radroots_nostr_connect = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" } -radroots_event_codec = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", features = ["json"] } -radroots_runtime_paths = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" } -radroots_service_host = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" } -radroots_service_sqlite = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" } -radroots_secrets = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", features = ["std"] } -radroots_storage = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", default-features = false } -radroots_transport = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", default-features = false } -radroots_transport_nostr = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" } +radroots_identity = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" } +radroots_nostr = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", features = ["events"] } +radroots_nostr_connect = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" } +radroots_event_codec = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", features = ["json"] } +radroots_runtime_paths = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" } +radroots_service_host = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" } +radroots_service_sqlite = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" } +radroots_secrets = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", features = ["std"] } +radroots_storage = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", default-features = false } +radroots_transport = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", default-features = false } +radroots_transport_nostr = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" } serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0", features = ["raw_value"] } sha2 = "0.10" diff --git a/README b/README @@ -35,7 +35,7 @@ let _snapshot = MycStatusSnapshot {}; ``` The native package, artifact, and dependency-trust boundary is frozen by -`contracts/services_hardening/native_release.v3.json`. Linux x86_64 and +`contracts/services_hardening/native_release.v4.json`. Linux x86_64 and aarch64 are the only admitted native artifact targets. `cargo xtask native-release` consumes an exact prebuilt target binary from a clean Git head and deterministically writes or checks the complete binary/source archive, @@ -61,11 +61,13 @@ enable, start, stop, or deploy a production service. The canonical service source lock binds the exact active public Lib cohort, Cargo lock, verified Lib source archive, toolchain, feature profile, and -service contract versions. Source-lock v3 binds the public flake lock to the -same exact Lib revision as Cargo and records qualified Nix material for only -macOS aarch64 and Linux x86_64. The Linux-only NixOS module and unsigned OCI -derivation are build outputs; signing, tags, publication, deployment, and -production activation remain unclaimed. +service contract versions. Source-lock V4 binds the public flake lock to the +same exact Lib revision as Cargo and requires Rust 1.99.0. Its Nix material is +bound input, with current macOS aarch64 and Linux x86_64 execution evidence +required separately. Historical V2/V3 declarations and the archived V3 lock +retain their original scope. NixOS/OCI artifacts, signing, tags, release +publication, deployment and production activation are not established by +these preparation declarations. ## Hardened v1 configuration contract diff --git a/radroots.service.source-lock.v3.toml b/contracts/release/history/radroots.service.source-lock.v3.toml diff --git a/contracts/release/myc-artifact-contract.v4.json b/contracts/release/myc-artifact-contract.v4.json @@ -0,0 +1,144 @@ +{ + "artifact_policy": { + "checksums": "required", + "cyclonedx_version": "1.6", + "exact_tree_source_archives": "required", + "fresh_install": "required", + "git_history_bundles": "forbidden", + "intoto_statement": "required", + "notices": "required", + "reproducibility_build_count": 2, + "secret_scan": "required", + "unsigned_packages": "required", + "unsigned_slsa_provenance": "required" + }, + "contract_version": 4, + "delivery": { + "candidate_class": "unsigned_nonpublishing", + "developer_id_signing": "forbidden", + "developer_team_id": "forbidden", + "distribution_signing": "forbidden", + "embedded_platform_adhoc_signing": "permitted_non_distribution_only", + "g2": "unauthorized", + "notarization": "unauthorized", + "production_activation": "unauthorized", + "publication": "unauthorized", + "signing": "unauthorized" + }, + "output": [ + { + "classification": "required_target", + "id": "package", + "platforms": [ + "macos_aarch64", + "linux_x86_64" + ] + }, + { + "classification": "required_target", + "id": "app", + "platforms": [ + "macos_aarch64", + "linux_x86_64" + ] + }, + { + "classification": "required_target", + "id": "check", + "platforms": [ + "macos_aarch64", + "linux_x86_64" + ] + }, + { + "classification": "required_target", + "id": "devshell", + "platforms": [ + "macos_aarch64", + "linux_x86_64" + ] + }, + { + "classification": "required_target", + "id": "nixos_module", + "platforms": [ + "linux_x86_64" + ] + }, + { + "classification": "required_target", + "id": "oci", + "platforms": [ + "linux_x86_64" + ] + } + ], + "package_contract": { + "artifact_format": "nix_store_derivation", + "binary_name": "myc", + "cargo_package": "myc", + "flake_app": "apps.<system>.default", + "flake_package": "packages.<system>.default", + "identity": "myc", + "package_version": "0.1.0", + "product_version": "0.1.0" + }, + "platforms": [ + "macos_aarch64", + "linux_x86_64" + ], + "producer": { + "command_authority": "repository_flake", + "kind": "nix_flake", + "nix_binding": "required", + "source_task": "nix_build_repository_outputs", + "execution_evidence": "separate_source_scoped_receipts" + }, + "repository": "oss/myc", + "schema": "radroots.release.artifact-contract.v4", + "source_archive": { + "binding": "canonical_exact_source_revision_tree_archive", + "compression": "none", + "compression_timestamp": "not_applicable", + "content": "exact_source_revision_tree", + "directory_entries": "omitted", + "entry_order": "bytewise_git_path", + "file_mode": "git_index_100644_or_100755", + "format": "ustar", + "gid": 0, + "git_history": "forbidden", + "gname": "", + "hardlinks": "forbidden", + "mtime_source": "candidate_source_date_epoch", + "path_prefix": "none", + "pax_headers": "forbidden", + "submodules": "forbidden", + "symlinks": "forbidden", + "trailer": "two_zero_blocks", + "uid": 0, + "uname": "" + }, + "source_binding": { + "dirty_tree": "forbidden", + "kind": "exact_clean_git_commit", + "revision_location": "aggregate_source_revision" + }, + "sqlite": { + "high_level_authority": "sqlx_only", + "incremental_backup_adapter": "sealed_native_sqlx_owned_locked_handle_only", + "native_linkage_count": 1, + "second_pool_connection_query_transaction_migration_authority": "forbidden" + }, + "predecessor": { + "filename": "myc-artifact-contract.v3.json", + "contract_version": 3, + "status": "historical" + }, + "state": "active_unsigned_preparation", + "toolchain": { + "rust_version": "1.99.0", + "edition": "2024", + "host_feature_profile": "service-host" + }, + "qualification_posture": "bound_inputs_require_separate_current_execution_evidence" +} diff --git a/contracts/services_hardening/native_release.v4.json b/contracts/services_hardening/native_release.v4.json @@ -0,0 +1,140 @@ +{ + "schema": "radroots.myc.native-release", + "schema_version": 4, + "contract_version": 4, + "predecessor": { + "schema_version": 3, + "filename": "native_release.v3.json", + "transition": "forward_only_replace" + }, + "service": "myc", + "package": { + "name": "myc", + "binary": "myc", + "version": "0.1.0", + "repository": "https://github.com/radrootslabs/myc", + "publish_to_crates_io": false + }, + "generator": { + "command": "cargo xtask native-release", + "modes": [ + "check", + "write" + ], + "required_arguments": [ + "mode", + "target", + "binary", + "output", + "source_date_epoch" + ], + "source_date_epoch_range": "1..=4294967295", + "clean_exact_head": true, + "target_binary_validation": "executable_elf64_little_endian_exact_machine", + "canonical_json": "compact_utf8_json_with_one_final_lf", + "deterministic_archives": true, + "output_directory_mode": "0755", + "output_file_mode": "0644", + "durability": "sync_files_then_output_directory_then_parent" + }, + "toolchain": { + "rust_version": "1.99.0", + "edition": "2024", + "resolver": "3", + "host_feature_profile": "service-host" + }, + "release_profile": { + "lto": "thin", + "codegen_units": 1, + "overflow_checks": true, + "strip": "symbols", + "panic": "unwind" + }, + "source_lock": { + "filename": "radroots.service.source_lock.v4.toml", + "schema": "radroots.service.source_lock.v4", + "lib_repository": "https://github.com/radrootslabs/lib", + "architecture": "radroots.crates.release.v2", + "nix_material": "bound" + }, + "contract_versions": { + "config": 1, + "state": 12, + "admin": 1, + "status": 1, + "provider": 1 + }, + "native_targets": [ + { + "target": "aarch64-unknown-linux-gnu", + "posture": "target" + }, + { + "target": "x86_64-unknown-linux-gnu", + "posture": "target" + } + ], + "output_inventory": [ + "LICENSE", + "SHA256SUMS", + "THIRD-PARTY-NOTICES.txt", + "artifact-manifest.v1.json", + "binary.tar.gz", + "config.example.toml", + "config.schema.json", + "provenance-input.v1.json", + "radroots.service.source_lock.v4.toml", + "sbom.cdx.json", + "service-source.tar.gz", + "systemd.service" + ], + "nix_outputs": { + "systems": [ + "aarch64-darwin", + "x86_64-linux" + ], + "package_app_check_devshell": "requires_separate_current_execution_evidence", + "nixos_module": "x86_64-linux_only", + "oci": "x86_64-linux_unsigned_nonpublishing", + "bundled_sqlite": true, + "native_linkage_count": 1 + }, + "signing_inputs": [ + "SHA256SUMS", + "artifact-manifest.v1.json", + "provenance-input.v1.json" + ], + "provenance_posture": "deterministic_unsigned_slsa_v1_input_external_keys_only", + "sbom_format": "cyclonedx_json_1_5_locked_cargo_graph", + "source_archive": "locked_offline_cargo_build_with_vendored_dependencies", + "checksum_format": "sha256_lower_hex_two_spaces_path_lf_sorted_by_path", + "protected_material_included": false, + "maximums": { + "text_input_bytes": 1048576, + "generated_document_bytes": 16777216, + "cargo_metadata_bytes": 33554432, + "binary_bytes": 536870912, + "source_archive_bytes": 1073741824, + "packages": 8192, + "tracked_files": 4096, + "source_lock_bytes": 16384 + }, + "forbidden": [ + "protected_material", + "parent_owned_human_docs", + "private_harness", + "local_or_path_lib_dependency", + "floating_or_branch_lib_dependency", + "mixed_lib_revision", + "system_sqlite", + "second_sqlite_linkage", + "crates_io_publication", + "signing", + "tagging", + "release_publication", + "deployment", + "production_activation" + ], + "qualification_posture": "source_bound_preparation", + "nix_qualified": false +} diff --git a/flake.lock b/flake.lock @@ -45,17 +45,17 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1788739124, - "narHash": "sha256-Aw8qbU1DrtxSYJKg0js6kexnKgVGFCjR34bgq+ZVAVo=", + "lastModified": 1792158226, + "narHash": "sha256-JuDYlQok9ujR5TAOvSHAMbi6SwPLXk1A5KOyxI53658=", "owner": "radrootslabs", "repo": "lib", - "rev": "055096853fca95e15d0f813d33a14aca13be3881", + "rev": "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", "type": "github" }, "original": { "owner": "radrootslabs", "repo": "lib", - "rev": "055096853fca95e15d0f813d33a14aca13be3881", + "rev": "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", "type": "github" } }, @@ -112,16 +112,17 @@ ] }, "locked": { - "lastModified": 1785131767, - "narHash": "sha256-VNbQv2P0zgaNh96mT4LrnX7hdXgiC5nBH+uvyrrVX7U=", + "lastModified": 1792087235, + "narHash": "sha256-vQHkG9lwSHJI3MVnyilP50hWW3TNnBWFTbLIurWgPhI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c67ce00525464a710971351c183ce67acb6ca827", + "rev": "87ffb7f777aef2e2647fd8fd718a5b3cbc825588", "type": "github" }, "original": { "owner": "oxalica", "repo": "rust-overlay", + "rev": "87ffb7f777aef2e2647fd8fd718a5b3cbc825588", "type": "github" } }, diff --git a/flake.nix b/flake.nix @@ -8,7 +8,7 @@ # that upstream fetch defect while preserving the same locked sources. crane.url = "github:ipetkov/crane/01bc1d404a51a0a07e9d8759cd50a7903e218c82"; lib = { - url = "github:radrootslabs/lib/055096853fca95e15d0f813d33a14aca13be3881"; + url = "github:radrootslabs/lib/386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a"; inputs.crane.follows = "crane"; }; nixpkgs.follows = "lib/nixpkgs"; @@ -131,8 +131,8 @@ buildInfo = { serviceVersion = "0.1.0"; serviceCommit = self.rev or "0000000000000000000000000000000000000000"; - libRevision = "055096853fca95e15d0f813d33a14aca13be3881"; - rustVersion = "1.97.1"; + libRevision = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a"; + rustVersion = "1.99.0"; target = "x86_64-unknown-linux-gnu"; featureProfile = "service-host"; contractVersions = { diff --git a/radroots.service.source_lock.v4.toml b/radroots.service.source_lock.v4.toml @@ -0,0 +1,67 @@ +schema = "radroots.service.source_lock.v4" +contract_version = 4 +service = "myc" +repository = "https://github.com/radrootslabs/lib" +revision = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" +architecture = "radroots.crates.release.v2" +workspace_catalog_sha256 = "f6f0d6af573b28e5b5bf7c6862d26ba6a5583d5674149fb4e96f8a6630b51735" +version = "0.1.0-alpha" +source_archive_sha256 = "425ed6106fbcce8026e7af6c405fcdf1cf7139c9000841410991789878c901c5" +cargo_lock_sha256 = "8d4cc4cc45db31f1205ed9905b774fe3c29b3feb4bd4b284c93c1f2e45086d32" +rust_version = "1.99.0" +host_feature_profile = "service-host" + +[source_archive_contract] +binding = "sha256_of_canonical_exact_lib_revision_tree_archive" +format = "ustar" +compression = "none" +compression_timestamp = "not_applicable" +entry_order = "bytewise_git_path" +path_prefix = "none" +file_mode = "git_index_100644_or_100755" +uid = 0 +gid = 0 +uname = "" +gname = "" +mtime = "lib_revision_commit_timestamp" +pax_headers = "forbidden" +directory_entries = "omitted" +symlinks = "forbidden" +hardlinks = "forbidden" +submodules = "forbidden" +trailer = "two_zero_blocks" + +[nix] +material = "bound" +lib_revision = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a" +supported_systems = ["aarch64-darwin", "x86_64-linux"] + +[nix.public_input_lock] +path = "flake.lock" +sha256 = "35cf82aeaba2ed20288b24d872a280108113f06b832603a5dbcc4fa1051724d4" +binding = "exact_regular_file_bytes" +mutable_reference = "forbidden" +lib_input = "lib" + +[nix.parent_result] +embedded_in_public_input_lock = false +embedded_in_source_lock = false +storage = "separate_source_scoped_execution_evidence" + +[artifact_contract] +path = "contracts/release/myc-artifact-contract.v4.json" +sha256 = "229e86154026935deef679b2b0ff7250ca602ed983222908dd402f4e7894360e" +binding = "exact_regular_file_bytes_in_same_source_revision" + +[sqlite] +high_level_authority = "sqlx_only" +second_pool_connection_query_transaction_migration_authority = "forbidden" +incremental_backup_adapter = "sealed_native_sqlx_owned_locked_handle_only" +native_linkage_count = 1 + +[contract_versions] +config = 1 +state = 12 +admin = 1 +status = 1 +provider = 1 diff --git a/supply-chain/audits.toml b/supply-chain/audits.toml @@ -1,4 +1,8 @@ # cargo-vet audits file -[audits] +[[audits.negentropy]] +who = "Codex (automated single-owner source review)" +criteria = "safe-to-deploy" +delta = "0.5.1 -> 0.5.2" +notes = "Automated single-owner review of the checksum-verified published 0.5.1 -> 0.5.2 delta. All 21 retained 0.5.2 source/support hashes equal the previously reviewed snapshot. The ID count is bounded by remaining 32-byte IDs before allocation; infallible private varint result cleanup preserves its former always-Ok behavior. Call sites, regression, manifests and unchanged MIT license reviewed. This delta uses the existing 0.5.1 safe-to-deploy baseline exemption; it does not claim an independent full-crate audit, complete parser canonicality or release qualification." diff --git a/tests/build_policy.rs b/tests/build_policy.rs @@ -4,7 +4,7 @@ use sha2::{Digest, Sha256}; const MANIFEST: &str = include_str!("../Cargo.toml"); const RELEASE_ACCEPTANCE: &str = include_str!("../scripts/release-acceptance.sh"); -const SOURCE_LOCK: &str = include_str!("../radroots.service.source-lock.v3.toml"); +const SOURCE_LOCK: &str = include_str!("../radroots.service.source_lock.v4.toml"); const FLAKE_LOCK: &[u8] = include_bytes!("../flake.lock"); #[test] @@ -30,35 +30,35 @@ fn service_host_is_the_exact_default_feature_profile() { #[test] fn shared_runtime_paths_is_exactly_pinned_to_the_source_locked_lib() { assert!(MANIFEST.contains( - "radroots_runtime_paths = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\" }" + "radroots_runtime_paths = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\" }" )); } #[test] fn shared_identity_is_exactly_pinned_to_the_source_locked_lib() { assert!(MANIFEST.contains( - "radroots_identity = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\" }" + "radroots_identity = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\" }" )); } #[test] fn shared_service_host_is_exactly_pinned_to_the_source_locked_lib() { assert!(MANIFEST.contains( - "radroots_service_host = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\" }" + "radroots_service_host = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\" }" )); } #[test] fn shared_service_sqlite_is_exactly_pinned_to_the_source_locked_lib() { assert!(MANIFEST.contains( - "radroots_service_sqlite = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\" }" + "radroots_service_sqlite = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\" }" )); } #[test] fn shared_storage_evidence_is_exactly_pinned_to_the_source_locked_lib() { assert!(MANIFEST.contains( - "radroots_storage = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\", default-features = false }" + "radroots_storage = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\", default-features = false }" )); } @@ -71,7 +71,7 @@ fn delivery_dependencies_are_exactly_source_locked() { ] { assert!( MANIFEST.contains(&format!( - "{dependency} = {{ git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\"" + "{dependency} = {{ git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\"" )), "{dependency} is not pinned to the exact source lock" ); @@ -95,19 +95,19 @@ fn source_lock_binds_the_current_cargo_lock() { let digest = hex::encode(Sha256::digest(include_bytes!("../Cargo.lock"))); let flake_digest = hex::encode(Sha256::digest(FLAKE_LOCK)); assert!(SOURCE_LOCK.starts_with( - "schema = \"radroots.service.source-lock.v3\"\ncontract_version = 3\nservice = \"myc\"\n" + "schema = \"radroots.service.source_lock.v4\"\ncontract_version = 4\nservice = \"myc\"\n" )); assert!(SOURCE_LOCK.contains(&format!("cargo_lock_sha256 = \"{digest}\""))); assert!(SOURCE_LOCK.contains(&format!("sha256 = \"{flake_digest}\""))); - assert!(SOURCE_LOCK.contains("revision = \"055096853fca95e15d0f813d33a14aca13be3881\"")); + assert!(SOURCE_LOCK.contains("revision = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\"")); assert!(SOURCE_LOCK.contains( - "[nix]\nmaterial = \"qualified\"\nlib_revision = \"055096853fca95e15d0f813d33a14aca13be3881\"\nsupported_systems = [\"aarch64-darwin\", \"x86_64-linux\"]\n" + "[nix]\nmaterial = \"bound\"\nlib_revision = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\"\nsupported_systems = [\"aarch64-darwin\", \"x86_64-linux\"]\n" )); assert!(SOURCE_LOCK.contains( - "workspace_catalog_sha256 = \"deca0c080deae187ff8186c0708903e42f41ea57f77c5f91581e23aa561164a4\"" + "workspace_catalog_sha256 = \"f6f0d6af573b28e5b5bf7c6862d26ba6a5583d5674149fb4e96f8a6630b51735\"" )); assert!(SOURCE_LOCK.contains( - "source_archive_sha256 = \"89b8ace3f61167df43aca89917405d58b2aaf2ddea8fadfb21d351d76f184e68\"" + "source_archive_sha256 = \"425ed6106fbcce8026e7af6c405fcdf1cf7139c9000841410991789878c901c5\"" )); assert!(SOURCE_LOCK.ends_with( "[contract_versions]\nconfig = 1\nstate = 12\nadmin = 1\nstatus = 1\nprovider = 1\n" diff --git a/tests/services_hardening_local_signer_transport.rs b/tests/services_hardening_local_signer_transport.rs @@ -84,7 +84,7 @@ fn machine_contract_freezes_the_complete_local_signer_transport() { #[test] fn implementation_uses_only_the_hardened_fixed_unix_admin_boundary() { for required in [ - "radroots_service_host = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\"", + "radroots_service_host = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\"", "const MYC_LOCAL_SIGNER_ENDPOINT: &str = \"/v1/provider/operation\"", "radroots_service_host::AdminClient", ".mutate::<_, LocalSignerResponse>(", diff --git a/tests/services_hardening_native_release.rs b/tests/services_hardening_native_release.rs @@ -6,7 +6,7 @@ use serde_json::json; const CONTRACT: &str = include_str!("../contracts/services_hardening/native_release.v2.json"); const ACTIVE_CONTRACT: &str = - include_str!("../contracts/services_hardening/native_release.v3.json"); + include_str!("../contracts/services_hardening/native_release.v4.json"); const MANIFEST: &str = include_str!("../Cargo.toml"); const LOCK: &str = include_str!("../Cargo.lock"); const FLAKE: &str = include_str!("../flake.nix"); @@ -14,7 +14,7 @@ const FLAKE_LOCK: &str = include_str!("../flake.lock"); const CARGO_CONFIG: &str = include_str!("../.cargo/config.toml"); const SYSTEMD_UNIT: &str = include_str!("../packaging/systemd/myc@.service"); -const LIB_REVISION: &str = "055096853fca95e15d0f813d33a14aca13be3881"; +const LIB_REVISION: &str = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a"; const LIB_REPOSITORY: &str = "https://github.com/radrootslabs/lib"; #[test] @@ -158,7 +158,7 @@ fn native_release_contract_and_manifest_metadata_are_exact() { toml::Value::Table(toml::toml! { service = "myc" host_feature_profile = "service-host" - nix_material = "qualified" + nix_material = "bound" config_contract_version = 1 state_contract_version = 12 admin_contract_version = 1 @@ -250,7 +250,7 @@ fn every_radroots_dependency_is_exactly_source_locked() { for required in [ "lib = {", - "url = \"github:radrootslabs/lib/055096853fca95e15d0f813d33a14aca13be3881\";", + "url = \"github:radrootslabs/lib/386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\";", "inputs.crane.follows = \"crane\";", "systems = lib.lib.supportedSystems;", "nixosModules.default", @@ -276,8 +276,8 @@ fn every_radroots_dependency_is_exactly_source_locked() { "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1788739124_u64, - "narHash": "sha256-Aw8qbU1DrtxSYJKg0js6kexnKgVGFCjR34bgq+ZVAVo=", + "lastModified": 1792158226_u64, + "narHash": "sha256-JuDYlQok9ujR5TAOvSHAMbi6SwPLXk1A5KOyxI53658=", "owner": "radrootslabs", "repo": "lib", "rev": LIB_REVISION, @@ -299,7 +299,12 @@ fn native_release_surfaces_remain_generated_outside_the_source_tree() { assert!(!root.join("radroots.lib.source-lock.v1.toml").exists()); assert!(!root.join("radroots.service.source-lock.v1.toml").exists()); assert!(!root.join("radroots.service.source-lock.v2.toml").exists()); - assert!(root.join("radroots.service.source-lock.v3.toml").is_file()); + assert!(!root.join("radroots.service.source-lock.v3.toml").exists()); + assert!(root.join("radroots.service.source_lock.v4.toml").is_file()); + assert!( + root.join("contracts/release/history/radroots.service.source-lock.v3.toml") + .is_file() + ); assert!( !root .join("contracts/services_hardening/native_release.v1.json") @@ -334,14 +339,17 @@ fn native_release_surfaces_remain_generated_outside_the_source_tree() { assert!(!CONTRACT.contains("nixos-module")); let active: serde_json::Value = serde_json::from_str(ACTIVE_CONTRACT).expect("active release contract"); - assert_eq!(active["schema_version"], 3); - assert_eq!(active["contract_version"], 3); - assert_eq!(active["predecessor"]["filename"], "native_release.v2.json"); + assert_eq!(active["schema_version"], 4); + assert_eq!(active["contract_version"], 4); + assert_eq!(active["predecessor"]["filename"], "native_release.v3.json"); assert_eq!( active["source_lock"]["filename"], - "radroots.service.source-lock.v3.toml" + "radroots.service.source_lock.v4.toml" ); - assert_eq!(active["source_lock"]["nix_material"], "qualified"); + assert_eq!(active["source_lock"]["nix_material"], "bound"); + assert_eq!(active["toolchain"]["rust_version"], "1.99.0"); + assert_eq!(active["nix_qualified"], false); + assert_eq!(active["maximums"]["source_lock_bytes"], 16_384); assert_eq!(active["nix_outputs"]["bundled_sqlite"], true); assert_eq!(active["nix_outputs"]["native_linkage_count"], 1); } diff --git a/tests/services_hardening_runtime_context.rs b/tests/services_hardening_runtime_context.rs @@ -288,7 +288,7 @@ fn unsupported_profile_platform_and_diagnostics_fail_safely() { #[test] fn shared_runtime_paths_are_the_only_path_policy_and_identity_authority() { assert!(MANIFEST.contains( - "radroots_runtime_paths = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\" }" + "radroots_runtime_paths = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\" }" )); assert!(LIB_SOURCE.contains("mod runtime_context;")); assert!(!LIB_SOURCE.contains("pub mod runtime_context;")); diff --git a/tests/services_hardening_state_catalog.rs b/tests/services_hardening_state_catalog.rs @@ -469,7 +469,7 @@ fn catalog_errors_are_stable_source_free_and_redacted() { #[test] fn catalog_source_is_pure_pinned_and_uses_only_the_shared_authority() { assert!(MANIFEST.contains( - "radroots_service_sqlite = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\" }" + "radroots_service_sqlite = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\" }" )); assert!(LIB_SOURCE.contains("mod state_catalog;")); assert!(!LIB_SOURCE.contains("pub mod state_catalog;")); diff --git a/tools/xtask/src/main.rs b/tools/xtask/src/main.rs @@ -20,9 +20,9 @@ use tempfile::{NamedTempFile, TempDir}; const SERVICE: &str = "myc"; const VERSION: &str = "0.1.0"; const REPOSITORY: &str = "https://github.com/radrootslabs/myc"; -const RUST_VERSION: &str = "1.97.1"; +const RUST_VERSION: &str = "1.99.0"; const HOST_FEATURE_PROFILE: &str = "service-host"; -const SOURCE_LOCK: &str = "radroots.service.source-lock.v3.toml"; +const SOURCE_LOCK: &str = "radroots.service.source_lock.v4.toml"; const CONFIG_EXAMPLE: &str = "contracts/services_hardening/config.v1.example.toml"; const CONFIG_SCHEMA: &str = "contracts/services_hardening/config.v1.schema.json"; const SYSTEMD_UNIT: &str = "packaging/systemd/myc@.service"; @@ -42,6 +42,7 @@ const OUTPUT_NAMES: [&str; 12] = [ "systemd.service", ]; const MAX_TEXT_BYTES: u64 = 1_048_576; +const MAX_SOURCE_LOCK_BYTES: u64 = 16_384; const MAX_DOCUMENT_BYTES: u64 = 16_777_216; const MAX_METADATA_BYTES: u64 = 33_554_432; const MAX_BINARY_BYTES: u64 = 536_870_912; @@ -152,7 +153,7 @@ struct CargoNode { dependencies: Vec<String>, } -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct SourceLock { schema: String, @@ -174,17 +175,17 @@ struct SourceLock { contract_versions: ContractVersions, } -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct NixEvidence { material: String, lib_revision: String, + supported_systems: Vec<String>, public_input_lock: PublicInputLock, parent_result: ParentResult, - supported_systems: Vec<String>, } -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct PublicInputLock { path: String, @@ -194,7 +195,7 @@ struct PublicInputLock { lib_input: String, } -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct ParentResult { embedded_in_public_input_lock: bool, @@ -202,7 +203,7 @@ struct ParentResult { storage: String, } -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct SourceArchiveContract { binding: String, @@ -225,7 +226,7 @@ struct SourceArchiveContract { trailer: String, } -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct ArtifactContract { path: String, @@ -233,7 +234,7 @@ struct ArtifactContract { binding: String, } -#[derive(Clone, Debug, Deserialize)] +#[derive(Clone, Debug, Deserialize, Serialize)] #[serde(deny_unknown_fields)] struct SqliteContract { high_level_authority: String, @@ -551,7 +552,7 @@ fn native_release(root: &Path, args: &NativeReleaseArgs) -> Result<(), ReleaseEr copy_bounded( &root.join(SOURCE_LOCK), &stage.join(SOURCE_LOCK), - MAX_TEXT_BYTES, + MAX_SOURCE_LOCK_BYTES, )?; create_binary_archive( &args.binary, @@ -568,7 +569,7 @@ fn native_release(root: &Path, args: &NativeReleaseArgs) -> Result<(), ReleaseEr write_json(&stage.join("sbom.cdx.json"), &sbom)?; write_generated(&stage.join("THIRD-PARTY-NOTICES.txt"), notices.as_bytes())?; - let source_lock_sha256 = hash_regular(&stage.join(SOURCE_LOCK), MAX_TEXT_BYTES)?.sha256; + let source_lock_sha256 = hash_regular(&stage.join(SOURCE_LOCK), MAX_SOURCE_LOCK_BYTES)?.sha256; let payload = inventory_records(stage)?; let manifest = ArtifactManifest { schema: "radroots.service.release-artifacts.v1", @@ -585,7 +586,7 @@ fn native_release(root: &Path, args: &NativeReleaseArgs) -> Result<(), ReleaseEr host_feature_profile: HOST_FEATURE_PROFILE, contract_versions: source_lock.contract_versions.clone(), protected_material_included: false, - nix_qualified: true, + nix_qualified: false, oci_included: false, artifacts: payload, }; @@ -596,8 +597,8 @@ fn native_release(root: &Path, args: &NativeReleaseArgs) -> Result<(), ReleaseEr schema: "radroots.service.provenance-input.v1", contract_version: 1, predicate_type: "https://slsa.dev/provenance/v1", - build_type: "https://radroots.dev/contracts/myc-native-release/v2", - builder_id: "https://radroots.dev/builders/myc-native-release/v2", + build_type: "https://radroots.dev/contracts/myc-native-release/v4", + builder_id: "https://radroots.dev/builders/myc-native-release/v4", service: SERVICE, version: VERSION, target: args.target.clone(), @@ -736,22 +737,35 @@ fn validate_output_path(root: &Path, output: &Path) -> Result<(), ReleaseError> } fn read_source_lock(root: &Path) -> Result<SourceLock, ReleaseError> { + for predecessor in [ + "radroots.service.source-lock.v1.toml", + "radroots.service.source-lock.v2.toml", + "radroots.service.source-lock.v3.toml", + ] { + match fs::symlink_metadata(root.join(predecessor)) { + Err(error) if error.kind() == std::io::ErrorKind::NotFound => {} + _ => return Err(ReleaseError::InvalidSourceLock), + } + } let bytes = read_bounded( &root.join(SOURCE_LOCK), - MAX_TEXT_BYTES, + MAX_SOURCE_LOCK_BYTES, ReleaseError::InvalidSourceLock, )?; let text = std::str::from_utf8(&bytes).map_err(|_| ReleaseError::InvalidSourceLock)?; let lock: SourceLock = toml::from_str(text).map_err(|_| ReleaseError::InvalidSourceLock)?; + if toml::to_string(&lock).map_err(|_| ReleaseError::InvalidSourceLock)? != text { + return Err(ReleaseError::InvalidSourceLock); + } let cargo_lock = hash_regular(&root.join("Cargo.lock"), MAX_DOCUMENT_BYTES)?; let flake_lock = hash_regular(&root.join("flake.lock"), MAX_DOCUMENT_BYTES)?; let artifact_contract = hash_regular( - &root.join("contracts/release/myc-artifact-contract.v3.json"), + &root.join("contracts/release/myc-artifact-contract.v4.json"), MAX_DOCUMENT_BYTES, )?; let revisions = cargo_dependency_revisions(root)?; - if lock.schema != "radroots.service.source-lock.v3" - || lock.contract_version != 3 + if lock.schema != "radroots.service.source_lock.v4" + || lock.contract_version != 4 || lock.service != SERVICE || lock.repository != "https://github.com/radrootslabs/lib" || !lower_hex(&lock.revision, 40) @@ -781,7 +795,7 @@ fn read_source_lock(root: &Path) -> Result<SourceLock, ReleaseError> { || lock.source_archive_contract.hardlinks != "forbidden" || lock.source_archive_contract.submodules != "forbidden" || lock.source_archive_contract.trailer != "two_zero_blocks" - || lock.nix.material != "qualified" + || lock.nix.material != "bound" || lock.nix.lib_revision != lock.revision || lock.nix.supported_systems != ["aarch64-darwin", "x86_64-linux"] || lock.nix.public_input_lock.path != "flake.lock" @@ -791,8 +805,8 @@ fn read_source_lock(root: &Path) -> Result<SourceLock, ReleaseError> { || lock.nix.public_input_lock.lib_input != "lib" || lock.nix.parent_result.embedded_in_public_input_lock || lock.nix.parent_result.embedded_in_source_lock - || lock.nix.parent_result.storage != "separate_generation_scoped_evidence" - || lock.artifact_contract.path != "contracts/release/myc-artifact-contract.v3.json" + || lock.nix.parent_result.storage != "separate_source_scoped_execution_evidence" + || lock.artifact_contract.path != "contracts/release/myc-artifact-contract.v4.json" || lock.artifact_contract.sha256 != artifact_contract.sha256 || lock.artifact_contract.binding != "exact_regular_file_bytes_in_same_source_revision" || lock.sqlite.high_level_authority != "sqlx_only" @@ -1427,11 +1441,10 @@ fn output_maximum(name: &str) -> Result<u64, ReleaseError> { match name { "binary.tar.gz" => Ok(MAX_BINARY_BYTES + MAX_TEXT_BYTES), "service-source.tar.gz" => Ok(MAX_SOURCE_ARCHIVE_BYTES), - "LICENSE" - | "config.example.toml" - | "config.schema.json" - | "systemd.service" - | SOURCE_LOCK => Ok(MAX_TEXT_BYTES), + "LICENSE" | "config.example.toml" | "config.schema.json" | "systemd.service" => { + Ok(MAX_TEXT_BYTES) + } + SOURCE_LOCK => Ok(MAX_SOURCE_LOCK_BYTES), "SHA256SUMS" | "THIRD-PARTY-NOTICES.txt" | "artifact-manifest.v1.json" @@ -1636,6 +1649,64 @@ mod tests { use super::*; #[test] + fn current_source_lock_is_canonical_bounded_and_exactly_bound() { + let root = workspace_root(); + let lock = read_source_lock(&root).expect("current V4 lock"); + assert_eq!(lock.rust_version, RUST_VERSION); + assert_eq!(lock.nix.material, "bound"); + assert_eq!(output_maximum(SOURCE_LOCK), Ok(MAX_SOURCE_LOCK_BYTES)); + let fixture = TempDir::new().expect("source fixture"); + for name in [ + SOURCE_LOCK, + "Cargo.toml", + "Cargo.lock", + "flake.lock", + "contracts/release/myc-artifact-contract.v4.json", + ] { + let target = fixture.path().join(name); + fs::create_dir_all(target.parent().expect("fixture parent")).expect("parent"); + fs::copy(root.join(name), target).expect("fixture input"); + } + read_source_lock(fixture.path()).expect("exact fixture"); + let path = fixture.path().join(SOURCE_LOCK); + let original = fs::read_to_string(&path).expect("lock bytes"); + for changed in [ + format!("{original}\n"), + original.replacen("1.99.0", "1.97.1", 1), + original.replacen("material = \"bound\"", "material = \"qualified\"", 1), + original.replacen("native_linkage_count = 1", "native_linkage_count = 2", 1), + original.replacen("contract_version = 4", "contract_version = 3", 1), + "x".repeat(MAX_SOURCE_LOCK_BYTES as usize + 1), + ] { + assert_ne!(changed, original); + fs::write(&path, changed).expect("mutated lock"); + assert!(read_source_lock(fixture.path()).is_err()); + } + fs::write(&path, original).expect("restore lock"); + fs::write( + fixture.path().join("radroots.service.source-lock.v3.toml"), + b"historical", + ) + .expect("coexisting predecessor"); + assert!(read_source_lock(fixture.path()).is_err()); + fs::remove_file(fixture.path().join("radroots.service.source-lock.v3.toml")) + .expect("remove predecessor fixture"); + for name in [ + "Cargo.lock", + "flake.lock", + "contracts/release/myc-artifact-contract.v4.json", + ] { + let target = fixture.path().join(name); + let original = fs::read(&target).expect("bound input"); + let mut changed = original.clone(); + changed.push(b'\n'); + fs::write(&target, changed).expect("changed input"); + assert!(read_source_lock(fixture.path()).is_err(), "{name}"); + fs::write(target, original).expect("restore input"); + } + } + + #[test] fn argument_parser_is_closed_and_bounded() { let args = parse_native_release_args(vec![ "--mode".into(),