feat(install): sign installer archives with Ed25519 and checksums
This commit is contained in:
1 parent
9509c0691e
commit
b55aca328a
8 files changed
+122
-10
No files matched your search
@@ -288,6 +288,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
|
||||
|
||||
- **Wave 97 (Package Generators: ZIP & DEB)**: `vbs install --archive FILE --archive-format zip|deb` now supports a stored (uncompressed) deterministic ZIP and a Debian `ar` package (`debian-binary`, `control.tar`, `data.tar` with Package/Version/Architecture/Maintainer/Installed-Size/Description metadata). `dpkg-deb --info/--contents` validates the generated package. Tests assert the ZIP structure and parse/extract the DEB members.
|
||||
|
||||
- **Wave 98 (Signed Installer Archives)**: `vbs install --archive FILE --signing-key SEED` now writes `<archive>.sha256` (sha256sum format), `<archive>.sig` (Ed25519 detached signature hex) and `<archive>.pub` (signer key hex), and fails closed when no Ed25519 backend is available. The install test verifies the checksum prefix, the signature/key lengths, and the signature over the archive bytes when signing is available.
|
||||
|
||||
## Remaining future scope
|
||||
|
||||
- **Superiority plan ([22-superiority-and-gaps.md](../roadmap/22-superiority-and-gaps.md), 2026-12-05)**: revised platform strategy - **macOS deferred**, **Windows via MinGW-w64 cross-compilation + Wine execution** (`dev cpp-gcc -p pkgsCross.mingwW64.stdenv.cc`, `dev cpp-gcc -p wine64`), native MSVC deferred; plus packaging parity (ZIP/DEB/RPM), IDE ecosystem, migration tooling, test-runner parity, benchmarks, CI runners, and remote execution in prioritized order.
|
||||
|
||||
@@ -101,4 +101,5 @@ Base HEAD: `fe0d1a6`
|
||||
| Wave 95 (Superiority plan) | Wrote `22-superiority-and-gaps.md`: gap inventory, revised platforms (macOS deferred; Windows via MinGW-w64 + Wine; native MSVC deferred), CMake/Meson/build2 parity table, differentiators, priority order, acceptance gates; refreshed stale roadmap statuses | PLAN WRITTEN (implementation pending) | `docs/roadmap/22-superiority-and-gaps.md`, `docs/roadmap/{README,20,21}.md`, `STATE.md` |
|
||||
| Wave 96 (Wine-first Windows target) | MinGW-w64 cross discovery, PE artifact naming, `--target-os/--target-arch`, Wine test runner | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Windows target cross-build + Wine test pass; full CTest 8/8) | `src/Toolchain/Driver.cpp`, `src/Graph/Graph.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||
| Wave 97 (ZIP & DEB generators) | `--archive-format zip|deb`: stored ZIP and Debian ar package with metadata; tested structurally and validated with real `dpkg-deb` | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install test passes, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||
| Wave 98 (Signed installer archives) | `--signing-key` writes `.sha256`/`.sig`/`.pub` for the installer archive and fails closed without a backend | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; install test passes, full CTest 8/8) | `include/Void/Build/Install/Installer.hpp`, `src/Install/Installer.cpp`, `src/Main.cpp`, `tests/FullV1Tests.cpp`, docs |
|
||||
| Future (Plan 20 Slice 3 / Tracks C, E3 editor extensions) |"}] Live `conan` CLI verification; macOS/Windows/cross-compile; binary-variant signing and key distribution; daemon-side dependency materialization and editor plugins; `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) |
|
||||
@@ -1389,6 +1389,16 @@ dev cpp-gcc -c ctest --test-dir build/pinned --output-on-failure
|
||||
the native package metadata.
|
||||
- Install test: **passed** (6.45 s); full CTest: **8 / 8 passed** in 282.16 s.
|
||||
|
||||
## Signed Installer Archives (GCC 16.2, pin `0002e74`)
|
||||
|
||||
- `vbs install --archive FILE --signing-key SEED` writes `FILE.sha256` (sha256sum format),
|
||||
`FILE.sig` (128-hex Ed25519 signature) and `FILE.pub` (64-hex signer key); without an Ed25519
|
||||
backend it fails closed instead of silently skipping.
|
||||
- `foreign_cmake_meson_providers_bridge_and_relocatable_install`: **passed** (7.16 s) - when
|
||||
signing is available the checksum prefix, 129/65-byte signature/key files, and the signature
|
||||
over the archive bytes are verified; otherwise the failure path is asserted.
|
||||
- Full CTest: **8 / 8 passed** in 281.48 s.
|
||||
|
||||
## 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).
|
||||
|
||||
@@ -52,7 +52,7 @@ Concrete work this implies:
|
||||
| Languages | C, C++, CUDA, Fortran, ObjC, ASM, HIP… | C, C++, Rust, D, Fortran, Java… | C/C++ focused | C, C++ | ASM/CUDA/ObjC or a documented extension API |
|
||||
| Toolchains | MSVC, clang-cl, GCC, Clang, Apple, many | GCC, Clang, MSVC, many | GCC, Clang, MSVC | GCC, Clang (Linux) | MinGW target; MSVC deferred |
|
||||
| Package/registry | External (vcpkg, Conan, FetchContent) | wrapdb, subprojects | cppget.org / brep | **Built-in registry + solver + lock + binary variants + signatures + SBOM** | federation, mirrors, key distribution |
|
||||
| Install/package | `install()`, `install(EXPORT)`, CPack (TGZ/ZIP/DEB/RPM/WIX/DMG/NuGet/APK…) | `install_data`, `install_headers`, dist scripts | install module | prefix staging, components, relocatable CMake + native exports, tar, self-extracting `sh`, **stored ZIP**, **DEB (dpkg-validated)**, SBOM, signing | RPM, MSI/DMG-style, package signing |
|
||||
| Install/package | `install()`, `install(EXPORT)`, CPack (TGZ/ZIP/DEB/RPM/WIX/DMG/NuGet/APK…) | `install_data`, `install_headers`, dist scripts | install module | prefix staging, components, relocatable CMake + native exports, tar, self-extracting `sh`, **stored ZIP**, **DEB (dpkg-validated)**, SBOM, **Ed25519-signed archives with checksums** | RPM, MSI/DMG-style |
|
||||
| IDE integration | File API, presets, every IDE | `meson-info` introspection | limited | `vbs ide generate/query`, CompDB, daemon protocol | File API shim, `CMakePresets.json` import, plugins |
|
||||
| Test runner | CTest: fixtures, labels, resource locks, timeouts, JUnit/CDash | `meson test`: suites, timeouts, JUnit | test module | `VOID_TEST` runner | fixtures, labels, locks, timeouts, JUnit |
|
||||
| Incremental / cache | compiler depfiles, ccache external | depfiles, ccache | internal caching model | **content-addressed state, immutable snapshots, remote action cache** | scale benchmarks |
|
||||
|
||||
@@ -28,6 +28,9 @@ struct InstallOptions {
|
||||
std::string archive_format{"tar"};
|
||||
std::string package_description; // Used by package metadata (deb).
|
||||
std::string maintainer; // Used by package metadata (deb).
|
||||
// Optional Ed25519 seed file: signs the generated archive and writes
|
||||
// `<archive>.sha256`, `<archive>.sig` and `<archive>.pub`.
|
||||
std::optional<std::filesystem::path> signing_seed_path;
|
||||
};
|
||||
|
||||
struct InstallReport {
|
||||
@@ -37,6 +40,10 @@ struct InstallReport {
|
||||
std::optional<std::filesystem::path> cmake_config_file;
|
||||
std::optional<std::filesystem::path> native_package_file;
|
||||
std::optional<std::filesystem::path> archive_path;
|
||||
std::string archive_sha256;
|
||||
std::optional<std::filesystem::path> checksum_path;
|
||||
std::optional<std::filesystem::path> signature_path;
|
||||
std::optional<std::filesystem::path> public_key_path;
|
||||
std::vector<std::filesystem::path> bundled_libraries;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
#include <Void/Build/Package/Archive.hpp>
|
||||
#include <Void/Build/Platform/FileOps.hpp>
|
||||
#include <Void/Build/Provenance/Signing.hpp>
|
||||
#include <Void/Build/Util/Json.hpp>
|
||||
#include <Void/Build/Util/Sha256.hpp>
|
||||
#include <Void/Core/Scope.hpp>
|
||||
@@ -591,19 +592,13 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
|
||||
if (auto zipped = write_stored_zip(*options.archive_path, archive_entries); !zipped) {
|
||||
return std::unexpected{zipped.error()};
|
||||
}
|
||||
report.archive_path = *options.archive_path;
|
||||
return report;
|
||||
}
|
||||
if (options.archive_format == "deb") {
|
||||
} else if (options.archive_format == "deb") {
|
||||
if (auto packed = write_deb_package(*options.archive_path, options, graph,
|
||||
archive_entries);
|
||||
!packed) {
|
||||
return std::unexpected{packed.error()};
|
||||
}
|
||||
report.archive_path = *options.archive_path;
|
||||
return report;
|
||||
}
|
||||
|
||||
} else {
|
||||
const bool archive_as_script = options.archive_format == "sh";
|
||||
const auto archive_target = archive_as_script
|
||||
? stage_root / "installer-payload.tar"
|
||||
@@ -659,7 +654,48 @@ install_project(const Graph::ProjectDescription &description, const Graph::Build
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
}
|
||||
}
|
||||
report.archive_path = *options.archive_path;
|
||||
|
||||
// Optional detached signature and checksums over the final archive bytes.
|
||||
if (options.signing_seed_path) {
|
||||
auto bytes = Void::FileSystem::read_file(*options.archive_path);
|
||||
if (!bytes) {
|
||||
return std::unexpected{bytes.error()};
|
||||
}
|
||||
report.archive_sha256 = Util::sha256_hex(*bytes);
|
||||
report.checksum_path = options.archive_path->string() + ".sha256";
|
||||
if (auto written = Platform::atomic_write_file(
|
||||
*report.checksum_path,
|
||||
report.archive_sha256 + " " + options.archive_path->filename().string() + "\n",
|
||||
true);
|
||||
!written) {
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
|
||||
auto signature = Provenance::sign_message(
|
||||
std::as_bytes(std::span<const char>{bytes->data(), bytes->size()}),
|
||||
*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()};
|
||||
}
|
||||
report.signature_path = options.archive_path->string() + ".sig";
|
||||
if (auto written = Platform::atomic_write_file(*report.signature_path,
|
||||
*signature + "\n", true);
|
||||
!written) {
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
report.public_key_path = options.archive_path->string() + ".pub";
|
||||
if (auto written = Platform::atomic_write_file(*report.public_key_path,
|
||||
*public_key + "\n", true);
|
||||
!written) {
|
||||
return std::unexpected{written.error()};
|
||||
}
|
||||
}
|
||||
}
|
||||
return report;
|
||||
}
|
||||
|
||||
+11
-1
@@ -1691,6 +1691,7 @@ struct InstallCmdOptions {
|
||||
std::optional<std::string> component_arg;
|
||||
std::optional<std::string> archive_arg;
|
||||
std::string archive_format_arg{"tar"};
|
||||
std::optional<std::string> signing_key_arg;
|
||||
bool no_cmake_export{false};
|
||||
bool no_native_export{false};
|
||||
bool bundle_dependencies{false};
|
||||
@@ -1732,6 +1733,12 @@ int execute_install_command(const InstallCmdOptions &opts) {
|
||||
if (opts.archive_arg && !opts.archive_arg->empty()) {
|
||||
iopts.archive_path = std::filesystem::path{*opts.archive_arg};
|
||||
iopts.archive_format = opts.archive_format_arg;
|
||||
if (opts.signing_key_arg) {
|
||||
iopts.signing_seed_path = std::filesystem::path{*opts.signing_key_arg};
|
||||
}
|
||||
} else if (opts.signing_key_arg) {
|
||||
std::cerr << "vbs install: --signing-key requires --archive\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
std::error_code ec;
|
||||
@@ -2874,7 +2881,10 @@ int main(int argc, char **argv) {
|
||||
install_opts.archive_arg)
|
||||
.option_default("--archive-format", "",
|
||||
"Installer archive format: tar (default), sh, zip or deb",
|
||||
install_opts.archive_format_arg, "tar");
|
||||
install_opts.archive_format_arg, "tar")
|
||||
.option("--signing-key", "",
|
||||
"Ed25519 seed file; signs the archive and writes .sha256/.sig/.pub",
|
||||
install_opts.signing_key_arg);
|
||||
add_log_flags(install_cmd);
|
||||
|
||||
auto &uninstall_cmd =
|
||||
|
||||
@@ -14,9 +14,11 @@
|
||||
#include <Void/Build/Platform/FileOps.hpp>
|
||||
#include <Void/Build/Platform/ProcessSupervisor.hpp>
|
||||
#include <Void/Build/Provenance/Sbom.hpp>
|
||||
#include <Void/Build/Provenance/Signing.hpp>
|
||||
#include <Void/Build/Provider/Provider.hpp>
|
||||
#include <Void/Build/Provider/Translator.hpp>
|
||||
#include <Void/Build/Snapshot/Snapshot.hpp>
|
||||
#include <Void/Build/Util/Sha256.hpp>
|
||||
#include <Void/Build/State/StateStore.hpp>
|
||||
#include <Void/Build/Toolchain/Driver.hpp>
|
||||
#include <Void/Build/Watch/Watcher.hpp>
|
||||
@@ -32,6 +34,7 @@
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <span>
|
||||
#include <thread>
|
||||
|
||||
using namespace Void::Build;
|
||||
@@ -1009,6 +1012,49 @@ void build(Void::Build::Project &p) {
|
||||
Void::Testing::expect(std::filesystem::exists(data_out / "bin" / "cli_hi"));
|
||||
}
|
||||
|
||||
// Signed installer archive: Ed25519 detached signature plus checksums.
|
||||
const auto signed_archive = tmp / "cli_hi-signed.tar";
|
||||
const auto signing_seed = tmp / "install.seed";
|
||||
auto sign_req = inst_req;
|
||||
for (auto &arg : sign_req.arguments) {
|
||||
if (arg == installer_archive.string()) {
|
||||
arg = signed_archive.string();
|
||||
}
|
||||
}
|
||||
sign_req.arguments.push_back("--signing-key");
|
||||
sign_req.arguments.push_back(signing_seed.string());
|
||||
const bool signing_ready = Provenance::signing_available();
|
||||
if (signing_ready) {
|
||||
Void::Testing::require(
|
||||
Provenance::generate_signing_seed(signing_seed).has_value());
|
||||
}
|
||||
auto sign_res = Platform::run_supervised(sign_req);
|
||||
if (signing_ready) {
|
||||
Void::Testing::expect(sign_res.has_value() && sign_res->succeeded());
|
||||
Void::Testing::expect(std::filesystem::exists(signed_archive.string() + ".sha256"));
|
||||
Void::Testing::expect(std::filesystem::exists(signed_archive.string() + ".sig"));
|
||||
Void::Testing::expect(std::filesystem::exists(signed_archive.string() + ".pub"));
|
||||
auto archive_bytes = Void::FileSystem::read_file(signed_archive);
|
||||
auto signature_text = Void::FileSystem::read_file(signed_archive.string() + ".sig");
|
||||
auto public_key_text = Void::FileSystem::read_file(signed_archive.string() + ".pub");
|
||||
auto checksum_text = Void::FileSystem::read_file(signed_archive.string() + ".sha256");
|
||||
Void::Testing::require(archive_bytes.has_value() && signature_text.has_value() &&
|
||||
public_key_text.has_value() && checksum_text.has_value());
|
||||
Void::Testing::expect_eq(signature_text->size(), std::size_t{129});
|
||||
Void::Testing::expect_eq(public_key_text->size(), std::size_t{65});
|
||||
Void::Testing::expect(checksum_text->starts_with(Util::sha256_hex(*archive_bytes)));
|
||||
auto verified = Provenance::verify_message(
|
||||
std::as_bytes(
|
||||
std::span<const char>{archive_bytes->data(), archive_bytes->size()}),
|
||||
std::string_view{*signature_text}.substr(0, 128),
|
||||
std::string_view{*public_key_text}.substr(0, 64));
|
||||
Void::Testing::require(verified.has_value());
|
||||
Void::Testing::expect(*verified);
|
||||
} else {
|
||||
// Without an Ed25519 backend signing must fail closed, never silently skip.
|
||||
Void::Testing::expect(sign_res.has_value() && !sign_res->succeeded());
|
||||
}
|
||||
|
||||
Platform::ProcessRequest uninst_req;
|
||||
uninst_req.executable = vbs_bin;
|
||||
uninst_req.arguments = {"uninstall", "--prefix", cli_prefix.string()};
|
||||
|
||||
Reference in new issue
Block a user