feat(provenance): emit deterministic SPDX and CycloneDX SBOMs
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 4s
VoidBuildSystem CI / build-and-test-gcc16 (push) Failing after 4s
- New Provenance::Sbom module generating SPDX 2.3 / CycloneDX 1.5 from lockfile packages + BuildGraph outputs - Wire vbs build|test --sbom FILE --sbom-format spdx|cyclonedx - Register the module in CMake, build.cpp and the self-host recipe - Ed25519 signing requested upstream as Void/Library#36 (VL-014) - Verified in Docker GCC 16: 8/8 CTest suites; deterministic JSON unit test + CLI SBOM assertion
This commit is contained in:
1 parent
2970fbe25c
commit
55ea305528
13 files changed
+403
-8
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/Functional/Error.hpp>
|
||||
#include <Void/Functional/Result.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
namespace Void::Build::Provenance {
|
||||
|
||||
enum class SbomFormat { Spdx, CycloneDX };
|
||||
|
||||
[[nodiscard]] std::string_view sbom_format_name(SbomFormat format) noexcept;
|
||||
[[nodiscard]] SbomFormat parse_sbom_format(std::string_view name);
|
||||
|
||||
struct SbomPackage {
|
||||
std::string name;
|
||||
std::string version;
|
||||
std::string supplier; // "NOASSERTION" when unknown.
|
||||
std::string download_location; // "NOASSERTION" when unknown.
|
||||
std::string sha256;
|
||||
std::string purl;
|
||||
};
|
||||
|
||||
struct SbomFile {
|
||||
std::string path;
|
||||
std::string sha256;
|
||||
};
|
||||
|
||||
struct SbomInput {
|
||||
std::string project_name;
|
||||
std::string project_version{"0.0.0"};
|
||||
std::string tool_version;
|
||||
std::int64_t created_epoch{0};
|
||||
// Lockfile-derived dependency packages and BuildGraph-derived output files.
|
||||
std::vector<SbomPackage> packages;
|
||||
std::vector<SbomFile> files;
|
||||
};
|
||||
|
||||
// Deterministic SPDX 2.3 or CycloneDX 1.5 JSON. The document namespace/serial is derived from
|
||||
// the input content, and the timestamp from created_epoch, so identical inputs are byte-equal.
|
||||
[[nodiscard]] Void::Result::Result<std::string, Void::Result::Error>
|
||||
generate_sbom(const SbomInput &input, SbomFormat format);
|
||||
|
||||
} // namespace Void::Build::Provenance
|
||||
Reference in new issue
Block a user