feat(provenance): enforce trusted Ed25519 package signatures in publish, lockfile, and locked builds
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 10s

This commit is contained in:
faumaray committed 2026-12-03 17:57:20 +03:00
1 parent 21babb8c31
commit 85f2ae274f
21 files changed
+519 -15

No files matched your search

+1
View File
@@ -62,6 +62,7 @@ add_library(VoidBuild_Core STATIC
src/SelfHost/TestRegistryGen.cpp
src/Provenance/Sbom.cpp
src/Provenance/Signing.cpp
src/Provenance/Verification.cpp
recipes/VoidLibrary/VoidLibraryRecipe.cpp
recipes/SelfHost/VbsSelfHostRecipe.cpp)
add_library(Void::BuildCore ALIAS VoidBuild_Core)
+3 -1
View File
@@ -50,6 +50,7 @@ void build(Void::Build::Project &project) {
"src/SelfHost/TestRegistryGen.cpp",
"src/Provenance/Sbom.cpp",
"src/Provenance/Signing.cpp",
"src/Provenance/Verification.cpp",
"recipes/VoidLibrary/VoidLibraryRecipe.cpp",
"recipes/SelfHost/VbsSelfHostRecipe.cpp",
})
@@ -155,7 +156,8 @@ void build(Void::Build::Project &project) {
auto v1_tests = project.test("vbs_v1_tests");
v1_tests.cxx_standard(Void::Build::CxxStandard::Cxx26)
.sources({"tests/FullV1Tests.cpp", "tests/DaemonTests.cpp", "tests/SigningTests.cpp"})
.sources({"tests/FullV1Tests.cpp", "tests/DaemonTests.cpp", "tests/SigningTests.cpp",
"tests/SignatureEnforcementTests.cpp"})
.depends_on(bootstrap_cfg)
.depends_on(cli)
.include_directory("$GEN/include", Void::Build::Visibility::Private)
+7 -2
View File
@@ -2,7 +2,7 @@
Updated: 2026-12-03
Branch: main
Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B1–B3) + Track E1 + `vbs ide` & `build.cpp` CompDB integration + Track D1/D2 + Track E2 + Track D3 SBOM (Docker GCC 16) + Track D3 Ed25519 signing primitives (OpenSSL-gated) + Track E3 daemon core & bounded describe + Track C1 Linux platform split complete
Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B1–B3) + Track E1 + `vbs ide` & `build.cpp` CompDB integration + Track D1/D2 + Track E2 + Track D3 SBOM (Docker GCC 16) + Track D3 Ed25519 signing primitives & trusted-key enforcement (OpenSSL-gated crypto) + Track E3 daemon core & bounded describe + Track C1 Linux platform split complete
## Completed delivery waves
@@ -75,9 +75,14 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
- Split OS-specific platform implementations into `src/Platform/Linux/` and added `include/Void/Build/Platform/Host.hpp` (`HostOs`, `host_os()`, `host_supported()`); macOS/Windows backends remain planned Track C2/C3 scope.
- Fixed bounded CMake translation for CMake 4.5's synthesized `@cmake_cxx_std@(synth_N)` `INTERFACE_LIBRARY` feature carriers in `src/Provider/Translator.cpp`: their standard flag is already lowered from compile groups, so they are skipped instead of reported as untranslated dependency edges. Restored `FullV1Tests.track_b3_foreign_cmake_cxx20_modules_native_translation` on CMake 4.5.
- **Wave 15 (Track D3 Signed-Package Enforcement)**:
- Extended the package model (`ReleaseRecord`, `SolvedPackage`, `LockedSourceEntry`) and `vbs.lock` serialization with optional Ed25519 `signature`/`public_key` fields (omitted from JSON when absent, so existing locks stay byte-compatible).
- `vbs publish --signing-key FILE` signs the canonical `vbs-package-v1` message; `vbs-registry` stores and serves `X-Package-Signature`/`X-Package-Public-Key` metadata with strict 128/64 hex validation; `vbs build|test --trusted-public-key HEX` (repeatable) fails closed before package extraction unless the signature verifies against a trusted key.
- Added `Void::Build::Provenance::verify_trusted_package_signature` (`include/Void/Build/Provenance/Verification.hpp`, `src/Provenance/Verification.cpp`) with explicit `Verified`/`Unsigned`/`UntrustedKey`/`InvalidSignature` decisions, plus `tests/SignatureEnforcementTests.cpp` and registry metadata/signed-E2E coverage.
## Remaining future scope
- **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Live `conan` CLI verification (Track B3), Track C (macOS/Windows ports + dual-profile cross-compilation), Track D3 signing (SBOM and Ed25519 primitives done; OpenSSL-backed round-trip verification and `vbs publish`/`vbs build --locked` enforcement remain), Track E3 (daemon core and bounded `describe` done; build-serving requests and external editor plugins remain), and Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope.
- **Post-v1 Expansion Roadmap ([21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md) & [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md))**: Live `conan` CLI verification (Track B3), Track C (macOS/Windows ports + dual-profile cross-compilation), Track D3 signing (SBOM, Ed25519 primitives, and trusted-key enforcement done; binary-variant signing and key distribution remain), Track E3 (daemon core and bounded `describe` done; build-serving requests and external editor plugins remain), and Track E4 (`Void::Net`/`Void::Sqlite` alignment) remain planned scope.
## Environment notes & upstream boundaries
+2 -1
View File
@@ -21,4 +21,5 @@ Base HEAD: `fe0d1a6`
| Wave 12 (Track E2 Workspaces) | `workspace.cpp` member declaration/evaluation, shared root `vbs.lock` + `build/.vbs` CAS, `workspace_dependency()` cross-member native linking, `--member` and `--changed-since` selection | COMPLETE & VERIFIED (Docker GCC 16.0.1, 8/8 CTest suites; 3-member fixture with unified lockfile) | `include/Void/Build.hpp`, `src/Build.cpp`, `Config/Frontend.{hpp,cpp}`, `src/Main.cpp`, `src/Package/Fetch.cpp`, `tests/FullV1Tests.cpp`, docs |
| Wave 13 (Track D3 SBOM + Ed25519 signing primitives) | Deterministic SPDX 2.3 / CycloneDX 1.5 SBOM from `vbs.lock` packages + `BuildGraph` outputs; `vbs build\|test --sbom FILE --sbom-format spdx\|cyclonedx`; Ed25519 detached-signature primitives (`Void::Build::Provenance::Signing`: 0600 seed generation, public-key derivation, canonical package message, sign/verify) capability-gated on `Void::Crypto`'s OpenSSL backend | SBOM COMPLETE & VERIFIED (Docker GCC 16, 8/8 CTest suites); signing primitives IMPLEMENTED & VERIFIED in `dev cpp-gcc` (OpenSSL-gated: 4/4 `SigningTests`; OpenSSL-backed round-trip pending an OpenSSL-enabled environment) | `include/Void/Build/Provenance/Sbom.hpp`, `src/Provenance/Sbom.cpp`, `include/Void/Build/Provenance/Signing.hpp`, `src/Provenance/Signing.cpp`, `tests/SigningTests.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
| Wave 14 (Track E3 daemon core + bounded `describe` + Track C1 platform split) | Unix-socket `vbs daemon` holding warm `StateStore`/`InotifyWatcher` with `ping/status/gc/recover/describe/shutdown`, CLI + tests; bounded `describe` graph summary (`target_names` ≤ 128 × 200 bytes, `profile` ≤ 128 bytes, 10 s eval timeout); `src/Platform/Linux/` backend split with `HostOs` boundary; CMake 4.5 `@cmake_cxx_std@` feature-carrier translation fix | COMPLETE & VERIFIED (GCC 16.2, pinned VoidLibrary `3e25405`, 8/8 CTest suites; `Daemon` suite 6/6 under `dev cpp-gcc`; live `vbs daemon describe` CLI round-trip verified in `vbs_cli_contract`) | `include/Void/Build/Daemon/Daemon.hpp`, `src/Daemon/Daemon.cpp`, `tests/DaemonTests.cpp`, `include/Void/Build/Platform/Host.hpp`, `src/Platform/Linux/`, `src/Main.cpp`, `src/Provider/Translator.cpp`, `tests/CliContracts.cmake`, docs |
| Future (Plan 20 Slice 3 / Tracks C, D3 signature enforcement, E3 daemon build serving, E4, live `conan`) | Live `conan` CLI verification; macOS/Windows/cross-compile; `vbs publish`/`vbs build --locked` signature enforcement; daemon build serving; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
| Wave 15 (Track D3 signed-package enforcement) | Optional `signature`/`public_key` in `ReleaseRecord`/`SolvedPackage`/`LockedSourceEntry` + `vbs.lock`; `vbs publish --signing-key`; registry signature metadata storage/serving with hex validation; `vbs build\|test --trusted-public-key` fail-closed enforcement before extraction; `Provenance::verify_trusted_package_signature` trust policy | COMPLETE & VERIFIED (GCC 16.2, pinned VoidLibrary `3e25405`, 8/8 CTest; OpenSSL-enabled Signing 4/4, SignatureEnforcement 3/3, signed registry E2E) | `include/Void/Build/Provenance/Verification.hpp`, `src/Provenance/Verification.cpp`, `include/Void/Build/Package/{Solver,Lockfile,RegistryClient}.hpp`, `src/Package/{Solver,Lockfile,RegistryClient}.cpp`, `registry/`, `src/Main.cpp`, `tests/{SignatureEnforcementTests.cpp,RegistryTests.cpp}`, docs |
| Future (Plan 20 Slice 3 / Tracks C, D3 binary signing, E3 daemon build serving, E4, live `conan`) | Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon build serving; `Void::Net`/`Void::Sqlite` alignment | PLANNED (unimplemented) | [21-expansion-roadmap.md](../roadmap/21-expansion-roadmap.md), [20-future-translation-platforms.md](../roadmap/20-future-translation-platforms.md) |
+28
View File
@@ -267,6 +267,34 @@ dev cpp-gcc -c ctest --test-dir build/bootstrap -R vbs_cli_contract --output-on-
and 200 bytes per name; `profile` rejects empty, non-string, and > 128-byte values; `compiler`
rejects non-string and unknown values; workspace roots are rejected.
## Track D3 Signed-Package Enforcement (2026-12-03, `dev cpp-gcc`)
Environment: GCC 16.2.0, CMake 4.5.0, Ninja 1.13.2, VoidLibrary pin
`3e254055e081a104f08df68dde39711bc7813518` exported read-only to `/tmp/opencode/vl-pin`. The
OpenSSL-backed runs use the separate `build/openssl` configure against Nix OpenSSL 3.5.9.
```sh
dev cpp-gcc -c cmake --build build/bootstrap --parallel 8
dev cpp-gcc -c ctest --test-dir build/bootstrap --output-on-failure
dev cpp-gcc -c build/openssl/bin/vbs_v1_tests --suite Signing --no-color
dev cpp-gcc -c build/openssl/bin/vbs_v1_tests --suite SignatureEnforcement --no-color
dev cpp-gcc -c build/openssl/bin/vbs_registry_tests --filter cli_publish_deps_resolve_and_locked_build_against_live_registry --no-color
```
- Default build: exit 0. Full CTest: **8 / 8 passed** in 192.70 s (`vbs_v1_tests` 70.37 s,
`vbs_selfhost_tests` 91.77 s, `vbs_registry_tests` 10.11 s, `vbs_cli_contract` 7.47 s).
- `SignatureEnforcement` (default, no OpenSSL): **3 / 3 passed** - lockfile signature fields
round-trip and are omitted when absent; empty/missing/untrusted-key policy decisions; the crypto
case self-skips. With OpenSSL: **3 / 3 passed** including `Verified` and `InvalidSignature`.
- `Signing` with OpenSSL: **4 / 4 passed** (Ed25519 round-trip, tamper/wrong-key rejection).
- Registry metadata: publish with valid `X-Package-Signature`/`X-Package-Public-Key` is served back
in the package detail JSON; 127-hex signature and signature-without-key both return HTTP 400.
- Signed end-to-end (OpenSSL `vbs` CLI, `RegistryTests.cli_publish_deps_resolve_and_locked_build_against_live_registry`):
**passed** - `vbs publish --signing-key` -> `vbs deps update` -> `vbs build --locked
--trusted-public-key <key>` succeeds; the same locked build with an unrelated trusted key fails
closed (and the unsigned locked package also fails closed with `not signed by a trusted key`).
- `clang-format --dry-run --Werror` passes on all changed/new C++ files.
## Limits and Unrun Checks
1. **HTTPS git fetch**: the host shell is proxy-restricted, but the Docker container could clone `https://git.faumaray.com/Void/VoidLibrary.git`; the pinned commit `3e254055e081a104f08df68dde39711bc7813518` was fetched directly for the verification above. A separate configure against the local `/home/faumaray/Projects/Library` checkout via `VBS_VOID_SOURCE_DIR` also succeeded (development-only override, checkout unmodified).
+1 -1
View File
@@ -61,7 +61,7 @@ flowchart LR
| --- | --- | --- |
| **D1 — Shared HTTP Content-Addressed Action Cache (CAS)** *(verified: cross-build-directory 100% cache hit)* | Push/pull action records and output blobs (`PUT/GET /api/v1/cas/blobs/{sha256}`, `/api/v1/cas/actions/{action_key}`) against `vbs-registry` or any compatible HTTP CAS server with bearer auth and digest verification on every read. Action keys are normalized to be build-directory independent; `vbs build/test --remote-cache URL [--remote-cache-token-env VAR]` (or `VBS_REMOTE_CACHE` / `VBS_REMOTE_CACHE_TOKEN`). | Cold CI build populates remote CAS; second clean machine achieves 100% cache hit with verified SHA-256 outputs. |
| **D2 — Fast Hashing & Parallel Snapshot Pipeline** *(verified: 5,001-file warm no-op 374 ms)* | Adopt `Void::Crypto` BLAKE2b / hardware-accelerated SHA-256 (when available) + parallel snapshot hashing across `Void::Concurrency::ThreadPool` + optional `Void::Sqlite` indexed state store for >10k-file monorepos. Snapshot capture revalidation now hashes on a bounded thread pool for trees of 32+ files. | Sub-second warm no-op on 5,000-file synthetic benchmark fixture (`vbs_benchmarks`). |
| **D3 — Supply-Chain Provenance & Signed Packages** *(SBOM implemented; Ed25519 signing primitives implemented, OpenSSL backend required)* | Emit SPDX/CycloneDX SBOM JSON from `vbs.lock` + `BuildGraph` (`vbs build/test --sbom FILE --sbom-format spdx\|cyclonedx`, `src/Provenance/Sbom.cpp`); Ed25519 detached-signature primitives in `Void::Build::Provenance::Signing` (`include/Void/Build/Provenance/Signing.hpp`, `src/Provenance/Signing.cpp`): 0600 seed generation, public-key derivation, canonical `vbs-package-v1` package message, and sign/verify, capability-gated on `Void::Crypto`'s OpenSSL backend; wiring signature enforcement into `vbs publish` and `vbs build --locked` remains planned. | SBOM is deterministic and valid JSON; signing primitives pass round-trip/tamper/malformed tests (`tests/SigningTests.cpp`) and fail closed with an explicit unsupported-backend error without OpenSSL; tampered archive or signature must fail closed before extraction once enforcement is wired. |
| **D3 — Supply-Chain Provenance & Signed Packages** *(SBOM, Ed25519 signing primitives, and trusted-key enforcement implemented; OpenSSL backend required for crypto)* | Emit SPDX/CycloneDX SBOM JSON from `vbs.lock` + `BuildGraph` (`vbs build/test --sbom FILE --sbom-format spdx\|cyclonedx`, `src/Provenance/Sbom.cpp`); Ed25519 detached-signature primitives in `Void::Build::Provenance::Signing` (`include/Void/Build/Provenance/Signing.hpp`, `src/Provenance/Signing.cpp`): 0600 seed generation, public-key derivation, canonical `vbs-package-v1` package message, and sign/verify; package signature/public-key metadata persisted in `vbs.lock` and registry releases; `vbs publish --signing-key FILE`; `vbs build\|test --trusted-public-key HEX` enforced before extraction via `Provenance::verify_trusted_package_signature` (`include/Void/Build/Provenance/Verification.hpp`). | SBOM is deterministic and valid JSON; signing primitives pass round-trip/tamper/malformed tests (`tests/SigningTests.cpp`); trusted-key policy tests pass with and without OpenSSL (`tests/SignatureEnforcementTests.cpp`); a signed publish -> deps update -> `--locked` trusted build succeeds and an untrusted/unsigned package fails closed before extraction (`RegistryTests.cpp`). |
---
+2
View File
@@ -29,6 +29,8 @@ struct LockedSourceEntry {
std::string builder;
std::vector<std::string> features;
bool build_dependency{false};
std::optional<std::string> signature; // Ed25519 detached signature hex (package entries)
std::optional<std::string> public_key; // Signer public key hex (package entries)
};
struct LockContextRecord {
@@ -24,6 +24,9 @@ struct PublishOptions {
std::string description;
bool is_private{false};
RegistryAuth auth;
// Optional Ed25519 signing seed (64 hex chars). When set, the published release carries
// X-Package-Signature / X-Package-Public-Key over the canonical package message.
std::optional<std::filesystem::path> signing_seed_path;
};
struct PublishReceipt {
+4
View File
@@ -54,6 +54,8 @@ struct ReleaseRecord {
std::string source_url;
std::vector<DependencyConstraint> dependencies;
std::vector<BinaryVariantMeta> binaries;
std::optional<std::string> signature; // Ed25519 detached signature hex (optional)
std::optional<std::string> public_key; // Signer public key hex (optional)
};
class PackageIndex {
@@ -73,6 +75,8 @@ struct SolvedPackage {
std::set<std::string> enabled_features;
std::vector<PackageId> dependencies;
std::vector<BinaryVariantMeta> binaries;
std::optional<std::string> signature; // Copied from the selected release (optional)
std::optional<std::string> public_key; // Copied from the selected release (optional)
};
struct SolveResult {
@@ -0,0 +1,34 @@
#pragma once
#include <Void/Functional/Error.hpp>
#include <Void/Functional/Result.hpp>
#include <string>
#include <string_view>
#include <vector>
namespace Void::Build::Provenance {
// Detached signature metadata attached to a registry package release or lockfile entry.
struct PackageSignature {
std::string sha256; // Archive digest hex.
std::string signature; // Ed25519 detached signature hex (may be empty).
std::string public_key; // Ed25519 signer public key hex (may be empty).
};
enum class TrustDecision { Verified, Unsigned, UntrustedKey, InvalidSignature };
[[nodiscard]] std::string_view trust_decision_name(TrustDecision decision) noexcept;
// Trust policy for package signatures:
// - No trusted keys => Unsigned (the caller keeps legacy unsigned behavior).
// - Missing signature or public key => Unsigned (the caller decides whether that is an error).
// - Public key not in the trusted set => UntrustedKey (no cryptography is invoked).
// - Trusted key with a valid signature => Verified; with an invalid signature => InvalidSignature.
// Malformed hex or an unavailable crypto backend returns an explicit error.
[[nodiscard]] Void::Result::Result<TrustDecision, Void::Result::Error>
verify_trusted_package_signature(std::string_view name, std::string_view version,
const PackageSignature &signature,
const std::vector<std::string> &trusted_public_keys_hex);
} // namespace Void::Build::Provenance
+1
View File
@@ -103,6 +103,7 @@ add_vbs_selfhost_native(Project &project, const VbsSelfHostConfig &config) {
"src/SelfHost/TestRegistryGen.cpp",
"src/Provenance/Sbom.cpp",
"src/Provenance/Signing.cpp",
"src/Provenance/Verification.cpp",
"recipes/VoidLibrary/VoidLibraryRecipe.cpp",
"recipes/SelfHost/VbsSelfHostRecipe.cpp",
};
@@ -49,6 +49,8 @@ struct ReleaseMeta {
bool yanked{false};
std::string publisher;
std::int64_t published_epoch{0};
std::string signature; // Ed25519 signature hex; empty = unsigned release.
std::string public_key; // Ed25519 public key hex; empty = unsigned release.
};
struct PackageMeta {
+51 -3
View File
@@ -297,6 +297,8 @@ Void::Result::Result<void, Void::Result::Error> RegistryService::load_locked() {
rm.yanked = get_bool(*ro, "yanked", false);
rm.publisher = get_str(*ro, "publisher");
rm.published_epoch = get_i64(*ro, "published_epoch", 0);
rm.signature = get_str(*ro, "signature");
rm.public_key = get_str(*ro, "public_key");
p.releases[rm.version] = std::move(rm);
}
}
@@ -374,6 +376,12 @@ Void::Result::Result<void, Void::Result::Error> RegistryService::save_locked() {
",\"yanked\":" + std::string{r->yanked ? "true" : "false"} +
",\"publisher\":" + json_quote(r->publisher) +
",\"published_epoch\":" + std::to_string(r->published_epoch) +
(r->signature.empty()
? std::string{}
: ",\"signature\":" + json_quote(r->signature)) +
(r->public_key.empty()
? std::string{}
: ",\"public_key\":" + json_quote(r->public_key)) +
'}';
}) +
'}';
@@ -791,7 +799,14 @@ HttpResponse RegistryService::handle_request(const HttpRequest &req) {
",\"size_bytes\":" + std::to_string(r->size_bytes) +
",\"yanked\":" +
std::string{r->yanked ? "true" : "false"} +
",\"publisher\":" + json_quote(r->publisher) + '}';
",\"publisher\":" + json_quote(r->publisher) +
(r->signature.empty()
? std::string{}
: ",\"signature\":" + json_quote(r->signature)) +
(r->public_key.empty()
? std::string{}
: ",\"public_key\":" + json_quote(r->public_key)) +
'}';
}) +
"}\n");
}
@@ -827,6 +842,38 @@ HttpResponse RegistryService::handle_request(const HttpRequest &req) {
"X-Content-SHA256 does not match uploaded bytes");
}
// Optional detached Ed25519 signature metadata. The registry stores and serves it;
// trust evaluation belongs to the consumer. Both fields must be present together.
std::string release_signature;
std::string release_public_key;
if (const auto sig = req.header("x-package-signature"); sig) {
release_signature = std::string{*sig};
}
if (const auto key = req.header("x-package-public-key"); key) {
release_public_key = std::string{*key};
}
if (release_signature.empty() != release_public_key.empty()) {
return HttpResponse::error_json(
400, "invalid_signature",
"X-Package-Signature and X-Package-Public-Key must be provided together");
}
auto is_hex = [](std::string_view text) {
return std::ranges::all_of(text, [](char c) {
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') ||
(c >= 'A' && c <= 'F');
});
};
if (!release_signature.empty() &&
(release_signature.size() != 128 || !is_hex(release_signature))) {
return HttpResponse::error_json(400, "invalid_signature",
"X-Package-Signature must be 128 hex characters");
}
if (!release_public_key.empty() &&
(release_public_key.size() != 64 || !is_hex(release_public_key))) {
return HttpResponse::error_json(400, "invalid_signature",
"X-Package-Public-Key must be 64 hex characters");
}
// Immutability check: idempotent on exact bytes, 409 Conflict on different bytes!
if (existing_pkg) {
if (const auto rit = existing_pkg->releases.find(ver_str);
@@ -891,8 +938,9 @@ HttpResponse RegistryService::handle_request(const HttpRequest &req) {
if (const auto priv = req.header("x-package-private")) {
pkg.is_private = (*priv == "true" || *priv == "1");
}
pkg.releases[ver_str] = ReleaseMeta{ver_str, actual_sha, req.body.size(),
false, principal->username, now_epoch()};
pkg.releases[ver_str] = ReleaseMeta{
ver_str, actual_sha, req.body.size(), false, principal->username,
now_epoch(), release_signature, release_public_key};
append_audit_locked(principal->username, "package.publish", pkg_name + "@" + ver_str,
"ok", "sha256=" + actual_sha);
if (auto s = save_locked(); !s) {
+54 -6
View File
@@ -16,6 +16,7 @@
#include <Void/Build/Platform/FileOps.hpp>
#include <Void/Build/Platform/ProcessSupervisor.hpp>
#include <Void/Build/Provenance/Sbom.hpp>
#include <Void/Build/Provenance/Verification.hpp>
#include <Void/Build/Provider/Provider.hpp>
#include <Void/Build/Provider/Translator.hpp>
#include <Void/Build/SelfHost/TestRegistryGen.hpp>
@@ -269,7 +270,8 @@ struct ResolvedDepMaterialization {
Void::Result::Result<ResolvedDepMaterialization, Void::Result::Error> resolve_and_materialize_deps(
const ProfileContext &ctx, const std::vector<Package::NormalizedDependency> &merged_deps,
const std::filesystem::path &project_root, const std::filesystem::path &build_root,
const std::optional<Package::PinnedLock> &pinned_lock, bool offline, bool allow_upgrade) {
const std::optional<Package::PinnedLock> &pinned_lock, bool offline, bool allow_upgrade,
const std::vector<std::string> &trusted_public_keys) {
const std::string ctx_key = Package::make_lock_context_key(ctx, "target");
const std::string fp = Package::compute_declaration_fingerprint(ctx, "target", merged_deps);
@@ -413,6 +415,35 @@ Void::Result::Result<ResolvedDepMaterialization, Void::Result::Error> resolve_an
const auto tar_path = pkg_cache_root / (sp.source_sha256 + ".tar");
const auto extract_dir = pkg_cache_root / sp.source_sha256 / "src";
std::string package_signature;
std::string package_public_key;
if (const auto it = locked_pkg_entries.find(pid);
it != locked_pkg_entries.end() && it->second.sha256 == sp.source_sha256) {
package_signature = it->second.signature.value_or(std::string{});
package_public_key = it->second.public_key.value_or(std::string{});
} else {
package_signature = sp.signature.value_or(std::string{});
package_public_key = sp.public_key.value_or(std::string{});
}
if (!trusted_public_keys.empty()) {
auto decision = Provenance::verify_trusted_package_signature(
pid.name, sp.version.to_string(),
Provenance::PackageSignature{sp.source_sha256, package_signature,
package_public_key},
trusted_public_keys);
if (!decision) {
return std::unexpected{decision.error()};
}
if (*decision != Provenance::TrustDecision::Verified) {
return std::unexpected{Void::System::make_system_error(
Void::System::SystemErrorCode::permission_denied,
std::format("package {}@{} is not signed by a trusted key ({})", pid.name,
sp.version.to_string(),
Provenance::trust_decision_name(*decision)))};
}
}
if (!std::filesystem::is_directory(extract_dir, ec)) {
bool need_download = true;
if (std::filesystem::is_regular_file(tar_path, ec)) {
@@ -455,6 +486,12 @@ Void::Result::Result<ResolvedDepMaterialization, Void::Result::Error> resolve_an
le.builder = nd.record.builder;
le.features = nd.record.features;
le.build_dependency = nd.record.build_dependency;
if (!package_signature.empty()) {
le.signature = package_signature;
}
if (!package_public_key.empty()) {
le.public_key = package_public_key;
}
out.lock_context.entries.push_back(std::move(le));
} else {
Package::FetchOptions fopt{build_root / ".vbs" / "cache", project_root, offline, {}};
@@ -515,6 +552,7 @@ struct BuildCmdOptions {
std::optional<std::string> sbom_format_arg;
std::optional<std::filesystem::path> lock_root;
std::optional<std::filesystem::path> state_dir;
std::vector<std::string> trusted_public_keys;
bool publish_editor_selection{true};
bool no_cache{false};
bool locked{false};
@@ -707,8 +745,9 @@ int execute_build_or_test(BuildCmdOptions opts, bool run_tests) {
return 1;
}
auto resolved = resolve_and_materialize_deps(
ctx, *merged_deps, project_root, build_root, *pinned_lock, opts.offline, false);
auto resolved = resolve_and_materialize_deps(ctx, *merged_deps, project_root,
build_root, *pinned_lock, opts.offline,
false, opts.trusted_public_keys);
if (!resolved) {
std::cerr << "vbs: " << resolved.error().message() << '\n';
return 1;
@@ -1312,6 +1351,7 @@ struct PublishCmdOptions {
std::optional<std::string> version_arg;
std::string description;
std::string token_env{"VBS_REGISTRY_TOKEN"};
std::optional<std::string> signing_key_arg;
bool is_private{false};
};
@@ -1342,6 +1382,9 @@ int execute_publish_command(const PublishCmdOptions &opts) {
popts.description = opts.description;
popts.is_private = opts.is_private;
popts.auth.bearer_token = Void::Configuration::get_env_or(opts.token_env, "");
if (opts.signing_key_arg) {
popts.signing_seed_path = std::filesystem::path{*opts.signing_key_arg};
}
Void::Log::info("Publish", "Uploading {}@{} ({}) to {}...", *opts.name_arg, *opts.version_arg,
sha->substr(0, 12), registry_url);
@@ -1723,7 +1766,7 @@ int execute_deps_command(std::string_view sub, const DepsCmdOptions &opts) {
const std::string base_rev = existing->has_value() ? (*existing)->revision_hash : std::string{};
auto resolved = resolve_and_materialize_deps(ctx, *merged, project_root, build_root, *existing,
opts.offline, sub == "update");
opts.offline, sub == "update", {});
if (!resolved) {
std::cerr << "vbs deps: " << resolved.error().message() << '\n';
return 1;
@@ -2137,7 +2180,7 @@ int execute_ide_command(std::string_view sub, const IdeCmdOptions &opts) {
pinned_lock = *pl;
}
auto resolved = resolve_and_materialize_deps(ctx, *merged_deps, project_root, build_root,
pinned_lock, true, false);
pinned_lock, true, false, {});
if (resolved) {
for (const auto &[dep_rec, mat] : resolved->materialized) {
DependencyRecord effective_dep = dep_rec;
@@ -2339,7 +2382,10 @@ int main(int argc, char **argv) {
.flag("--no-cache", "", "Bypass action cache reads", build_opts.no_cache)
.flag("--native-foreign", "",
"Translate supported CMake/Meson dependencies to native VBS actions (Plan 20)",
build_opts.native_foreign);
build_opts.native_foreign)
.option_many("--trusted-public-key", "",
"Trusted Ed25519 package public key (hex; repeatable)",
build_opts.trusted_public_keys);
add_log_flags(p);
};
@@ -2448,6 +2494,8 @@ int main(int argc, char **argv) {
.option_default("--description", "-d", "Package description", publish_opts.description, "")
.option_default("--token-env", "", "Environment variable holding bearer token",
publish_opts.token_env, "VBS_REGISTRY_TOKEN")
.option("--signing-key", "", "Ed25519 signing seed file (64 hex characters)",
publish_opts.signing_key_arg)
.flag("--private", "", "Publish package as private", publish_opts.is_private);
add_log_flags(publish_cmd, false); // `-v` is `--version` on `publish`.
+8
View File
@@ -113,6 +113,8 @@ serialize_contexts_body(const std::map<std::string, LockContextRecord, std::less
",\"sha256\":" + json_quote(e.sha256) + ",\"builder\":" + json_quote(e.builder) +
",\"features\":" + json_array(e.features, json_quote) +
",\"build_dependency\":" + std::string{e.build_dependency ? "true" : "false"} +
(e.signature ? ",\"signature\":" + json_quote(*e.signature) : std::string{}) +
(e.public_key ? ",\"public_key\":" + json_quote(*e.public_key) : std::string{}) +
'}';
});
out += '}';
@@ -252,6 +254,12 @@ parse_lockfile(std::string_view json_text) {
e.builder = get_str(*eo, "builder");
e.features = get_str_array(*eo, "features");
e.build_dependency = get_bool(*eo, "build_dependency", false);
if (const auto sig = get_str(*eo, "signature"); !sig.empty()) {
e.signature = sig;
}
if (const auto key = get_str(*eo, "public_key"); !key.empty()) {
e.public_key = key;
}
rec.entries.push_back(std::move(e));
}
}
+20
View File
@@ -3,6 +3,7 @@
#include <Void/Build/Package/Fetch.hpp>
#include <Void/Build/Platform/FileOps.hpp>
#include <Void/Build/Platform/ProcessSupervisor.hpp>
#include <Void/Build/Provenance/Signing.hpp>
#include <Void/Build/Util/Sha256.hpp>
#include <Void/Core/Scope.hpp>
#include <Void/Data/StrictJson.hpp>
@@ -323,6 +324,12 @@ fetch_package_releases(std::string_view registry_url, std::string_view package_n
rec.version = *ver;
rec.yanked = get_bool(*ro, "yanked", false);
rec.source_sha256 = get_str(*ro, "sha256");
if (const auto sig = get_str(*ro, "signature"); !sig.empty()) {
rec.signature = sig;
}
if (const auto key = get_str(*ro, "public_key"); !key.empty()) {
rec.public_key = key;
}
rec.source_url = std::string{registry_url} + "/api/v1/packages/" +
Void::Encoding::Url::encode(package_name) + "/" +
Void::Encoding::Url::encode(ver_str) + "/download";
@@ -390,6 +397,19 @@ publish_package_archive(const PublishOptions &options) {
std::map<std::string, std::string, std::less<>> headers;
headers["X-Content-SHA256"] = sha;
if (options.signing_seed_path) {
auto signature = Provenance::sign_package(options.package_name, options.version, sha,
*options.signing_seed_path);
if (!signature) {
return std::unexpected{signature.error()};
}
auto public_key = Provenance::public_key_from_seed(*options.signing_seed_path);
if (!public_key) {
return std::unexpected{public_key.error()};
}
headers["X-Package-Signature"] = *signature;
headers["X-Package-Public-Key"] = *public_key;
}
if (!options.auth.bearer_token.empty()) {
headers["Authorization"] = "Bearer " + options.auth.bearer_token;
}
+2
View File
@@ -57,6 +57,8 @@ class PubGrubSolver {
sp.version = rel.version;
sp.source_sha256 = rel.source_sha256;
sp.source_url = rel.source_url;
sp.signature = rel.signature;
sp.public_key = rel.public_key;
sp.binaries = rel.binaries;
if (const auto cit = constraints.find(id); cit != constraints.end()) {
for (const auto &ac : cit->second) {
+65
View File
@@ -0,0 +1,65 @@
#include <Void/Build/Provenance/Verification.hpp>
#include <Void/Build/Provenance/Signing.hpp>
#include <algorithm>
#include <cctype>
#include <string>
#include <string_view>
#include <vector>
namespace Void::Build::Provenance {
namespace {
std::string normalize_hex(std::string_view hex) {
std::string normalized{hex};
std::ranges::transform(normalized, normalized.begin(), [](char c) {
return static_cast<char>(std::tolower(static_cast<unsigned char>(c)));
});
return normalized;
}
} // namespace
std::string_view trust_decision_name(TrustDecision decision) noexcept {
switch (decision) {
case TrustDecision::Verified:
return "verified";
case TrustDecision::Unsigned:
return "unsigned";
case TrustDecision::UntrustedKey:
return "untrusted_key";
case TrustDecision::InvalidSignature:
return "invalid_signature";
}
return "unknown";
}
Void::Result::Result<TrustDecision, Void::Result::Error>
verify_trusted_package_signature(std::string_view name, std::string_view version,
const PackageSignature &signature,
const std::vector<std::string> &trusted_public_keys_hex) {
if (trusted_public_keys_hex.empty()) {
return TrustDecision::Unsigned;
}
if (signature.signature.empty() || signature.public_key.empty()) {
return TrustDecision::Unsigned;
}
const std::string normalized_key = normalize_hex(signature.public_key);
const bool trusted = std::ranges::any_of(trusted_public_keys_hex, [&](const std::string &key) {
return normalize_hex(key) == normalized_key;
});
if (!trusted) {
return TrustDecision::UntrustedKey;
}
auto verified =
verify_package(name, version, signature.sha256, signature.signature, signature.public_key);
if (!verified) {
return std::unexpected{verified.error()};
}
return *verified ? TrustDecision::Verified : TrustDecision::InvalidSignature;
}
} // namespace Void::Build::Provenance
+1 -1
View File
@@ -12,7 +12,7 @@ set_target_properties(vbs_core_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
add_test(NAME vbs_core_tests COMMAND "$<TARGET_FILE:vbs_core_tests>" --no-color)
add_executable(vbs_v1_tests FullV1Tests.cpp DaemonTests.cpp SigningTests.cpp)
add_executable(vbs_v1_tests FullV1Tests.cpp DaemonTests.cpp SigningTests.cpp SignatureEnforcementTests.cpp)
target_include_directories(vbs_v1_tests PRIVATE "${PROJECT_BINARY_DIR}/generated")
target_link_libraries(vbs_v1_tests PRIVATE Void::BuildCore Void::Testing)
set_target_properties(vbs_v1_tests PROPERTIES
+78
View File
@@ -2,6 +2,7 @@
#include <Void/Build/Package/Archive.hpp>
#include <Void/Build/Platform/FileOps.hpp>
#include <Void/Build/Platform/ProcessSupervisor.hpp>
#include <Void/Build/Provenance/Signing.hpp>
#include <Void/Build/Registry/HttpServer.hpp>
#include <Void/Build/Registry/RegistryService.hpp>
#include <Void/Build/State/StateStore.hpp>
@@ -140,6 +141,37 @@ VOID_TEST(RegistryTests, registry_rbac_immutability_csrf_xss_web_and_backup_rest
*bytes1);
Void::Testing::expect(pub_ok.has_value() && pub_ok->status == 201);
// Signature metadata is stored and served verbatim (the registry is not a trust authority).
const std::string release_signature(128, 'a');
const std::string release_public_key(64, 'b');
auto signed_pub = send_loopback_http(port, "PUT", "/api/v1/packages/signed-pkg/1.0.0",
{{"Authorization", "Bearer " + *alice_tok},
{"X-Content-SHA256", *sha1},
{"X-Package-Signature", release_signature},
{"X-Package-Public-Key", release_public_key}},
*bytes1);
Void::Testing::expect(signed_pub.has_value() && signed_pub->status == 201);
auto signed_detail = send_loopback_http(port, "GET", "/api/v1/packages/signed-pkg",
{{"Authorization", "Bearer " + *alice_tok}});
Void::Testing::expect(signed_detail.has_value() && signed_detail->status == 200);
if (signed_detail) {
Void::Testing::expect(signed_detail->body.find(release_signature) != std::string::npos);
Void::Testing::expect(signed_detail->body.find(release_public_key) != std::string::npos);
}
auto bad_sig_pub = send_loopback_http(port, "PUT", "/api/v1/packages/bad-sig-pkg/1.0.0",
{{"Authorization", "Bearer " + *alice_tok},
{"X-Content-SHA256", *sha1},
{"X-Package-Signature", std::string(127, 'a')},
{"X-Package-Public-Key", release_public_key}},
*bytes1);
Void::Testing::expect(bad_sig_pub.has_value() && bad_sig_pub->status == 400);
auto half_sig_pub = send_loopback_http(port, "PUT", "/api/v1/packages/half-sig-pkg/1.0.0",
{{"Authorization", "Bearer " + *alice_tok},
{"X-Content-SHA256", *sha1},
{"X-Package-Signature", release_signature}},
*bytes1);
Void::Testing::expect(half_sig_pub.has_value() && half_sig_pub->status == 400);
// Unauthenticated access to private package MUST fail (401)!
auto anon_priv = send_loopback_http(port, "GET", "/api/v1/packages/secret-pkg");
Void::Testing::expect(anon_priv.has_value() && anon_priv->status == 401);
@@ -471,5 +503,51 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include
auto run_res = Platform::run_supervised(run_req);
Void::Testing::expect(run_res.has_value() && run_res->succeeded());
// 5. Requiring a trusted key must fail closed for the unsigned locked package.
Platform::ProcessRequest trusted_req = bld_req;
trusted_req.arguments.push_back("--trusted-public-key");
trusted_req.arguments.push_back(std::string(64, 'a'));
auto trusted_res = Platform::run_supervised(trusted_req);
Void::Testing::expect(trusted_res.has_value() && !trusted_res->succeeded());
if (trusted_res) {
Void::Testing::expect(trusted_res->stderr_data.find("not signed by a trusted key") !=
std::string::npos);
}
// 6. With the OpenSSL backend, publish a signed release and require its trusted key.
if (Provenance::signing_available()) {
const auto seed_path = tmp / "publish.seed";
Void::Testing::require(Provenance::generate_signing_seed(seed_path).has_value());
auto public_key = Provenance::public_key_from_seed(seed_path);
Void::Testing::require(public_key.has_value());
(void)Platform::atomic_write_file(
pkg_dir / "src" / "hello.cpp",
"#include \"hello_pkg.hpp\"\nint hello_pkg_value() { return 7; }\n", false);
Platform::ProcessRequest pub3 = pub1;
pub3.arguments[8] = "1.2.0";
pub3.arguments.push_back("--signing-key");
pub3.arguments.push_back(seed_path.string());
auto r3 = Platform::run_supervised(pub3);
Void::Testing::expect(r3.has_value() && r3->succeeded());
Platform::ProcessRequest update_req = deps_req;
update_req.arguments[1] = "update";
auto update_res = Platform::run_supervised(update_req);
Void::Testing::expect(update_res.has_value() && update_res->succeeded());
Platform::ProcessRequest signed_build = bld_req;
signed_build.arguments.push_back("--trusted-public-key");
signed_build.arguments.push_back(*public_key);
auto signed_res = Platform::run_supervised(signed_build);
Void::Testing::expect(signed_res.has_value() && signed_res->succeeded());
Platform::ProcessRequest wrong_key_build = bld_req;
wrong_key_build.arguments.push_back("--trusted-public-key");
wrong_key_build.arguments.push_back(std::string(64, 'a'));
auto wrong_key_res = Platform::run_supervised(wrong_key_build);
Void::Testing::expect(wrong_key_res.has_value() && !wrong_key_res->succeeded());
}
(*svc)->stop_http();
}
+152
View File
@@ -0,0 +1,152 @@
#include <Void/Build/Package/Lockfile.hpp>
#include <Void/Build/Provenance/Signing.hpp>
#include <Void/Build/Provenance/Verification.hpp>
#include <Void/System/TempDir.hpp>
#include <Void/Testing/Assert.hpp>
#include <Void/Testing/Test.hpp>
#include <filesystem>
#include <fstream>
#include <string>
#include <vector>
namespace {
using Void::Build::Provenance::signing_available;
using Void::Build::Provenance::TrustDecision;
using Void::Build::Provenance::verify_trusted_package_signature;
constexpr std::string_view kDigest =
"0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef";
const std::string kKeyA(64, 'a');
const std::string kKeyB(64, 'b');
const std::string kSignature(128, 'c');
Void::FileSystem::TempDir make_temp_dir() {
auto temp = Void::FileSystem::TempDir::open("vbs_signature_enforcement_");
Void::Testing::require(temp.has_value());
return std::move(*temp);
}
Void::Build::Package::LockfileDocument sample_document(bool signed_entry) {
Void::Build::Package::LockContextRecord context;
context.context_key = "debug:gcc:Linux:x86_64:target";
context.profile_name = "debug";
context.compiler = "gcc";
context.os = "Linux";
context.architecture = "x86_64";
context.machine_role = "target";
context.declaration_fingerprint = "fingerprint";
Void::Build::Package::LockedSourceEntry entry;
entry.alias = "demo";
entry.source_kind = "package";
entry.registry_authority = "http://127.0.0.1:1";
entry.package_name = "demo";
entry.version = "1.0.0";
entry.sha256 = std::string{kDigest};
entry.builder = "native";
if (signed_entry) {
entry.signature = kSignature;
entry.public_key = kKeyA;
}
context.entries.push_back(std::move(entry));
Void::Build::Package::LockfileDocument document;
document.contexts[context.context_key] = std::move(context);
return document;
}
} // namespace
VOID_TEST(SignatureEnforcement, lockfile_signature_fields_roundtrip_and_omit_when_absent) {
using namespace Void::Build::Package;
const auto signed_doc = sample_document(true);
const std::string signed_json = serialize_lockfile(signed_doc);
Void::Testing::expect(signed_json.find("\"signature\"") != std::string::npos);
Void::Testing::expect(signed_json.find("\"public_key\"") != std::string::npos);
auto parsed_signed = parse_lockfile(signed_json);
Void::Testing::require(parsed_signed.has_value());
const auto &signed_entry =
parsed_signed->contexts.at("debug:gcc:Linux:x86_64:target").entries.at(0);
Void::Testing::require(signed_entry.signature.has_value());
Void::Testing::require(signed_entry.public_key.has_value());
Void::Testing::expect_eq(*signed_entry.signature, kSignature);
Void::Testing::expect_eq(*signed_entry.public_key, kKeyA);
Void::Testing::expect_eq(serialize_lockfile(*parsed_signed), signed_json);
const auto unsigned_doc = sample_document(false);
const std::string unsigned_json = serialize_lockfile(unsigned_doc);
Void::Testing::expect(unsigned_json.find("\"signature\"") == std::string::npos);
Void::Testing::expect(unsigned_json.find("\"public_key\"") == std::string::npos);
auto parsed_unsigned = parse_lockfile(unsigned_json);
Void::Testing::require(parsed_unsigned.has_value());
const auto &unsigned_entry =
parsed_unsigned->contexts.at("debug:gcc:Linux:x86_64:target").entries.at(0);
Void::Testing::expect(!unsigned_entry.signature.has_value());
Void::Testing::expect(!unsigned_entry.public_key.has_value());
}
VOID_TEST(SignatureEnforcement, trust_policy_decisions_without_crypto) {
using Void::Build::Provenance::PackageSignature;
const PackageSignature signed_pkg{std::string{kDigest}, kSignature, kKeyA};
auto no_keys = verify_trusted_package_signature("demo", "1.0.0", signed_pkg, {});
Void::Testing::require(no_keys.has_value());
Void::Testing::expect(*no_keys == TrustDecision::Unsigned);
auto missing_signature = verify_trusted_package_signature(
"demo", "1.0.0", PackageSignature{std::string{kDigest}, {}, kKeyA}, {kKeyA});
Void::Testing::require(missing_signature.has_value());
Void::Testing::expect(*missing_signature == TrustDecision::Unsigned);
auto untrusted = verify_trusted_package_signature("demo", "1.0.0", signed_pkg, {kKeyB});
Void::Testing::require(untrusted.has_value());
Void::Testing::expect(*untrusted == TrustDecision::UntrustedKey);
// Case-insensitive trusted-key matching.
std::string upper_key = kKeyA;
for (char &c : upper_key) {
if (c >= 'a' && c <= 'f') {
c = static_cast<char>(c - 'a' + 'A');
}
}
if (!signing_available()) {
auto unavailable =
verify_trusted_package_signature("demo", "1.0.0", signed_pkg, {upper_key});
Void::Testing::expect(!unavailable.has_value());
}
}
VOID_TEST(SignatureEnforcement, trusted_key_accepts_valid_and_rejects_tampered_signature) {
using Void::Build::Provenance::PackageSignature;
if (!signing_available()) {
return;
}
auto temp = make_temp_dir();
const auto seed_path = temp.path() / "signing.seed";
Void::Testing::require(Void::Build::Provenance::generate_signing_seed(seed_path).has_value());
auto public_key = Void::Build::Provenance::public_key_from_seed(seed_path);
Void::Testing::require(public_key.has_value());
auto signature = Void::Build::Provenance::sign_package("demo", "1.0.0", kDigest, seed_path);
Void::Testing::require(signature.has_value());
const PackageSignature valid{std::string{kDigest}, *signature, *public_key};
auto verified = verify_trusted_package_signature("demo", "1.0.0", valid, {*public_key});
Void::Testing::require(verified.has_value());
Void::Testing::expect(*verified == TrustDecision::Verified);
std::string tampered_digest{kDigest};
tampered_digest.back() = tampered_digest.back() == '0' ? '1' : '0';
auto invalid = verify_trusted_package_signature(
"demo", "1.0.0", PackageSignature{tampered_digest, *signature, *public_key}, {*public_key});
Void::Testing::require(invalid.has_value());
Void::Testing::expect(*invalid == TrustDecision::InvalidSignature);
auto malformed = verify_trusted_package_signature(
"demo", "1.0.0", PackageSignature{std::string{kDigest}, "zz", *public_key}, {*public_key});
Void::Testing::expect(!malformed.has_value());
}