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 / macos (push) Has been cancelled
Build and Test / docker (push) Has been cancelled
Second piece of tracker attribution (docs/tracker-attribution.md): which programs reach domains on a trackers list. Advisory only: never a block, never a finding (source invariant R11). - OpenSnitch event listener: OpenSnitch's JSON "remote" logger is the hostname source (Strawberry's eBPF connects have none). It streams over TCP and cannot leave fields out, so events carry command lines and environments. The listener binds 127.0.0.1 at a port below 1024 (only root can), accepts only root-owned peers (/proc/net/tcp), bounds clients/object size/buffering, and reads only pid, uid, path, destination and action; arguments and environment are never copied. - TrackerContacts: per program x domain, bounded at 20000 keys. A root-only tracker_contact telemetry record (type 25) on the first contact, then at most hourly with the count since. - Status `privacy` block; control verb privacy-trackers; CLI `strawberry privacy trackers [--json]`. - `strawberry opensnitch enable-events` adds the logger to OpenSnitch's config (with a .bak); the installer runs it when OpenSnitch is present, unless privacy_trackers=false. Config: privacy_trackers (default true), opensnitch_events (default 127.0.0.1:979). - EasyPrivacy is a default trackers feed (GPL-3.0+ or CC-BY-SA-3.0, downloaded at run time). Tests: E1-E7 (test_opensnitch_events: event fields, stream splitting, peer uid, address rules, listener end to end, contacts and record, config editor), the control verb, CLI translation and help, daemon status. New fuzz_opensnitch_events (90 s clean). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
38 lines
1.5 KiB
C++
38 lines
1.5 KiB
C++
// OpenSnitch event stream (from a local socket) and tracker_contact records:
|
|
// never crash; split objects are within bounds; whatever decodes re-encodes.
|
|
|
|
#include "strawberry/opensnitch_events.hpp"
|
|
#include "strawberry/tracker_set.hpp"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
|
|
using namespace strawberry;
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
const std::string input(reinterpret_cast<const char*>(data), size);
|
|
// Feed in two chunks, as a socket would.
|
|
std::string buffer = input.substr(0, size / 2);
|
|
bool overflow = false;
|
|
for (int round = 0; round < 2; ++round) {
|
|
for (const auto& object : take_json_objects(buffer, 4096, overflow)) {
|
|
if (object.size() > 4096 || object.front() != '{' || object.back() != '}') __builtin_trap();
|
|
if (const auto c = parse_opensnitch_event(object)) {
|
|
if (c->dst_port < 0 || c->dst_port > 65535) __builtin_trap();
|
|
}
|
|
}
|
|
if (overflow) break;
|
|
buffer += input.substr(size / 2);
|
|
}
|
|
TrackerContact contact;
|
|
std::string source;
|
|
if (decode_tracker_contact(input, contact, source)) {
|
|
TrackerContact again;
|
|
std::string source_again;
|
|
if (!decode_tracker_contact(encode_tracker_contact(contact, contact.count, source), again, source_again) ||
|
|
again.domain != contact.domain || again.program != contact.program || again.count != contact.count) {
|
|
__builtin_trap();
|
|
}
|
|
}
|
|
return 0;
|
|
}
|