fix(package): never include the archive in itself; extend release-detail tests
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 3s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 9s

This commit is contained in:
faumaray committed 2026-12-04 05:04:44 +03:00
1 parent 691560a369
commit 2c4eeba945
7 files changed
+258 -1

No files matched your search

+2
View File
@@ -239,6 +239,8 @@ Stage: VERIFIED — Plans 01–19 + Plan 20 Slices 1–2C + Track A + Track B (B
- **Wave 73 (Actions Kind Filter & `vbs releases show`)**: the daemon `actions` request gained a `kind` filter (`--kind`), asserted in `Daemon.actions_lists_lowered_actions`. A swarm worker (7/7 tasks) added `Package::fetch_release_detail` (`ReleaseInfo`) and `vbs releases show --registry --name --version`, covered by CLI contracts and the live registry E2E.
- **Wave 74 (Self-Excluding Source Archives & Release-Detail Tests)**: `create_source_package` now skips its own output archive (and any stale copy at that path), so packing into a non-`build`-named directory no longer embeds the previous archive; asserted in `archive_security_determinism_binary_abi_and_redaction`. A swarm worker added a dedicated release-detail test (fields, signature metadata, 404, private auth) to `RegistryTests` (5/5 substantive tasks; its build task was stopped and re-run by the orchestrator).
## 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))**: Track C (macOS/Windows ports + dual-profile cross-compilation) and dedicated external editor plugins remain planned; Track D3 signing (SBOM, Ed25519 primitives, trusted-key enforcement/distribution, binary-variant signing/distribution) and Track E3 daemon capabilities are implemented, and Track E4 now uses `Void::Net` for the registry client/server and remote cache plus `Void::Sqlite` for the StateStore when available.
+1
View File
@@ -77,4 +77,5 @@ Base HEAD: `fe0d1a6`
| Wave 71 (Member-filtered describe + test path cleanup) | `describe` `member` filter in the daemon; swarm replaced `/proc/self/exe` in three test files | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon suite and full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{DaemonTests,RegistryTests,FullV1Tests,SelfHostTests}.cpp`, docs |
| Wave 72 (Daemon target flags + registry search tests) | `target_flags` daemon request + `vbs daemon target flags`; swarm deepened RegistryTests search/pagination coverage | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon and Registry suites pass, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `tests/{DaemonTests,RegistryTests}.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 73 (Actions kind filter + releases show) | daemon `actions --kind` filter; swarm added `fetch_release_detail` and `vbs releases show` with tests | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Daemon and Registry suites pass, full CTest 8/8) | `src/Daemon/Daemon.cpp`, `src/Main.cpp`, `include/Void/Build/Package/RegistryClient.hpp`, `src/Package/RegistryClient.cpp`, `tests/{DaemonTests,RegistryTests}.cpp`, `tests/CliContracts.cmake`, docs |
| Wave 74 (Self-excluding archives + release-detail tests) | `create_source_package` excludes its own output; swarm added release-detail RegistryTests coverage | COMPLETE & VERIFIED (GCC 16.2, pin `0002e74`; Registry 8/8, full CTest 8/8) | `src/Package/Archive.cpp`, `tests/{FullV1Tests,RegistryTests}.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) |
+10
View File
@@ -1161,6 +1161,16 @@ dev cpp-gcc -c build/pinned/bin/vbs_v1_tests --suite Daemon --no-color
- `cli_publish_deps_resolve_and_locked_build_against_live_registry` passes (3.66 s); full CTest:
**8 / 8 passed** in 244.47 s.
## Self-Excluding Source Archives & Release-Detail Tests (GCC 16.2, pin `0002e74`)
- `create_source_package` skips its own output path: packing twice into
`proj/dist/pkg.tar` and extracting shows no `dist/pkg.tar` entry
(`archive_security_determinism_binary_abi_and_redaction` passes in 127 ms).
- Swarm `swarm_mx8bv64x_hhks` (one worker) added a dedicated release-detail test to
`RegistryTests` (fields, signature metadata, 404, private auth; 5/5 substantive tasks; the
build task was stopped and re-run by the orchestrator).
- Registry suite: **8 / 8 passed** (10.91 s); full CTest: **8 / 8 passed** in 246.26 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).
+1 -1
View File
@@ -46,7 +46,7 @@ flowchart LR
| Phase | Concrete Scope | Acceptance Gate |
| --- | --- | --- |
| **C1 — Platform Backend Split** *(Linux backend split implemented; macOS/Windows pending)* | Split `src/Platform/` into `Linux/`, `MacOS/`, and `Windows/` behind clean interfaces (`FileOps`, `ProcessSupervisor`, `DirectoryWatcher`), delegating to `Void::System` as upstream adds OS backends. Linux implementations now live under `src/Platform/Linux/` and `src/Watch/Linux/` (inotify watcher) with an explicit `HostOs`/`host_supported()` boundary in `include/Void/Build/Platform/Host.hpp`; macOS/Windows backends await real hosts (`vbs doctor` and the daemon `info` request report the detected host and enabled backends, `Platform::current_executable_path()` isolates the executable-path lookup across sources and tests, the daemon `describe` request can be scoped to one workspace member, `vbs daemon target flags` serves per-unit compile arguments, and `vbs releases show` prints one release's detail). | Zero Linux regressions; clean platform abstraction boundary. |
| **C1 — Platform Backend Split** *(Linux backend split implemented; macOS/Windows pending)* | Split `src/Platform/` into `Linux/`, `MacOS/`, and `Windows/` behind clean interfaces (`FileOps`, `ProcessSupervisor`, `DirectoryWatcher`), delegating to `Void::System` as upstream adds OS backends. Linux implementations now live under `src/Platform/Linux/` and `src/Watch/Linux/` (inotify watcher) with an explicit `HostOs`/`host_supported()` boundary in `include/Void/Build/Platform/Host.hpp`; macOS/Windows backends await real hosts (`vbs doctor` and the daemon `info` request report the detected host and enabled backends, `Platform::current_executable_path()` isolates the executable-path lookup across sources and tests, the daemon `describe` request can be scoped to one workspace member, `vbs daemon target flags` serves per-unit compile arguments, `vbs releases show` prints one release's detail, and source archives never embed themselves). | Zero Linux regressions; clean platform abstraction boundary. |
| **C2 — macOS / Apple Clang & `ld64`** | Apple Clang toolchain probes, `.dylib` + `@rpath`/`@loader_path` install-name lowering, `FSEvents` watcher, Mach-O deterministic timestamps. | Real macOS CI runner passing all SDK, core, module, and install tests. |
| **C3 — Windows / MSVC & `clang-cl`** | MSVC (`cl.exe`, `lib.exe`, `link.exe`, `/showIncludes`, `.pdb`, `/FS`, `.dll`/`.lib` import libraries), Job Object process-tree kill, `ReadDirectoryChangesW` watcher, case-insensitive path conflict detection. | Real Windows CI runner passing process-tree kill, header-shadowing, and install relocation tests. |
| **C4 — True Host-vs-Target Cross-Compilation** | Dual-context evaluation (`host` profile for code generators and `build_dependency` tools vs `target` profile for cross-compiled products), sysroot & `--target=` triple propagation. | `linux-x86_64` host cross-compiling `linux-aarch64` fixture while executing host-compiled generator natively. |
+16
View File
@@ -79,11 +79,27 @@ create_source_package(const std::filesystem::path &project_root,
std::format("create_source_package: '{}' is not a directory", project_root.string()))};
}
// The archive must never contain itself (or its in-progress staging file) when the output
// lives inside the project tree, e.g. a custom build directory that is not named `build`.
std::error_code output_ec;
const auto canonical_output = std::filesystem::weakly_canonical(output_tar, output_ec);
const bool have_output = !output_ec;
const auto is_output_path = [&](const std::filesystem::path &path) {
if (!have_output) {
return false;
}
std::error_code candidate_ec;
return std::filesystem::weakly_canonical(path, candidate_ec) == canonical_output;
};
std::vector<ArchiveEntrySpec> entries;
std::filesystem::recursive_directory_iterator it{
canon, std::filesystem::directory_options::skip_permission_denied, ec};
for (; !ec && it != std::filesystem::recursive_directory_iterator{}; it.increment(ec)) {
const auto rel = it->path().lexically_relative(canon);
if (is_output_path(it->path())) {
continue;
}
if (is_excluded_package_path(rel)) {
if (it->is_directory(ec)) {
it.disable_recursion_pending();
+8
View File
@@ -572,6 +572,14 @@ VOID_TEST(FullV1Tests, archive_security_determinism_binary_abi_and_redaction) {
Void::Testing::expect(!std::filesystem::exists(out_dir / ".git" / "HEAD"));
Void::Testing::expect(!std::filesystem::exists(out_dir / ".env"));
// An archive written inside the project never contains itself on a later run.
const auto inner_tar = proj / "dist" / "pkg.tar";
Void::Testing::expect(Package::create_source_package(proj, inner_tar, 0).has_value());
Void::Testing::expect(Package::create_source_package(proj, inner_tar, 0).has_value());
const auto inner_out = tmp / "inner_extracted";
Void::Testing::expect(Package::extract_safe_tar(inner_tar, inner_out).has_value());
Void::Testing::expect(!std::filesystem::exists(inner_out / "dist" / "pkg.tar"));
// Malicious tar rejection: path traversal, absolute path, symlink, duplicate path, quota.
const auto trav_tar = tmp / "trav.tar";
write_raw_tar(trav_tar, {{"../escape.txt", '0', "evil"}});
+220
View File
@@ -19,6 +19,7 @@
#include <algorithm>
#include <cstring>
#include <fstream>
#include <optional>
#include <span>
using namespace Void::Build;
@@ -50,6 +51,34 @@ std::string extract_json_str(std::string_view json, const std::string &key) {
return s ? *s : std::string{};
}
std::optional<std::int64_t> extract_json_int(std::string_view json, const std::string &key) {
auto parsed = Void::Json::Strict::parse(json);
if (!parsed)
return std::nullopt;
const auto *obj = std::get_if<Void::Json::Strict::Value::Object>(&parsed->value);
if (!obj)
return std::nullopt;
const auto it = obj->find(key);
if (it == obj->end())
return std::nullopt;
const auto *n = std::get_if<std::int64_t>(&it->second.value);
return n ? std::optional<std::int64_t>{*n} : std::nullopt;
}
std::optional<bool> extract_json_bool(std::string_view json, const std::string &key) {
auto parsed = Void::Json::Strict::parse(json);
if (!parsed)
return std::nullopt;
const auto *obj = std::get_if<Void::Json::Strict::Value::Object>(&parsed->value);
if (!obj)
return std::nullopt;
const auto it = obj->find(key);
if (it == obj->end())
return std::nullopt;
const auto *b = std::get_if<bool>(&it->second.value);
return b ? std::optional<bool>{*b} : std::nullopt;
}
std::filesystem::path locate_vbs_binary() {
std::error_code ec;
if (const auto self_exe = Platform::current_executable_path(); self_exe) {
@@ -784,6 +813,14 @@ VOID_TEST(RegistryTests, registry_binary_variant_publish_download_and_materializ
}
auto missing_release = send_loopback_http(port, "GET", "/api/v1/packages/demo-bin/9.9.9");
Void::Testing::expect(missing_release.has_value() && missing_release->status == 404);
if (missing_release) {
Void::Testing::expect(missing_release->body.find("release not found") != std::string::npos);
}
auto missing_package = send_loopback_http(port, "GET", "/api/v1/packages/no-such-pkg/1.0.0");
Void::Testing::expect(missing_package.has_value() && missing_package->status == 404);
if (missing_package) {
Void::Testing::expect(missing_package->body.find("package not found") != std::string::npos);
}
auto listed = send_loopback_http(port, "GET", "/api/v1/packages/demo-bin/1.0.0/binaries");
Void::Testing::expect(listed.has_value() && listed->status == 200);
@@ -1310,3 +1347,186 @@ target_include_directories(hello_pkg PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include
(*svc)->stop_http();
}
VOID_TEST(RegistryTests, registry_release_detail_fields_signature_404_and_private_auth) {
Void::FileSystem::TempDir tmp{"vbs_release_detail_"};
RegistryConfig cfg;
cfg.data_dir = tmp / "data";
cfg.web_root = std::filesystem::path{Bootstrap::source_dir} / "registry" / "web";
cfg.bind_address = "127.0.0.1";
cfg.port = 0;
cfg.bootstrap_admin_user = "admin";
cfg.bootstrap_admin_password = "admin_secret_password";
auto svc = RegistryService::open(cfg);
Void::Testing::expect(svc.has_value());
if (!svc)
return;
Void::Testing::expect(
(*svc)->create_user("detail_pub", "detail_pass", Role::Publisher).has_value());
auto tok = (*svc)->create_token("detail_pub", "detail", {"read", "publish"});
Void::Testing::expect(tok.has_value());
if (!tok)
return;
Void::Testing::expect((*svc)->start_http().has_value());
const auto port = (*svc)->bound_port();
Void::Testing::expect(port > 0);
const auto pkg_src = tmp / "detail_pkg";
(void)Platform::atomic_write_file(pkg_src / "payload.txt", "RELEASE_DETAIL_PAYLOAD", false);
const auto tar = tmp / "detail.tar";
auto sha = Package::create_source_package(pkg_src, tar, 0);
Void::Testing::require(sha.has_value());
auto bytes = Void::FileSystem::read_file(tar);
Void::Testing::require(bytes.has_value());
auto published = send_loopback_http(
port, "PUT", "/api/v1/packages/detail-pkg/1.0.0",
{{"Authorization", "Bearer " + *tok}, {"X-Content-SHA256", *sha}}, *bytes);
Void::Testing::require(published.has_value() && published->status == 201);
// Release detail serves the immutable release record and its binary summaries.
auto detail = send_loopback_http(port, "GET", "/api/v1/packages/detail-pkg/1.0.0");
Void::Testing::expect(detail.has_value() && detail->status == 200);
if (detail) {
Void::Testing::expect_eq(extract_json_str(detail->body, "name"), std::string{"detail-pkg"});
Void::Testing::expect_eq(extract_json_str(detail->body, "version"), std::string{"1.0.0"});
Void::Testing::expect_eq(extract_json_str(detail->body, "sha256"), *sha);
Void::Testing::expect_eq(extract_json_str(detail->body, "publisher"),
std::string{"detail_pub"});
const auto size_bytes = extract_json_int(detail->body, "size_bytes");
Void::Testing::require(size_bytes.has_value());
Void::Testing::expect_eq(*size_bytes, static_cast<std::int64_t>(bytes->size()));
const auto published_epoch = extract_json_int(detail->body, "published_epoch");
Void::Testing::require(published_epoch.has_value());
Void::Testing::expect(*published_epoch > 0);
const auto yanked = extract_json_bool(detail->body, "yanked");
Void::Testing::require(yanked.has_value());
Void::Testing::expect(!*yanked);
Void::Testing::expect(detail->body.find("\"binaries\":[]") != std::string::npos);
// An unsigned release omits the signature metadata keys entirely.
Void::Testing::expect(detail->body.find("\"signature\"") == std::string::npos);
Void::Testing::expect(detail->body.find("\"public_key\"") == std::string::npos);
}
// The RegistryClient helper parses the same payload and maps a missing release to not_found.
const std::string reg_url = "http://127.0.0.1:" + std::to_string(port);
auto client_detail =
Package::fetch_release_detail(reg_url, "detail-pkg", "1.0.0", Package::RegistryAuth{*tok});
Void::Testing::require(client_detail.has_value());
Void::Testing::expect_eq(client_detail->name, std::string{"detail-pkg"});
Void::Testing::expect_eq(client_detail->version, std::string{"1.0.0"});
Void::Testing::expect_eq(client_detail->sha256, *sha);
Void::Testing::expect_eq(client_detail->size_bytes, static_cast<std::uint64_t>(bytes->size()));
Void::Testing::expect_eq(client_detail->binary_count, std::size_t{0});
Void::Testing::expect(!client_detail->yanked);
auto missing_client =
Package::fetch_release_detail(reg_url, "detail-pkg", "9.9.9", Package::RegistryAuth{*tok});
Void::Testing::expect(!missing_client.has_value());
if (!missing_client) {
Void::Testing::expect(missing_client.error().message().find("404") != std::string::npos);
}
// 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_published =
send_loopback_http(port, "PUT", "/api/v1/packages/signed-detail-pkg/1.0.0",
{{"Authorization", "Bearer " + *tok},
{"X-Content-SHA256", *sha},
{"X-Package-Signature", release_signature},
{"X-Package-Public-Key", release_public_key}},
*bytes);
Void::Testing::require(signed_published.has_value() && signed_published->status == 201);
auto signed_detail =
send_loopback_http(port, "GET", "/api/v1/packages/signed-detail-pkg/1.0.0");
Void::Testing::expect(signed_detail.has_value() && signed_detail->status == 200);
if (signed_detail) {
Void::Testing::expect_eq(extract_json_str(signed_detail->body, "signature"),
release_signature);
Void::Testing::expect_eq(extract_json_str(signed_detail->body, "public_key"),
release_public_key);
}
// Yanking a release is reflected in its detail (admin session cookie + CSRF token).
auto login = send_loopback_http(
port, "POST", "/api/v1/auth/login", {{"Content-Type", "application/json"}},
"{\"username\":\"admin\",\"password\":\"admin_secret_password\"}");
Void::Testing::require(login.has_value() && login->status == 200);
const auto cookie = extract_session_cookie(login->set_cookies);
const auto csrf = extract_json_str(login->body, "csrf_token");
Void::Testing::require(!cookie.empty() && !csrf.empty());
auto yank = send_loopback_http(port, "POST", "/api/v1/packages/signed-detail-pkg/1.0.0/yank",
{{"Cookie", cookie}, {"X-CSRF-Token", csrf}});
Void::Testing::expect(yank.has_value() && yank->status == 200);
auto yanked_detail =
send_loopback_http(port, "GET", "/api/v1/packages/signed-detail-pkg/1.0.0");
Void::Testing::expect(yanked_detail.has_value() && yanked_detail->status == 200);
if (yanked_detail) {
const auto yanked = extract_json_bool(yanked_detail->body, "yanked");
Void::Testing::require(yanked.has_value());
Void::Testing::expect(*yanked);
}
// Private releases require read access: anonymous 401, no-read principal 403, reader 200.
auto private_published =
send_loopback_http(port, "PUT", "/api/v1/packages/private-detail-pkg/1.0.0",
{{"Authorization", "Bearer " + *tok},
{"X-Content-SHA256", *sha},
{"X-Package-Private", "true"}},
*bytes);
Void::Testing::require(private_published.has_value() && private_published->status == 201);
Void::Testing::expect(
(*svc)->create_user("detail_noread", "noread_pass", Role::Reader).has_value());
auto noread_tok = (*svc)->create_token("detail_noread", "noread", {});
Void::Testing::expect(noread_tok.has_value());
if (!noread_tok)
return;
Void::Testing::expect(
(*svc)->create_user("detail_reader", "reader_pass", Role::Reader).has_value());
auto reader_tok = (*svc)->create_token("detail_reader", "read", {"read"});
Void::Testing::expect(reader_tok.has_value());
if (!reader_tok)
return;
const std::string private_path = "/api/v1/packages/private-detail-pkg/1.0.0";
auto anonymous_private = send_loopback_http(port, "GET", private_path);
Void::Testing::expect(anonymous_private.has_value() && anonymous_private->status == 401);
auto forbidden_private =
send_loopback_http(port, "GET", private_path, {{"Authorization", "Bearer " + *noread_tok}});
Void::Testing::expect(forbidden_private.has_value() && forbidden_private->status == 403);
auto owner_private =
send_loopback_http(port, "GET", private_path, {{"Authorization", "Bearer " + *tok}});
Void::Testing::expect(owner_private.has_value() && owner_private->status == 200);
if (owner_private) {
Void::Testing::expect_eq(extract_json_str(owner_private->body, "name"),
std::string{"private-detail-pkg"});
Void::Testing::expect_eq(extract_json_str(owner_private->body, "version"),
std::string{"1.0.0"});
Void::Testing::expect_eq(extract_json_str(owner_private->body, "sha256"), *sha);
const auto size_bytes = extract_json_int(owner_private->body, "size_bytes");
Void::Testing::require(size_bytes.has_value());
Void::Testing::expect_eq(*size_bytes, static_cast<std::int64_t>(bytes->size()));
}
auto reader_private =
send_loopback_http(port, "GET", private_path, {{"Authorization", "Bearer " + *reader_tok}});
Void::Testing::expect(reader_private.has_value() && reader_private->status == 200);
// The client surfaces the registry's 401 as a permission_denied system error.
auto anonymous_client = Package::fetch_release_detail(reg_url, "private-detail-pkg", "1.0.0",
Package::RegistryAuth{});
Void::Testing::expect(!anonymous_client.has_value());
if (!anonymous_client) {
const auto &error = anonymous_client.error();
Void::Testing::expect_eq(error.code().domain, Void::Result::kSystemErrorDomain);
Void::Testing::expect_eq(
error.code().value,
static_cast<std::int32_t>(Void::System::SystemErrorCode::permission_denied));
Void::Testing::expect(error.message().find("401") != std::string::npos);
}
(*svc)->stop_http();
}