strawberry/fuzz/fuzz_mcp_handle.cpp
trvon 6628ea9aea
Harden against crashes and I/O faults
Fix for the 2026-10-25 host freeze (an uncaught iostream exception on a
/proc read aborted the daemon; its core dump deadlocked with the exec
guard): non-throwing /proc reads, crash handlers that release fanotify
permission fds, guarded thread entries, from_chars parsing.

Adds the io fault-injection seam with property tests, source invariant
checks (R1-R6) with self-test fixtures, libFuzzer targets and seeds
(including I/O-fault fuzzing), the fold changed-files scan scripts and
the agent workflow docs (CLAUDE.md, prompts).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-25 18:17:17 -06:00

19 lines
691 B
C++

// MCP JSON-RPC messages from an agent (read-only mode: no file or daemon access).
#include "../mcp/mcp_server.hpp"
#include <cstdint>
#include <string>
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
static strawberry::mcp::McpServer server({
.socket_path = "/nonexistent/strawberry-fuzz.sock",
.db_path_override = "/nonexistent/strawberry-fuzz.db",
.read_only = true,
});
const auto message = nlohmann::json::parse(data, data + size, nullptr, false);
if (message.is_discarded()) return 0;
if (const auto reply = server.handle(message)) {
(void) strawberry::mcp::McpServer::dump(*reply);
}
return 0;
}