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
Replay (src/learn/replay.cpp, strawberry --replay [dir] [--top N] [--json]): reads the telemetry stream read-only, orders events by time (a 30 s reorder buffer absorbs the writer's batching), joins behavior events to the latest exec of their pid at that time (keeps PID reuse apart), builds 60 s windows (a root exec, its descendants and their behavior, at most 64 events), scores each exec, connection and persistence write with the rarity model before observing it, and marks windows whose processes had detections. Prints the most unusual windows with the tuples that made them unusual. Deterministic. tests/test_replay.cpp: chain windows, PID reuse, order insensitivity within the horizon, determinism, ranking, detection marking, a real store round trip. fuzz_replay feeds arbitrary record streams. UTF-8: file names are bytes, and the fuzzer showed nlohmann's dump() throwing on a path that is not UTF-8. The same applied to the daemon's control replies (kill/suspend/quarantine name the exe path) and to the OpenSnitch containment rule, so a binary with such a name could not be contained, and json_escape wrote the raw bytes into status JSON. Now: - every .dump() in src/ uses error_handler_t::replace (U+FFFD), enforced by source invariant R9; - json_escape writes invalid sequences as � (valid_utf8 and utf8_sequence_length in json_util.hpp); - containment refuses such a path with a clear error (a rule could never match the real bytes); quarantine still blocks execution by hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
4 lines
210 B
C++
4 lines
210 B
C++
// R9: dump() with the default error handler throws on invalid UTF-8.
|
|
#include <nlohmann/json.hpp>
|
|
#include <string>
|
|
std::string reply(const std::string& path) { return nlohmann::json{{"path", path}}.dump(); }
|