Add M10.9c-1 session fuzzing and in-process abuse tests
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
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>
This commit is contained in:
@@ -90,7 +90,7 @@ void lifecycle() {
|
||||
CHECK(refused(Application::open({0, 64, false, "software"}), Error::invalid_config));
|
||||
CHECK(refused(Application::open({64, 64, false, "evo-invalid"}), Error::renderer));
|
||||
CHECK(SDL_WasInit(0) == 0); // Failed partial initialization released SDL.
|
||||
const char* video_driver = std::getenv("SDL_VIDEO_DRIVER");
|
||||
const char* video_driver = SDL_getenv("SDL_VIDEO_DRIVER"); // Portable; MSVC deprecates getenv.
|
||||
const int rounds = video_driver != nullptr && std::string_view{video_driver} == "x11" ? 1 : 32;
|
||||
for (int round = 0; round < rounds; ++round) {
|
||||
auto result = Application::open({160, 120, false, "software"});
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// M10.9c (ADR-0097) session protocol v4 fuzz target. Any input:
|
||||
// - decoding never crashes, and an accepted message has a stable canonical form
|
||||
// (decode, encode, decode, encode gives the same bytes: no field is silently dropped);
|
||||
// - an accepted snapshot chunk reaches the client's assembler without crashing;
|
||||
// - grant and ticket verification refuse it (no claim byte is trusted before the
|
||||
// signature: a fuzzer cannot forge ECDSA), also for the grant slot of a decoded Hello.
|
||||
// Built as a libFuzzer target with EVO_BUILD_FUZZER (Linux Clang) and as a seeded smoke
|
||||
// test everywhere (tests/fuzz/session_fuzz_smoke.cpp).
|
||||
#include "evo/network/handoff_ticket.hpp"
|
||||
#include "evo/network/replication.hpp"
|
||||
#include "evo/network/session_grant.hpp"
|
||||
#include "evo/network/session_protocol.hpp"
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
namespace {
|
||||
using namespace evo::network;
|
||||
constexpr evo::world::WorldIdentity world{9, 2};
|
||||
constexpr std::uint64_t region = 21;
|
||||
constexpr std::uint64_t now = 1'000'000;
|
||||
|
||||
// Verifiers holding one fixed, valid key each (the fuzzer never has its private half).
|
||||
struct Verifiers {
|
||||
std::optional<GrantVerifier> grants;
|
||||
std::optional<HandoffVerifier> tickets;
|
||||
Verifiers() {
|
||||
std::array<std::uint8_t, grant_private_key_bytes> scalar{};
|
||||
scalar.back() = 0x2A;
|
||||
const auto issuer = GrantSigningKey::import(DeploymentEnvironment::dev, 1, scalar);
|
||||
auto g = GrantVerifier::create(DeploymentEnvironment::dev);
|
||||
if (!issuer || !g || !g->add_key(1, *issuer->public_key()))
|
||||
std::abort();
|
||||
grants.emplace(std::move(*g));
|
||||
const auto source = HandoffSigningKey::import(DeploymentEnvironment::dev, 4, scalar);
|
||||
auto t = HandoffVerifier::create(DeploymentEnvironment::dev, world, region);
|
||||
if (!source || !t || !t->add_key(4, 4, *source->public_key()))
|
||||
std::abort();
|
||||
tickets.emplace(std::move(*t));
|
||||
}
|
||||
};
|
||||
const Verifiers& verifiers() {
|
||||
static const Verifiers v;
|
||||
return v;
|
||||
}
|
||||
void refused(std::span<const std::uint8_t> bytes) {
|
||||
const auto& v = verifiers();
|
||||
if (!v.grants || !v.tickets || v.grants->verify(bytes) || v.tickets->verify(bytes, now))
|
||||
std::abort();
|
||||
(void)looks_like_handoff_ticket(bytes);
|
||||
}
|
||||
} // namespace
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, std::size_t size) {
|
||||
const std::span<const std::uint8_t> bytes{data, size};
|
||||
refused(bytes);
|
||||
const auto decoded = decode_session(bytes);
|
||||
if (!decoded)
|
||||
return 0;
|
||||
const auto canonical = encode_session(*decoded);
|
||||
const auto again = decode_session(canonical);
|
||||
if (!again || encode_session(*again) != canonical)
|
||||
std::abort();
|
||||
if (const auto* hello = std::get_if<SessionHello>(&*decoded))
|
||||
refused(hello->grant);
|
||||
if (const auto* chunk = std::get_if<SnapshotChunk>(&*decoded)) {
|
||||
SnapshotAssembler client{world, chunk->epoch};
|
||||
if (const auto accepted = client.accept(*chunk);
|
||||
accepted && *accepted && client.latest() == nullptr)
|
||||
std::abort(); // A completed snapshot must be applied.
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
// 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;
|
||||
}
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "evo/server/region_sessions.hpp"
|
||||
#include "fixtures/fake_handoff_world.hpp"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cstdio>
|
||||
#include <expected>
|
||||
@@ -944,6 +945,262 @@ void durable_control(const Files& f) {
|
||||
return std::ranges::find(ledger.released, alice_generation) != ledger.released.end();
|
||||
}));
|
||||
}
|
||||
|
||||
// M10.9c (ADR-0097): abuse against one region while an honest session is measured. Each
|
||||
// round is one 50 ms tick: the abuse acts, the honest client sends one intention, and the
|
||||
// server replicates. The honest session must keep at least 90 % of its snapshots and
|
||||
// receipts, and the server's connections and retained state must stay bounded.
|
||||
struct Service {
|
||||
std::uint64_t ticks{}, views{}, sent{}, receipts{};
|
||||
};
|
||||
Service serve(Harness& h, RegionSessionClient& honest, std::size_t rounds,
|
||||
const std::function<void(std::size_t)>& abuse) {
|
||||
Service out;
|
||||
std::uint64_t last_view = honest.view() ? honest.view()->tick : 0;
|
||||
for (std::size_t round = 0; round < rounds; ++round) {
|
||||
++h.tick;
|
||||
++out.ticks;
|
||||
abuse(round);
|
||||
if (honest.send_intention(h.tick + 2, 100, 0))
|
||||
++out.sent;
|
||||
const auto end = Clock::now() + std::chrono::milliseconds{50};
|
||||
while (Clock::now() < end) {
|
||||
h.pump();
|
||||
for (const auto& r : honest.take_intention_receipts())
|
||||
out.receipts += r.status == AdmitStatus::admitted;
|
||||
if (const auto* v = honest.view(); v && v->tick != last_view) {
|
||||
last_view = v->tick;
|
||||
++out.views;
|
||||
}
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds{1});
|
||||
}
|
||||
}
|
||||
std::printf(
|
||||
"abuse service ticks=%llu views=%llu sent=%llu admitted=%llu\n",
|
||||
static_cast<unsigned long long>(out.ticks), static_cast<unsigned long long>(out.views),
|
||||
static_cast<unsigned long long>(out.sent), static_cast<unsigned long long>(out.receipts));
|
||||
return out;
|
||||
}
|
||||
bool served(const Service& s) {
|
||||
return s.views * 10 >= s.ticks * 9 && s.sent * 10 >= s.ticks * 9 &&
|
||||
s.receipts * 10 >= s.sent * 9;
|
||||
}
|
||||
std::unique_ptr<RegionSessionClient> honest_session(Harness& h) {
|
||||
h.source = [&h](const SessionInterest&) {
|
||||
ReplicationSource s;
|
||||
s.identity = world_id;
|
||||
s.field_revision = h.tick;
|
||||
s.mask = (1U << 0) | (1U << 1) | (1U << 7);
|
||||
for (std::int64_t x = -3; x <= 3; ++x)
|
||||
for (std::int64_t y = -3; y <= 3; ++y)
|
||||
s.environment.push_back(grid_cell(x, y, 30 + (h.tick % 7)));
|
||||
return s;
|
||||
};
|
||||
h.server->set_default_interest({0, 0, -7, 7});
|
||||
auto c = h.connect(h.issuer.grant(account(0xA0), 1));
|
||||
CHECK(h.settled(*c) && c->state() == RegionSessionState::established);
|
||||
// Wait for the datagram channel and the first snapshot.
|
||||
CHECK(h.until([&] {
|
||||
++h.tick;
|
||||
return c->view() != nullptr && c->send_intention(h.tick + 2, 0, 0).has_value();
|
||||
}));
|
||||
return c;
|
||||
}
|
||||
|
||||
// Handshake and Hello floods: many connections that send garbage, forged or no Hello. They
|
||||
// are closed (protocol, unauthenticated, timeout) or refused at the connection limit; the
|
||||
// region's connections never exceed the transport bound; the honest session is served.
|
||||
void hello_flood(const Files& f) {
|
||||
Harness h{f, 4, 64};
|
||||
auto honest = honest_session(h);
|
||||
// A key the region does not trust (key id 7): its well-formed grants are refused.
|
||||
const auto stranger = *GrantSigningKey::import(DeploymentEnvironment::dev, 7, [] {
|
||||
std::array<std::uint8_t, grant_private_key_bytes> s{};
|
||||
s.back() = 0x2B;
|
||||
return s;
|
||||
}());
|
||||
// Every peer is polled each round and acts once connected: 0 sends garbage, 1 a
|
||||
// well-formed Hello whose grant no trusted key signed, 2 stays silent until the deadline.
|
||||
struct Peer {
|
||||
std::unique_ptr<quic::Endpoint> endpoint;
|
||||
std::size_t kind{};
|
||||
};
|
||||
std::vector<Peer> peers;
|
||||
std::size_t most_connections = 0;
|
||||
std::array<unsigned, 3> acted{};
|
||||
unsigned sent = 0;
|
||||
const auto service = serve(h, *honest, 60, [&](std::size_t round) {
|
||||
if (round < 40)
|
||||
for (std::size_t k = 0; k < 4; ++k)
|
||||
peers.push_back({h.raw(), (round * 4 + k) % 3});
|
||||
for (auto& peer : peers)
|
||||
for (auto& e : peer.endpoint->poll()) {
|
||||
if (e.kind != quic::EventKind::connected)
|
||||
continue;
|
||||
++acted.at(peer.kind);
|
||||
if (peer.kind == 0)
|
||||
sent += peer.endpoint
|
||||
->send_message(e.connection, std::vector<std::uint8_t>{9, 9, 9, 9})
|
||||
.has_value();
|
||||
if (peer.kind == 1) {
|
||||
GrantClaims c;
|
||||
c.grant_id = 9000 + round;
|
||||
c.account = account(0xF0);
|
||||
c.serial = 1;
|
||||
c.world = world_id;
|
||||
c.region = region;
|
||||
c.issued_at = start;
|
||||
c.expires_at = start + 60;
|
||||
sent += peer.endpoint
|
||||
->send_message(e.connection,
|
||||
encode_session(SessionHello{0, *stranger.sign(c)}))
|
||||
.has_value();
|
||||
}
|
||||
}
|
||||
most_connections = std::max(most_connections, h.server->connections());
|
||||
});
|
||||
std::printf("abuse hello_flood peers=%zu most_connections=%zu connected garbage=%u "
|
||||
"forged=%u silent=%u\n",
|
||||
peers.size(), most_connections, acted[0], acted[1], acted[2]);
|
||||
CHECK(sent == acted[0] + acted[1]); // Every garbage and forged message went out.
|
||||
CHECK(served(service) && honest->state() == RegionSessionState::established);
|
||||
CHECK(most_connections <= server::RegionSessionsConfig{}.transport.limits.max_connections);
|
||||
peers.clear();
|
||||
CHECK(h.until([&] { return h.server->connections() == 1; }));
|
||||
std::map<unsigned, unsigned> reasons;
|
||||
for (const auto& e : h.events)
|
||||
if (e.kind == RegionSessionEvent::Kind::refused)
|
||||
++reasons[static_cast<unsigned>(e.reason)];
|
||||
for (const auto& [why, n] : reasons)
|
||||
std::printf("abuse hello_flood refused reason=%u count=%u\n", why, n);
|
||||
CHECK(h.has_event(RegionSessionEvent::Kind::refused, Reason::protocol) &&
|
||||
h.has_event(RegionSessionEvent::Kind::refused, Reason::unauthenticated) &&
|
||||
h.has_event(RegionSessionEvent::Kind::refused, Reason::timeout));
|
||||
}
|
||||
|
||||
// Datagram flood from an authenticated peer: hundreds of intentions per tick for any tick
|
||||
// (throttled per session: one per tick), then garbage, which closes it (protocol). The
|
||||
// honest session keeps its receipts and snapshots.
|
||||
void datagram_flood(const Files& f) {
|
||||
Harness h{f, 4, 64};
|
||||
auto honest = honest_session(h);
|
||||
auto peer = h.raw();
|
||||
quic::ConnectionId id = 0;
|
||||
bool welcomed = false, closed = false;
|
||||
std::optional<Reason> reason;
|
||||
std::uint64_t flood = 0, refused = 0, garbage = 0;
|
||||
const auto drain = [&] {
|
||||
for (auto& e : peer->poll()) {
|
||||
if (e.kind == quic::EventKind::connected) {
|
||||
id = e.connection;
|
||||
CHECK(peer->send_message(
|
||||
id, encode_session(SessionHello{0, h.issuer.grant(account(0xB0), 1)}))
|
||||
.has_value());
|
||||
} else if (e.kind == quic::EventKind::message || e.kind == quic::EventKind::datagram) {
|
||||
const auto m = decode_session(e.bytes);
|
||||
if (m && std::holds_alternative<SessionWelcome>(*m))
|
||||
welcomed = true;
|
||||
if (m && std::holds_alternative<IntentionReceipt>(*m))
|
||||
refused += std::get<IntentionReceipt>(*m).status != AdmitStatus::admitted;
|
||||
if (m && std::holds_alternative<SessionClose>(*m))
|
||||
reason = std::get<SessionClose>(*m).reason;
|
||||
} else if (e.kind == quic::EventKind::closed) {
|
||||
closed = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
CHECK(h.until([&] {
|
||||
drain();
|
||||
return welcomed;
|
||||
}));
|
||||
std::uint64_t sequence = 0;
|
||||
const auto service = serve(h, *honest, 40, [&](std::size_t round) {
|
||||
drain();
|
||||
if (round < 30)
|
||||
for (int k = 0; k < 400; ++k) {
|
||||
SessionIntention in;
|
||||
in.sequence = ++sequence;
|
||||
in.tick = h.tick + 1 + static_cast<std::uint64_t>(k % 8);
|
||||
in.move_x = 100;
|
||||
flood += peer->send_datagram(id, encode_session(in)).has_value();
|
||||
}
|
||||
if (round == 30)
|
||||
for (int k = 0; k < 50; ++k)
|
||||
garbage += peer->send_datagram(id, std::vector<std::uint8_t>(64, 0xEE)).has_value();
|
||||
});
|
||||
CHECK(h.until([&] {
|
||||
drain();
|
||||
return closed || reason.has_value();
|
||||
}));
|
||||
std::printf("abuse datagram_flood sent=%llu refused_receipts=%llu close=%u\n",
|
||||
static_cast<unsigned long long>(flood), static_cast<unsigned long long>(refused),
|
||||
static_cast<unsigned>(reason.value_or(Reason::connection_lost)));
|
||||
CHECK(served(service) && honest->state() == RegionSessionState::established);
|
||||
CHECK(flood > 1000 && garbage > 0 && reason == Reason::protocol);
|
||||
}
|
||||
|
||||
// A slow peer: established, then never polled (it reads nothing and acknowledges no
|
||||
// snapshot). The server keeps at most its baselines for it and stays bounded; the honest
|
||||
// session is served throughout.
|
||||
void slow_peer(const Files& f) {
|
||||
Harness h{f, 4, 64};
|
||||
auto honest = honest_session(h);
|
||||
auto slow = h.connect(h.issuer.grant(account(0xC0), 1));
|
||||
CHECK(h.settled(*slow) && slow->state() == RegionSessionState::established);
|
||||
CHECK(slow->set_interest({0, 0, -7, 7}));
|
||||
h.forget(slow.get()); // From now on nobody polls it.
|
||||
std::size_t most_retained = 0;
|
||||
const auto service = serve(h, *honest, 80, [&](std::size_t) {
|
||||
most_retained = std::max(most_retained, h.server->replication_stats().retained_entities);
|
||||
});
|
||||
std::printf("abuse slow_peer most_retained_entities=%zu sessions=%zu\n", most_retained,
|
||||
h.server->sessions());
|
||||
CHECK(served(service) && honest->state() == RegionSessionState::established);
|
||||
// Two sessions, 49 cells each, at most 4 baselines (ADR-0089) plus the working state.
|
||||
CHECK(most_retained <= std::size_t{2} * 49 * 5);
|
||||
slow.reset();
|
||||
CHECK(h.until([&] { return h.server->sessions() == 1; }, std::chrono::milliseconds{15000}));
|
||||
}
|
||||
|
||||
// Connect/disconnect storm: 120 logins across 12 accounts, each closed politely or dropped
|
||||
// mid-session; the region returns to the honest session alone, which is served throughout.
|
||||
void storm(const Files& f) {
|
||||
Harness h{f, 8, 1024};
|
||||
auto honest = honest_session(h);
|
||||
std::vector<std::unique_ptr<RegionSessionClient>> live;
|
||||
std::array<std::uint64_t, 12> serials{};
|
||||
std::uint64_t opened = 0;
|
||||
const auto service = serve(h, *honest, 60, [&](std::size_t round) {
|
||||
if (round >= 40)
|
||||
return;
|
||||
for (int k = 0; k < 3; ++k) {
|
||||
const auto who = (round * 3 + static_cast<std::size_t>(k)) % serials.size();
|
||||
auto c = h.connect(
|
||||
h.issuer.grant(account(static_cast<std::uint8_t>(0xD0 + who)), ++serials.at(who)));
|
||||
live.push_back(std::move(c));
|
||||
}
|
||||
// Older ones leave: politely, or by vanishing (the transport notices).
|
||||
while (live.size() > 6) {
|
||||
auto& c = live.front();
|
||||
opened += c->state() == RegionSessionState::established;
|
||||
if (opened % 2 == 0)
|
||||
c->close();
|
||||
h.forget(c.get());
|
||||
live.erase(live.begin());
|
||||
}
|
||||
});
|
||||
for (auto& c : live) {
|
||||
h.forget(c.get());
|
||||
c->close();
|
||||
}
|
||||
live.clear();
|
||||
std::printf("abuse storm logins=120 established_seen=%llu\n",
|
||||
static_cast<unsigned long long>(opened));
|
||||
CHECK(served(service) && honest->state() == RegionSessionState::established);
|
||||
CHECK(opened > 20);
|
||||
CHECK(h.until([&] { return h.server->sessions() == 1 && h.server->connections() == 1; },
|
||||
std::chrono::milliseconds{15000}));
|
||||
}
|
||||
} // namespace
|
||||
|
||||
int main() try {
|
||||
@@ -955,6 +1212,10 @@ int main() try {
|
||||
snapshots_over_quic(files);
|
||||
ticket_login(files);
|
||||
two_region_handoff(files);
|
||||
hello_flood(files);
|
||||
datagram_flood(files);
|
||||
slow_peer(files);
|
||||
storm(files);
|
||||
std::filesystem::remove_all(files.dir);
|
||||
std::puts("quic session tests passed");
|
||||
return 0;
|
||||
|
||||
@@ -422,6 +422,27 @@ void end_to_end() {
|
||||
}
|
||||
CHECK(marks.size() >= 2 && marks.back()[3] >= 1 && marks.back()[1] > marks.front()[1] &&
|
||||
marks.back()[2] == marks.front()[2]);
|
||||
// M10.9 (ADR-0097): a login from an existing bundle (as a dev renewal writes one), with
|
||||
// no issuer key: grant 1 of a two-grant bundle for Dana.
|
||||
const auto dana = account(0x53);
|
||||
const auto bundle = s.region.root / "dana-grants.bin";
|
||||
Child g{{probe.string(), "grants", "--issuer-key", (s.region.root / "issuer.key").string(),
|
||||
"--world", "7", "--frame", std::to_string(region_identity.frame), "--region", "151",
|
||||
"--account", hex(dana), "--count", "2", "--lifetime", "900", "--out",
|
||||
bundle.string()}};
|
||||
CHECK(g.wait_exit(30s) == 0);
|
||||
Child q{{probe.string(), "run", "--connect", "127.0.0.1:" + std::to_string(server->port),
|
||||
"--server-name", name, "--ca", (s.region.root / "ca.pem").string(), "--grants",
|
||||
bundle.string(), "--grant", "1", "--intents", "2", "--snapshots", "2"}};
|
||||
code = -1;
|
||||
for (const auto end = Clock::now() + 30s; Clock::now() < end && code < 0;) {
|
||||
server->pump();
|
||||
q.pump(5ms);
|
||||
if (q.printed("done") || q.printed("timeout") || q.printed("closed"))
|
||||
code = q.wait_exit(10s);
|
||||
}
|
||||
CHECK(code == 0 && q.printed("grant 1 of 2") && q.printed("welcome ") &&
|
||||
q.printed("intention 1 0"));
|
||||
server->child->signal(SIGTERM);
|
||||
CHECK(server->child->wait_exit(30s) == 0);
|
||||
CHECK(server->child->printed("m10 opened ") && server->child->printed("m10 committed ") &&
|
||||
|
||||
Reference in New Issue
Block a user