strawberry/fuzz/meson.build
trvon 8f6bd1d4e0
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
Privacy: attribute tracker contacts to programs via OpenSnitch events
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>
2026-10-28 06:15:28 -06:00

53 lines
2.3 KiB
Meson

# libFuzzer targets for every boundary that parses untrusted or
# attacker-influenced input. Build with clang:
# CC=clang CXX=clang++ meson setup build/fuzz -Denable_fuzzing=true -Denable_app=disabled
# nice -n 19 ninja -C build/fuzz -j2
# scripts/run_fuzzers.sh 60 # each target for 60 s, capped
fuzz_args = ['-fsanitize=fuzzer']
fuzz_targets = {
'fuzz_ioc_list': ['fuzz_ioc_list.cpp', '../src/rule_updater.cpp', '../src/ioc_list.cpp', '../src/yara_scanner.cpp'],
'fuzz_policy_apply': ['fuzz_policy_apply.cpp'],
'fuzz_governor_parsers': ['fuzz_governor_parsers.cpp'],
'fuzz_status_snapshot': ['fuzz_status_snapshot.cpp'],
'fuzz_config': ['fuzz_config.cpp'],
'fuzz_record_decoder': ['fuzz_record_decoder.cpp'],
'fuzz_block_decoder': ['fuzz_block_decoder.cpp'],
'fuzz_segment_reader': ['fuzz_segment_reader.cpp'],
'fuzz_manifest': ['fuzz_manifest.cpp'],
'fuzz_evidence_records': ['fuzz_evidence_records.cpp'],
'fuzz_legacy_kv': ['fuzz_legacy_kv.cpp'],
'fuzz_telemetry_records': ['fuzz_telemetry_records.cpp'],
'fuzz_cmdline_redactor': ['fuzz_cmdline_redactor.cpp'],
'fuzz_tokenizer': ['fuzz_tokenizer.cpp'],
'fuzz_replay': ['fuzz_replay.cpp'],
'fuzz_trace_dsl': ['fuzz_trace_dsl.cpp'],
'fuzz_model_file': ['fuzz_model_file.cpp'],
'fuzz_rarity_state': ['fuzz_rarity_state.cpp'],
'fuzz_opensnitch_events': ['fuzz_opensnitch_events.cpp'],
'fuzz_procargs': ['fuzz_procargs.cpp'],
}
foreach name, sources : fuzz_targets
extra = name == 'fuzz_ioc_list' ? [updater_feature_dep, yara_dep, yara_feature_dep] : []
executable(name, sources,
include_directories: inc_dirs,
dependencies: [strawberry_core_dep] + extra,
link_args: fuzz_args,
)
endforeach
# I/O-failure fuzzing: its sources are compiled with the fault injector on, so
# it does not link strawberry_core (whose objects have no injector).
executable('fuzz_io_faults',
'fuzz_io_faults.cpp', '../src/hash_utils.cpp', '../src/resource_governor.cpp',
include_directories: inc_dirs,
cpp_args: ['-DSTRAWBERRY_FAULT_INJECTION=1'],
dependencies: [openssl_dep, threads_dep],
link_args: fuzz_args,
)
if get_option('enable_mcp').allowed()
executable('fuzz_mcp_handle', 'fuzz_mcp_handle.cpp',
include_directories: inc_dirs,
link_with: strawberry_mcp_lib,
dependencies: [nlohmann_json_dep, strawberry_core_dep],
link_args: fuzz_args,
)
endif