commit 6c0d11ffa46cc45db2215f4688a415869233f84c
parent 6219d405dbcb4e354202157164e50d3d29dd6e03
Author: triesap <tyson@radroots.org>
Date: Fri, 16 Oct 2026 14:27:05 +0000
build: bind current RHI sources and artifacts to Rust 1.99
- Adopt the published Lib cohort in exact Cargo and Nix inputs.
- Generate the bounded canonical V4 lock while preserving release history.
- Correct inherited nonblocking sockets in the loopback process fixture.
- Verify native runtime, delayed upgrade, API and dependency policy checks.
Diffstat:
20 files changed, 605 insertions(+), 108 deletions(-)
diff --git a/AGENTS.md b/AGENTS.md
@@ -32,9 +32,16 @@
## 2. Authority and preflight
- Before editing, read this file, `README`, `Cargo.toml`,
- `radroots.service.source-lock.v3.toml`, and the relevant implementation and
+ `radroots.service.source_lock.v4.toml`, and the relevant implementation and
tests. The removed prototype root `config.toml` is not configuration
authority.
+- Current compiler/source preparation uses the V4 lock and
+ `contracts/services_hardening/native_release.v3.json`. Nix inputs are bound;
+ executed current qualification remains separate. Prepare an exact staged
+ migration through the source-locked Lib producer, verify and commit the
+ complete candidate, then require its clean-source check. Archived V3 locks
+ and earlier contracts retain their history. Step 301 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 `rhi`. The reserved pre-implementation evidence authority is
`contracts/services_hardening/evidence_policy.v1.json`, and the reserved
diff --git a/Cargo.lock b/Cargo.lock
@@ -1365,9 +1365,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"
@@ -1690,7 +1690,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",
@@ -1702,7 +1702,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",
@@ -1711,7 +1711,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",
@@ -1729,7 +1729,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",
@@ -1746,7 +1746,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",
@@ -1756,7 +1756,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",
@@ -1770,7 +1770,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",
]
@@ -1778,7 +1778,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",
@@ -1788,7 +1788,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",
@@ -1800,7 +1800,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",
@@ -1821,7 +1821,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",
@@ -1839,7 +1839,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",
@@ -1852,7 +1852,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 = [
"hex",
"radroots_core",
@@ -1866,7 +1866,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",
@@ -1877,7 +1877,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",
@@ -1887,11 +1887,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 = "rhi"
host_feature_profile = "service-host"
-nix_material = "qualified"
+nix_material = "bound"
config_contract_version = 1
state_contract_version = 11
admin_contract_version = 1
@@ -52,18 +52,18 @@ workspace = true
[dependencies]
base64 = "0.22"
-radroots_event = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", features = ["serde"] }
-radroots_event_codec = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", features = ["json"] }
-radroots_nostr = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha", features = ["events"] }
-radroots_protocol = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" }
-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_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, features = ["std"] }
-radroots_transport_nostr = { 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" }
-radroots_trade = { git = "https://github.com/radrootslabs/lib", rev = "055096853fca95e15d0f813d33a14aca13be3881", version = "=0.1.0-alpha" }
+radroots_event = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", features = ["serde"] }
+radroots_event_codec = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", features = ["json"] }
+radroots_nostr = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha", features = ["events"] }
+radroots_protocol = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" }
+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_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, features = ["std"] }
+radroots_transport_nostr = { 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" }
+radroots_trade = { git = "https://github.com/radrootslabs/lib", rev = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a", version = "=0.1.0-alpha" }
chacha20poly1305 = { version = "0.10" }
clap = { version = "4", features = ["derive"] }
diff --git a/README b/README
@@ -813,7 +813,7 @@ The capsule owns a private `cargo xtask native-release` generator and the
machine-readable
[`native_release.v1.json`](contracts/services_hardening/native_release.v1.json)
predecessor and the forward
-[`native_release.v2.json`](contracts/services_hardening/native_release.v2.json)
+[`native_release.v3.json`](contracts/services_hardening/native_release.v3.json)
contract. From one exact clean committed revision, a caller-supplied positive
deterministic epoch, and an executable ELF64 binary for one governed GNU/Linux
target, the generator creates one external immutable artifact directory. It
@@ -826,7 +826,8 @@ Generation is bounded, deterministic, collision-only, mode checked, and
durability ordered. It scans exact tracked source, the selected binary, copied
package inputs, and generated documents for governed protected-value patterns,
then records that protected material and OCI content are absent while binding
-the qualified Nix posture. The source-locked third-party vendor graph is
+bound Nix inputs requiring separate current execution evidence. The
+source-locked third-party vendor graph is
represented separately by checksums, SBOM, and notices. The generator does
not sign, tag, publish, deploy, or write artifacts into the source tree. The standalone
`scripts/release-acceptance.sh` surface exercises the native Cargo contract;
@@ -835,6 +836,11 @@ SBOM component references are domain-separated hashes of framed Cargo
name/version/source/checksum identity, so they neither disclose a checkout path
nor vary when the same exact source is built from another directory.
+Current V4 source locks bind the exact public Lib cohort, Cargo/Nix input
+locks and Rust 1.99.0. Earlier V1/V2 native declarations and the archived V3
+source lock retain their original scope. Source binding does not qualify
+current Nix packages, runtime artifacts or a release candidate.
+
The standalone Linux systemd boundary is frozen by
`contracts/services_hardening/systemd_qualification.v1.json` and checked by
`scripts/verify-systemd.sh`. The instance unit uses the canonical service-host
diff --git a/radroots.service.source-lock.v3.toml b/contracts/release/history/radroots.service.source-lock.v3.toml
diff --git a/contracts/release/rhi-artifact-contract.v4.json b/contracts/release/rhi-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": "rhi",
+ "cargo_package": "rhi",
+ "flake_app": "apps.<system>.default",
+ "flake_package": "packages.<system>.default",
+ "identity": "rhi",
+ "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/rhi",
+ "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": "rhi-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.v3.json b/contracts/services_hardening/native_release.v3.json
@@ -0,0 +1,142 @@
+{
+ "schema": "radroots.rhi.native-release",
+ "schema_version": 3,
+ "contract_version": 3,
+ "predecessor": {
+ "schema_version": 2,
+ "filename": "native_release.v2.json",
+ "transition": "forward_only_replace"
+ },
+ "service": "rhi",
+ "package": {
+ "name": "rhi",
+ "binary": "rhi",
+ "version": "0.1.0",
+ "repository": "https://github.com/radrootslabs/rhi",
+ "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": 11,
+ "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"
+ ],
+ "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",
+ "sbom_component_identity": "domain_separated_sha256_of_framed_name_version_source_checksum",
+ "protected_material_scan": "tracked_source_binary_copied_and_generated_material_fixed_patterns",
+ "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",
+ "crates_io_publication",
+ "signing",
+ "tagging",
+ "release_publication",
+ "deployment",
+ "system_sqlite",
+ "second_sqlite_linkage",
+ "production_activation"
+ ],
+ "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
+ },
+ "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 = "rhi"
+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 = "739ab671a4b6d48f34c076cc9a57dc08f1a82f5c59958a2a3faf9e476d9e02be"
+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/rhi-artifact-contract.v4.json"
+sha256 = "1f78ed5437048fba3cea3565f491413d3c866b42e9a43a9cbc059fc970b925b9"
+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 = 11
+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
@@ -3,7 +3,7 @@
use sha2::{Digest, Sha256};
const MANIFEST: &str = include_str!("../Cargo.toml");
-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]
@@ -22,9 +22,9 @@ fn manifest_freezes_the_native_service_policy() {
}
#[test]
-fn source_lock_metadata_is_exact_and_nix_is_qualified() {
+fn source_lock_metadata_is_exact_and_nix_is_bound() {
assert!(MANIFEST.contains(
- "[workspace.metadata.radroots.service_source_lock]\nservice = \"rhi\"\nhost_feature_profile = \"service-host\"\nnix_material = \"qualified\""
+ "[workspace.metadata.radroots.service_source_lock]\nservice = \"rhi\"\nhost_feature_profile = \"service-host\"\nnix_material = \"bound\""
));
for field in [
"config_contract_version = 1",
@@ -44,7 +44,7 @@ fn source_lock_metadata_is_exact_and_nix_is_qualified() {
fn shared_host_packages_are_exactly_source_locked() {
for dependency in ["radroots_service_host", "radroots_service_sqlite"] {
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\" }}"
)));
}
}
@@ -52,7 +52,7 @@ fn shared_host_packages_are_exactly_source_locked() {
#[test]
fn shared_service_sqlite_is_the_only_catalog_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\" }"
));
for forbidden in ["rusqlite", "libsqlite3-sys"] {
assert!(
@@ -65,17 +65,17 @@ fn shared_service_sqlite_is_the_only_catalog_authority() {
#[test]
fn shared_storage_generation_type_is_exactly_source_locked() {
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 }"
));
}
#[test]
fn shared_transport_spi_is_exactly_source_locked_without_serde() {
assert!(MANIFEST.contains(
- "radroots_transport = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\", default-features = false, features = [\"std\"] }"
+ "radroots_transport = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\", default-features = false, features = [\"std\"] }"
));
assert!(MANIFEST.contains(
- "radroots_transport_nostr = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\", version = \"=0.1.0-alpha\" }"
+ "radroots_transport_nostr = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\", version = \"=0.1.0-alpha\" }"
));
}
@@ -84,19 +84,19 @@ fn source_lock_binds_the_current_cargo_lock() {
let digest = lower_hex(&Sha256::digest(include_bytes!("../Cargo.lock")));
let flake_digest = lower_hex(&Sha256::digest(FLAKE_LOCK));
assert!(SOURCE_LOCK.starts_with(
- "schema = \"radroots.service.source-lock.v3\"\ncontract_version = 3\nservice = \"rhi\"\n"
+ "schema = \"radroots.service.source_lock.v4\"\ncontract_version = 4\nservice = \"rhi\"\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(
- "workspace_catalog_sha256 = \"deca0c080deae187ff8186c0708903e42f41ea57f77c5f91581e23aa561164a4\""
+ "workspace_catalog_sha256 = \"f6f0d6af573b28e5b5bf7c6862d26ba6a5583d5674149fb4e96f8a6630b51735\""
));
assert!(SOURCE_LOCK.contains(
- "source_archive_sha256 = \"89b8ace3f61167df43aca89917405d58b2aaf2ddea8fadfb21d351d76f184e68\""
+ "source_archive_sha256 = \"425ed6106fbcce8026e7af6c405fcdf1cf7139c9000841410991789878c901c5\""
));
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.ends_with(
"[contract_versions]\nconfig = 1\nstate = 11\nadmin = 1\nstatus = 1\nprovider = 1\n"
diff --git a/tests/services_hardening_admin_wave_qualification.rs b/tests/services_hardening_admin_wave_qualification.rs
@@ -121,7 +121,7 @@ fn qualification_is_executable_source_locked_and_authority_safe() {
.all(|byte| byte.is_ascii_hexdigit() && !byte.is_ascii_uppercase())
);
assert_eq!(revision, "053d0c750bf9cd683c6ea37cefe7e79617ba629f");
- assert!(MANIFEST.contains("rev = \"055096853fca95e15d0f813d33a14aca13be3881\""));
+ assert!(MANIFEST.contains("rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\""));
assert!(
MANIFEST
.contains("radroots_service_host = { git = \"https://github.com/radrootslabs/lib\"")
diff --git a/tests/services_hardening_failure_qualification.rs b/tests/services_hardening_failure_qualification.rs
@@ -180,7 +180,7 @@ fn historical_source_lock_binds_the_shared_sqlite_failure_corpus() {
.expect("Lib revision");
assert_eq!(revision, "053d0c750bf9cd683c6ea37cefe7e79617ba629f");
assert!(MANIFEST.contains(
- "radroots_service_sqlite = { git = \"https://github.com/radrootslabs/lib\", rev = \"055096853fca95e15d0f813d33a14aca13be3881\""
+ "radroots_service_sqlite = { git = \"https://github.com/radrootslabs/lib\", rev = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\""
));
assert_eq!(
contract["source_locked_shared_sqlite_corpus"],
diff --git a/tests/services_hardening_native_release.rs b/tests/services_hardening_native_release.rs
@@ -6,18 +6,18 @@ use serde_json::json;
const CONTRACT: &str = include_str!("../contracts/services_hardening/native_release.v1.json");
const ACTIVE_CONTRACT: &str =
- include_str!("../contracts/services_hardening/native_release.v2.json");
+ include_str!("../contracts/services_hardening/native_release.v3.json");
const MANIFEST: &str = include_str!("../Cargo.toml");
const LOCK: &str = include_str!("../Cargo.lock");
const FLAKE: &str = include_str!("../flake.nix");
const FLAKE_LOCK: &str = include_str!("../flake.lock");
-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 CARGO_CONFIG: &str = include_str!("../.cargo/config.toml");
const SYSTEMD_UNIT: &str = include_str!("../packaging/systemd/rhi@.service");
const RELEASE_ACCEPTANCE: &str = include_str!("../scripts/release-acceptance.sh");
const XTASK_MANIFEST: &str = include_str!("../tools/xtask/Cargo.toml");
-const LIB_REVISION: &str = "055096853fca95e15d0f813d33a14aca13be3881";
+const LIB_REVISION: &str = "386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a";
const LIB_REPOSITORY: &str = "https://github.com/radrootslabs/lib";
#[test]
@@ -171,7 +171,7 @@ fn native_release_contract_and_manifest_metadata_are_exact() {
assert_eq!(
manifest["workspace"]["metadata"]["radroots"]["service_source_lock"]["nix_material"]
.as_str(),
- Some("qualified")
+ Some("bound")
);
let source_lock: toml::Value = toml::from_str(SOURCE_LOCK).expect("source lock");
assert_eq!(
@@ -263,7 +263,7 @@ fn every_radroots_dependency_is_exactly_source_locked() {
assert!(source.contains(&format!("?rev={LIB_REVISION}#{LIB_REVISION}")));
for required in [
- "url = \"github:radrootslabs/lib/055096853fca95e15d0f813d33a14aca13be3881\";",
+ "url = \"github:radrootslabs/lib/386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\";",
"systems = lib.lib.supportedSystems;",
"nixosModules.default",
] {
@@ -282,12 +282,12 @@ fn every_radroots_dependency_is_exactly_source_locked() {
}
#[test]
-fn native_release_surfaces_remain_external_and_nix_qualified() {
+fn native_release_surfaces_remain_external_and_nix_bound() {
let root = std::path::Path::new(env!("CARGO_MANIFEST_DIR"));
for required in [
".cargo/config.toml",
"packaging/systemd/rhi@.service",
- "radroots.service.source-lock.v3.toml",
+ "radroots.service.source_lock.v4.toml",
"scripts/release-acceptance.sh",
"tools/xtask/Cargo.toml",
"tools/xtask/src/main.rs",
@@ -322,14 +322,17 @@ fn native_release_surfaces_remain_external_and_nix_qualified() {
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"], 2);
- assert_eq!(active["contract_version"], 2);
- assert_eq!(active["predecessor"]["filename"], "native_release.v1.json");
+ assert_eq!(active["schema_version"], 3);
+ assert_eq!(active["contract_version"], 3);
+ assert_eq!(active["predecessor"]["filename"], "native_release.v2.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_process.rs b/tests/services_hardening_process.rs
@@ -30,7 +30,7 @@ const PROCESS_QUALIFICATION_CONTRACT: &str =
include_str!("../contracts/services_hardening/process_qualification.v1.json");
const FAILURE_QUALIFICATION_CONTRACT: &[u8] =
include_bytes!("../contracts/services_hardening/failure_qualification.v1.json");
-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 PROCESS_DEADLINE: Duration = Duration::from_secs(30);
const POLL_INTERVAL: Duration = Duration::from_millis(2);
const CONNECT_DEADLINE_MILLISECONDS: u64 = 5_000;
@@ -101,6 +101,11 @@ impl Drop for RelayHarness {
}
fn relay_session(stream: TcpStream, stop: &AtomicBool) {
+ // Accepted sockets can inherit the listener's nonblocking mode on macOS.
+ // This fixture uses blocking tungstenite with explicit I/O deadlines.
+ stream
+ .set_nonblocking(false)
+ .expect("blocking accepted relay socket");
stream
.set_read_timeout(Some(RELAY_HANDSHAKE_TIMEOUT))
.expect("relay handshake read timeout");
@@ -176,6 +181,50 @@ fn relay_text(websocket: &mut tungstenite::WebSocket<TcpStream>, text: &str) {
}
}
+#[test]
+fn loopback_relay_waits_for_delayed_upgrade_on_an_inherited_nonblocking_socket() {
+ let listener = TcpListener::bind("127.0.0.1:0").expect("regression listener");
+ let address = listener.local_addr().expect("regression address");
+ let client = TcpStream::connect(address).expect("regression client");
+ client
+ .set_read_timeout(Some(RELAY_HANDSHAKE_TIMEOUT))
+ .expect("client read deadline");
+ client
+ .set_write_timeout(Some(RELAY_HANDSHAKE_TIMEOUT))
+ .expect("client write deadline");
+ let (server, _) = listener.accept().expect("accepted regression socket");
+ // Exercise inherited nonblocking mode explicitly on every platform.
+ server.set_nonblocking(true).expect("inherited socket mode");
+ let stop = Arc::new(AtomicBool::new(false));
+ let session_stop = Arc::clone(&stop);
+ let (finished, completion) = std::sync::mpsc::channel();
+ let session = thread::spawn(move || {
+ relay_session(server, &session_stop);
+ let _ = finished.send(());
+ });
+ let waiting = matches!(
+ completion.recv_timeout(Duration::from_millis(50)),
+ Err(std::sync::mpsc::RecvTimeoutError::Timeout)
+ );
+ let response = (|| -> Result<Message, String> {
+ if !waiting {
+ return Err("relay discarded an upgrade before the client sent it".to_owned());
+ }
+ let (mut socket, _) = tungstenite::client(format!("ws://{address}/delayed"), client)
+ .map_err(|error| error.to_string())?;
+ socket
+ .send(Message::Text(r#"["REQ","delayed",{}]"#.into()))
+ .map_err(|error| error.to_string())?;
+ socket.read().map_err(|error| error.to_string())
+ })();
+ stop.store(true, Ordering::SeqCst);
+ session.join().expect("joined regression relay");
+ assert_eq!(
+ response.expect("delayed upgrade and request succeed"),
+ Message::Text(r#"["EOSE","delayed"]"#.into())
+ );
+}
+
struct ProcessFixture {
root: tempfile::TempDir,
config: PathBuf,
@@ -652,7 +701,7 @@ fn process_qualification_contract_freezes_the_exact_wave_closure() {
lower_hex(&Sha256::digest(FAILURE_QUALIFICATION_CONTRACT)),
contract["component_qualification"]["sha256"]
);
- assert!(SOURCE_LOCK.contains("revision = \"055096853fca95e15d0f813d33a14aca13be3881\""));
+ assert!(SOURCE_LOCK.contains("revision = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\""));
}
#[test]
diff --git a/tests/services_hardening_state_catalog.rs b/tests/services_hardening_state_catalog.rs
@@ -579,7 +579,7 @@ fn secret_object() -> SchemaObject {
#[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/tests/services_hardening_wave_100_a.rs b/tests/services_hardening_wave_100_a.rs
@@ -7,7 +7,7 @@ use serde_json::Value;
const CONFIG_EXAMPLE: &str = include_str!("../contracts/services_hardening/config.v1.example.toml");
const CONFIG_SCHEMA: &str = include_str!("../contracts/services_hardening/config.v1.schema.json");
-const SOURCE_LOCK: &str = include_str!("../radroots.service.source-lock.v3.toml");
+const SOURCE_LOCK: &str = include_str!("../radroots.service.source_lock.v4.toml");
#[test]
fn canonical_example_agrees_with_the_exact_schema_and_parser() {
@@ -29,7 +29,7 @@ fn canonical_example_agrees_with_the_exact_schema_and_parser() {
}
#[test]
-fn wave_one_removed_files_remain_absent_after_nix_qualification() {
+fn wave_one_removed_files_remain_absent_with_current_source_binding() {
let root = Path::new(env!("CARGO_MANIFEST_DIR"));
for removed in [
"config.toml",
@@ -45,14 +45,14 @@ fn wave_one_removed_files_remain_absent_after_nix_qualification() {
);
}
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.v4.toml").is_file());
assert!(root.join("flake.nix").is_file());
assert!(root.join("flake.lock").is_file());
assert!(SOURCE_LOCK.starts_with(
- "schema = \"radroots.service.source-lock.v3\"\ncontract_version = 3\nservice = \"rhi\"\n"
+ "schema = \"radroots.service.source_lock.v4\"\ncontract_version = 4\nservice = \"rhi\"\n"
));
- assert!(SOURCE_LOCK.contains("material = \"qualified\""));
- assert!(SOURCE_LOCK.contains("lib_revision = \"055096853fca95e15d0f813d33a14aca13be3881\""));
+ assert!(SOURCE_LOCK.contains("material = \"bound\""));
+ assert!(SOURCE_LOCK.contains("lib_revision = \"386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a\""));
}
#[test]
diff --git a/tests/source_guards.rs b/tests/source_guards.rs
@@ -43,7 +43,7 @@ fn rhi_manifest_exact_pins_radroots_contract() {
);
assert_eq!(
dependency.get("rev").and_then(toml::Value::as_str),
- Some("055096853fca95e15d0f813d33a14aca13be3881"),
+ Some("386e2d7e8cca95bdd0f6ce3444b5e741ea61ef8a"),
"RHI must source-lock {name} to the exact promoted Lib revision"
);
assert_eq!(
diff --git a/tools/xtask/src/main.rs b/tools/xtask/src/main.rs
@@ -20,10 +20,10 @@ use tempfile::{NamedTempFile, TempDir};
const SERVICE: &str = "rhi";
const VERSION: &str = "0.1.0";
const REPOSITORY: &str = "https://github.com/radrootslabs/rhi";
-const RUST_VERSION: &str = "1.97.1";
+const RUST_VERSION: &str = "1.99.0";
const HOST_FEATURE_PROFILE: &str = "service-host";
const RADROOTS_DEPENDENCY_COUNT: usize = 12;
-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/rhi@.service";
@@ -43,6 +43,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;
@@ -153,7 +154,7 @@ struct CargoNode {
dependencies: Vec<String>,
}
-#[derive(Clone, Debug, Deserialize)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
struct SourceLock {
schema: String,
@@ -175,17 +176,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,
@@ -195,7 +196,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,
@@ -203,7 +204,7 @@ struct ParentResult {
storage: String,
}
-#[derive(Clone, Debug, Deserialize)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
struct SourceArchiveContract {
binding: String,
@@ -226,7 +227,7 @@ struct SourceArchiveContract {
trailer: String,
}
-#[derive(Clone, Debug, Deserialize)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
struct ArtifactContract {
path: String,
@@ -234,7 +235,7 @@ struct ArtifactContract {
binding: String,
}
-#[derive(Clone, Debug, Deserialize)]
+#[derive(Clone, Debug, Deserialize, Serialize)]
#[serde(deny_unknown_fields)]
struct SqliteContract {
high_level_authority: String,
@@ -552,7 +553,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,
@@ -569,7 +570,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",
@@ -586,7 +587,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,
};
@@ -597,8 +598,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/rhi-native-release/v2",
- builder_id: "https://radroots.dev/builders/rhi-native-release/v2",
+ build_type: "https://radroots.dev/contracts/rhi-native-release/v3",
+ builder_id: "https://radroots.dev/builders/rhi-native-release/v3",
service: SERVICE,
version: VERSION,
target: args.target.clone(),
@@ -737,22 +738,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/rhi-artifact-contract.v3.json"),
+ &root.join("contracts/release/rhi-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)
@@ -782,7 +796,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"
@@ -792,8 +806,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/rhi-artifact-contract.v3.json"
+ || lock.nix.parent_result.storage != "separate_source_scoped_execution_evidence"
+ || lock.artifact_contract.path != "contracts/release/rhi-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"
@@ -1563,11 +1577,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"
@@ -1773,6 +1786,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/rhi-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/rhi-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(),