fix: close the VBS-side gaps noted on Void/Library#61
VoidBuildSystem CI / sanitizers-gcc16 (push) Failing after 7s
VoidBuildSystem CI / signing-openssl-gcc16 (push) Failing after 13s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 5s
VoidBuildSystem CI / wine-windows-gcc16 (push) Failing after 57s

This commit is contained in:
faumaray committed 2026-12-05 10:30:57 +03:00
1 parent 4f581d1b51
commit 4d51331777
13 files changed
+158 -14

No files matched your search

+24
View File
@@ -112,6 +112,30 @@ VOID_TEST(CoreEngineTests, process_supervisor_exec_failure_and_early_leader_gran
std::this_thread::sleep_for(std::chrono::milliseconds{300});
Void::Testing::expect(!std::filesystem::exists(sentinel));
}
// 4. Without a request timeout, orphaned descendants are reaped after descendant_grace so
// test supervision never hangs (and the escaped grandchild is killed).
{
Void::FileSystem::TempDir tmp{"vbs_proc_"};
const auto sentinel = tmp / "orphan_escaped.txt";
Platform::ProcessRequest req;
req.executable = "/bin/sh";
req.arguments = {"-c", "sh -c 'trap \"\" TERM; sleep 1.5; echo escaped > \"" +
sentinel.string() + "\"' >/dev/null 2>&1 & exit 0"};
req.descendant_grace = std::chrono::milliseconds{150};
req.kill_grace = std::chrono::milliseconds{80};
const auto started = std::chrono::steady_clock::now();
auto res = Platform::run_supervised(req);
const auto elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(
std::chrono::steady_clock::now() - started);
Void::Testing::expect(res.has_value());
if (res) {
Void::Testing::expect(res->succeeded());
}
Void::Testing::expect(elapsed < std::chrono::seconds{5});
std::this_thread::sleep_for(std::chrono::milliseconds{300});
Void::Testing::expect(!std::filesystem::exists(sentinel));
}
}
VOID_TEST(CoreEngineTests, profile_inheritance_and_cycle_rejection) {
+24 -3
View File
@@ -1038,17 +1038,31 @@ void build(Void::Build::Project &p) {
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");
auto message_text = Void::FileSystem::read_file(signed_archive.string() + ".msg");
Void::Testing::require(archive_bytes.has_value() && signature_text.has_value() &&
public_key_text.has_value() && checksum_text.has_value());
public_key_text.has_value() && checksum_text.has_value() &&
message_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)));
// The signed message is the short canonical digest statement, not the archive bytes.
Void::Testing::expect(message_text->starts_with("vbs-installer-v1\n"));
Void::Testing::expect(message_text->size() < 128);
auto verified = Provenance::verify_message(
std::as_bytes(std::span<const char>{archive_bytes->data(), archive_bytes->size()}),
std::as_bytes(std::span<const char>{message_text->data(), message_text->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);
// A tampered digest must not verify.
std::string tampered = *message_text;
tampered[tampered.size() - 2] = tampered[tampered.size() - 2] == '0' ? '1' : '0';
auto tampered_result = Provenance::verify_message(
std::as_bytes(std::span<const char>{tampered.data(), tampered.size()}),
std::string_view{*signature_text}.substr(0, 128),
std::string_view{*public_key_text}.substr(0, 64));
Void::Testing::require(tampered_result.has_value());
Void::Testing::expect(!*tampered_result);
} else {
// Without an Ed25519 backend signing must fail closed, never silently skip.
Void::Testing::expect(sign_res.has_value() && !sign_res->succeeded());
@@ -2095,7 +2109,14 @@ VOID_TEST(FullV1Tests, native_vbs_subproject_dependency_builds_without_cmake) {
// Pure `build.cpp` library dependency (NO CMakeLists.txt!).
const auto dep_dir = tmp / "sub_math_dep";
write_file(dep_dir / "build.cpp", R"cpp(#include <Void/Build.hpp>
#include <stdexcept>
#include <string>
void build(Void::Build::Project &p) {
// The consumer's .native_builder({...}) options reach this description.
const std::string enabled = Void::Build::dependency_option("SUB_MATH_ENABLED");
if (enabled != "yes") {
throw std::runtime_error("SUB_MATH_ENABLED must be yes, got '" + enabled + "'");
}
auto lib = p.static_library("sub_math");
lib.cxx_standard(Void::Build::CxxStandard::Cxx26)
.sources({"src/math.cpp"})
@@ -2113,7 +2134,7 @@ void build(Void::Build::Project &p) {
"void build(Void::Build::Project &p) {\n"
" auto dep = p.dependency(\"math\").path(\"" +
dep_dir.string() +
"\").native_builder();\n"
"\").native_builder({{\"SUB_MATH_ENABLED\", \"yes\"}});\n"
" p.test(\"consumer_test\")\n"
" .cxx_standard(Void::Build::CxxStandard::Cxx26)\n"
" .sources({\"tests/main.cpp\"})\n"