Some checks failed
Build and Test / build (debug, clang) (push) Has been cancelled
Build and Test / build (debug, gcc) (push) Has been cancelled
Build and Test / build (release, clang) (push) Has been cancelled
Build and Test / build (release, gcc) (push) Has been cancelled
Build and Test / docker (push) Has been cancelled
- doctor (control verb, read-only): store health and disk floor, telemetry growth per day and days until the floor when retention is unlimited, leftover store files, superseded findings, retro-hunt state, thread/write errors, logs (journald rotates them), model (none yet). Each check carries a maintenance action or advice. Pure checks over gathered inputs (src/doctor.cpp), so they test without a daemon. - maintain (control payload verb, privileged, rate limited, audited): retire-superseded-findings and clean-store, each with dry_run. - finding_retired evidence record: removes a finding from view; it stays in the stream's history. CorrelationEngine::superseded_findings finds old hash/rule findings by recomputing the stable id, and old lineage findings only when the current one's parent process is among their nodes (a reused pid on another boot is not a match). Lineage findings now record parent_process_node_id. - store::inspect_store_files / clean_store_leftovers: orphan/ files older than N days and *.compact / MANIFEST.tmp temp files; never a listed segment. Tests: test_doctor (check statuses, superseded detection including pid reuse and no-replacement cases, retirement surviving a reopen, cleanup keeping recent orphans and listed segments); daemon test exercises both verbs over the socket. fuzz_evidence_records covers finding_retired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
65 lines
2.6 KiB
C++
65 lines
2.6 KiB
C++
// Evidence-stream records (indicator, node, edge, finding, image seen,
|
|
// retro-hunt run) over untrusted
|
|
// bytes, then replayed into the in-memory view. Decoders must never crash;
|
|
// whatever they accept must round-trip; the view must stay queryable.
|
|
|
|
#include "../src/store/evidence_records.hpp"
|
|
#include "../src/store/evidence_view.hpp"
|
|
#include "strawberry/store/codec.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
using namespace strawberry;
|
|
using namespace strawberry::store;
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
const std::string_view in(reinterpret_cast<const char*>(data), size);
|
|
{
|
|
IndicatorEntry a, b;
|
|
if (decode_indicator(in, a) && (!decode_indicator(encode_indicator(a), b) || !same_indicator(a, b))) __builtin_trap();
|
|
GraphNode n, m;
|
|
if (decode_node(in, n) && (!decode_node(encode_node(n), m) || !same_node(n, m))) __builtin_trap();
|
|
GraphEdge e, f;
|
|
if (decode_edge(in, e) && (!decode_edge(encode_edge(e), f) || EvidenceView::edge_key(e) != EvidenceView::edge_key(f)))
|
|
__builtin_trap();
|
|
FindingRecord x, y;
|
|
if (decode_finding(in, x) && (!decode_finding(encode_finding(x), y) || !same_finding(x, y))) __builtin_trap();
|
|
SeenImage s, t;
|
|
if (decode_seen_image(in, s) && (!decode_seen_image(encode_seen_image(s), t) || !(s == t))) __builtin_trap();
|
|
FindingRetired fr, fr2;
|
|
if (decode_finding_retired(in, fr) && (!decode_finding_retired(encode_finding_retired(fr), fr2) ||
|
|
fr2.id != fr.id || fr2.replaced_by != fr.replaced_by)) {
|
|
__builtin_trap();
|
|
}
|
|
RetroHuntRun r, q;
|
|
if (decode_retro_hunt(in, r) && (!decode_retro_hunt(encode_retro_hunt(r), q) || !(r == q))) __builtin_trap();
|
|
}
|
|
// Interpret the input as a record stream and replay it, with a
|
|
// transaction around the second half that is rolled back.
|
|
EvidenceView view;
|
|
RecordReader records(in);
|
|
RecordView rec;
|
|
std::size_t n = 0;
|
|
bool txn = false;
|
|
while (records.next(rec)) {
|
|
if (n == 4 && !txn) {
|
|
view.begin();
|
|
txn = true;
|
|
}
|
|
(void) view.apply(rec.type, rec.payload);
|
|
++n;
|
|
}
|
|
const auto before_nodes = view.node_count();
|
|
if (txn) view.rollback();
|
|
if (txn && view.node_count() > before_nodes) __builtin_trap();
|
|
for (const auto& node : view.nodes("")) {
|
|
(void) view.edges_of(node.id);
|
|
(void) view.related(node.id, 3);
|
|
}
|
|
(void) view.findings();
|
|
(void) view.all_indicators();
|
|
(void) view.seen_images();
|
|
(void) view.last_retro_hunt();
|
|
return 0;
|
|
}
|