Run a non-blocking TLS 1.3 session server inside evo-server's loop: environment views come from the region's own field/terrain stores with an explicitly empty organism presentation; admitted intentions ride the next synthetic input (content unchanged) and return a durable no-effect outcome from the host's final acknowledgement, or not_committed when dropped. Sessions are bound to their connection, epochs close stale sessions, and connections have bounded output, input rate and deadlines. SessionClient and evo-client --connect consume one single-use grant per Hello (refusals before admission keep it), reset to a fresh baseline on every session, keep stale views visible and report in-flight intentions as unknown after loss. evo-dev-session generates dev credentials, grant bundles and runs a restart probe. The dev deployment gains a drill-time, loopback-only listener with an optional Secret, enforced by the policy check, and tools/ops/session-drill.sh. Protocol v1 gains IntentOutcome and the capacity close reason before any deployment. ADR-0083 records the maintainer-confirmed decisions; M8-dev/stage remains not passed and no cluster change was made. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.2 KiB
C++
66 lines
2.2 KiB
C++
#include "evo/network/protocol.hpp"
|
|
#include <algorithm>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <cstdlib>
|
|
#include <span>
|
|
#include <vector>
|
|
|
|
// Any input: decoding never crashes, and an accepted message re-encodes to the same
|
|
// bytes (no field is trusted or silently dropped). Also streams through FrameReader.
|
|
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, std::size_t size) {
|
|
using namespace evo::network;
|
|
const std::span<const std::uint8_t> bytes{data, size};
|
|
FrameReader reader;
|
|
for (std::size_t at = 0; at < size;) {
|
|
const auto taken = reader.feed(bytes.subspan(at, std::min<std::size_t>(7, size - at)));
|
|
if (!taken)
|
|
break;
|
|
at += *taken;
|
|
if (*taken == 0 && !reader.take())
|
|
std::abort();
|
|
(void)reader.take();
|
|
}
|
|
const auto frame = decode_frame(bytes);
|
|
if (!frame)
|
|
return 0;
|
|
std::vector<std::uint8_t> again;
|
|
switch (frame->type) {
|
|
case MessageType::hello:
|
|
if (const auto m = decode_hello(*frame))
|
|
again = *encode(*m);
|
|
break;
|
|
case MessageType::welcome:
|
|
if (const auto m = decode_welcome(*frame))
|
|
again = encode(*m);
|
|
break;
|
|
case MessageType::intent:
|
|
if (const auto m = decode_intent(*frame))
|
|
again = encode(*m);
|
|
break;
|
|
case MessageType::intent_result:
|
|
if (const auto m = decode_intent_result(*frame))
|
|
again = encode(*m);
|
|
break;
|
|
case MessageType::close:
|
|
if (const auto m = decode_close(*frame))
|
|
again = encode(*m);
|
|
break;
|
|
case MessageType::intent_outcome:
|
|
if (const auto m = decode_intent_outcome(*frame))
|
|
again = encode(*m);
|
|
break;
|
|
case MessageType::environment_view:
|
|
if (const auto m = decode_environment_view(*frame))
|
|
again = encode(m->first, m->second);
|
|
break;
|
|
case MessageType::organism_view:
|
|
if (const auto m = decode_organism_view(*frame))
|
|
again = encode(m->first, m->second);
|
|
break;
|
|
}
|
|
if (!again.empty() && !std::equal(again.begin(), again.end(), bytes.begin(), bytes.end()))
|
|
std::abort();
|
|
return 0;
|
|
}
|