Release 1.1.0 with transactional plugin validation

This commit is contained in:
faumaray committed 2026-08-01 17:59:57 +03:00
1 parent 4418374de7
commit cb58236538
6 files changed
+115 -4

No files matched your search

+28
View File
@@ -101,6 +101,16 @@ namespace
Void::Encoding::Base64::encode_url(sign(message)));
}
std::string signedReadableEnvelope(std::string_view message)
{
return std::format(
"{{\n \"schemaVersion\": 3,\n \"keyId\": \"test-key\",\n"
" \"document\": {},\n \"signedPayload\": \"{}\",\n"
" \"signature\": \"{}\"\n}}",
message, Void::Encoding::Base64::encode_url(message),
Void::Encoding::Base64::encode_url(sign(message)));
}
constexpr std::string_view componentCatalogPayload = R"json({
"schemaVersion": 2,
"document": "echoion-component-catalog",
@@ -270,6 +280,24 @@ Void::Testing::Test component_feed_verifies_and_resolves_complete_set()
!Void::Update::validateComponentSet(*catalog, releases).has_value());
}
Void::Testing::Test readable_component_envelope_matches_signed_payload()
{
auto envelope = Void::Update::verifyEnvelope(
signedReadableEnvelope(componentCatalogPayload), keyring());
Void::Testing::require(envelope.has_value());
Void::Testing::expect_eq(envelope->schemaVersion, std::uint32_t{3});
Void::Testing::expect_eq(envelope->signedPayload,
std::string{componentCatalogPayload});
auto tampered = signedReadableEnvelope(componentCatalogPayload);
const auto position = tampered.find("\"sequence\": 11");
Void::Testing::require(position != std::string::npos);
tampered.replace(position, std::string{"\"sequence\": 11"}.size(),
"\"sequence\": 12");
Void::Testing::expect(
!Void::Update::verifyEnvelope(tampered, keyring()).has_value());
}
Void::Testing::Test update_feed_rejects_empty_fractional_timestamp()
{
std::string malformed{payload};