Foundation / checks (deploy) (push) Successful in 6s
Foundation / checks (checks) (push) Successful in 17s
Foundation / checks (ecs) (push) Successful in 12s
Foundation / checks (client) (push) Successful in 1m47s
Foundation / checks (tsan) (push) Successful in 5m44s
Foundation / checks (network) (push) Successful in 13m29s
Foundation / checks (postgres) (push) Successful in 44m22s
Foundation / server-image (push) Successful in 31s
Foundation / postgres-tools (push) Successful in 1m34s
Foundation / image (push) Successful in 2m37s
ADR-0097. A libFuzzer target for session protocol v4, grants, tickets and snapshot assembly (canonical re-encoding, verifiers always refuse, a completed snapshot is applied), with the code under test compiled in, and a seeded smoke CTest of the same target on every platform. Four quic-sessions abuse tests measure an honest session tick by tick under a Hello flood (garbage, untrusted grants, silence), a datagram flood, a slow peer and a connect/disconnect storm; it keeps every snapshot and receipt while connections and retained state stay bounded. evo-session-probe run --grants FILE [--grant N] logs in from an existing bundle (a dev renewal's) without an issuer key. client_lifecycle uses SDL_getenv (MSVC rejected std::getenv). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
69 lines
2.6 KiB
C++
69 lines
2.6 KiB
C++
// Seeded smoke run of the session fuzz target (tests/fuzz/session_fuzz.cpp) on every
|
|
// platform: random inputs, and mutations (bit flips, truncation, extension, byte
|
|
// overwrites) of a valid encoding of every v4 message type.
|
|
#include "evo/core/random.hpp"
|
|
#include "evo/network/session_protocol.hpp"
|
|
#include <algorithm>
|
|
#include <array>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <cstdio>
|
|
#include <utility>
|
|
#include <variant>
|
|
#include <vector>
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t*, std::size_t);
|
|
|
|
namespace {
|
|
using namespace evo::network;
|
|
template <std::size_t... I>
|
|
std::vector<std::vector<std::uint8_t>> seeds(std::index_sequence<I...>) {
|
|
return {encode_session(SessionMessage{std::in_place_index<I>})...};
|
|
}
|
|
} // namespace
|
|
|
|
int main() {
|
|
auto corpus = seeds(std::make_index_sequence<std::variant_size_v<SessionMessage>>{});
|
|
std::size_t decodable = 0;
|
|
for (const auto& s : corpus)
|
|
decodable += decode_session(s).has_value();
|
|
evo::Random random{20261007};
|
|
const auto next = [&](std::size_t below) {
|
|
return static_cast<std::size_t>(random.next() % std::max<std::size_t>(below, 1));
|
|
};
|
|
std::size_t inputs = 0;
|
|
for (int round = 0; round < 4000; ++round) {
|
|
for (const auto& seed : corpus) {
|
|
auto input = seed;
|
|
switch (next(5)) {
|
|
case 0: // Flip bits.
|
|
for (std::size_t k = 0, n = 1 + next(4); k < n && !input.empty(); ++k)
|
|
input[next(input.size())] ^= static_cast<std::uint8_t>(1U << next(8));
|
|
break;
|
|
case 1: // Truncate.
|
|
input.resize(next(input.size() + 1));
|
|
break;
|
|
case 2: // Extend.
|
|
for (std::size_t k = 0, n = 1 + next(32); k < n; ++k)
|
|
input.push_back(static_cast<std::uint8_t>(next(256)));
|
|
break;
|
|
case 3: // Overwrite a byte with an edge value.
|
|
if (!input.empty())
|
|
input[next(input.size())] =
|
|
std::array<std::uint8_t, 4>{0, 1, 0x7F, 0xFF}[next(4)];
|
|
break;
|
|
default: // Random bytes.
|
|
input.assign(next(300), 0);
|
|
for (auto& b : input)
|
|
b = static_cast<std::uint8_t>(next(256));
|
|
}
|
|
if (LLVMFuzzerTestOneInput(input.data(), input.size()) != 0)
|
|
return 1;
|
|
++inputs;
|
|
}
|
|
}
|
|
std::printf("session fuzz smoke inputs=%zu seeds=%zu decodable_seeds=%zu\n", inputs,
|
|
corpus.size(), decodable);
|
|
return 0;
|
|
}
|