Commit graph

5 commits

Author SHA1 Message Date
trvon
b7336de261
Stage 6: node identity (fleet.hpp) — pure node_uid + wrapper 2026-11-07 18:59:51 -07:00
trvon
2e94ae1485
Privacy: tracker list feeds (advisory only, never block)
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
First piece of tracker attribution (docs/tracker-attribution.md): which
programs reach advertising and tracking domains, built with the
measurement rules of the CarolinaCon 2026 privacy talk (bridgescope):
a listed domain is a circumstantial label, never proof.

- Feed kind "trackers": hosts lines, plain domains and adblock
  whole-domain rules (||host^, ||host^$third-party). Cosmetic rules,
  exceptions, paths and other options are skipped; the comment cut used
  to turn "site.example##.ad" into a domain.
- TrackerSet: suffix matching (a.b.t.example matches t.example, never
  nott.example, an IP literal or a bare TLD); first feed reported.
- List parsing moves from rule_updater.cpp to ioc_list.cpp (no network
  code) so the query-side core can use it.
- Source invariant R11: tracker lists never meet exec-guard or OpenSnitch
  code. They are not in the OpenSnitch blocklist sync.

Tests: T1-T3 (test_tracker_set), trackers in the list-parsing property
and the list fuzzer (60 s clean), R11 self-test fixture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-28 05:25:53 -06:00
trvon
bbfda149a5
Stage 4: execute a promoted model's inspections, under guardrails
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
A promoted model (promoted.sbm, written only by `model promote` after the
gate) can now request real inspections. Only two, both additive:

- memory_scan: through the daemon's memory-scan queue;
- deep_rescan: the root's image re-scanned on demand; new matches are
  recorded as indicators of kind model_inspection (findings titled "YARA
  match found by a deeper rescan the inspection model requested") and
  positive labels.

watch_subtree has no mechanism and rescan_on_next_rules is the retro-hunt's
job, so both are masked out of acting decisions (kExecutableActions), and
replay's policy evaluation uses the same action set.

Guardrails:
- InspectionExecutor (bounded queue, one low-priority worker, submit()
  never blocks); WorkClass::model_inspect lets the governor defer it, and
  a deferred decision is dropped.
- Each action rechecks that the promoted model is still active at the
  decision's generation (demoting or replacing it revokes queued work),
  that the root's node id and raw image path still match (decisions carry
  root_image, not the feature template), and skips protected processes.
  A deep rescan discards its result if the process, image or rules changed
  during the scan.
- An acting decision is durably written before it is dispatched; every
  attempt becomes an inspection_outcome record (queued, scanned, skipped,
  deferred, revoked, queue_full, failed).
- Source invariant R10: no file may couple learning types to the
  exec-guard, OpenSnitch or policy APIs (daemon_app.cpp and main.cpp, the
  wiring points, are reviewed by hand). Models never block, contain, kill
  or create findings directly.
- Config model_act and model_lambda; status model block reports acting
  stats; timings.model_inspection.

docs/evaluation/stage4-execution-gate.md amends the gate's method (not its
thresholds): executable action set, greedy promoted decisions, budgets as
estimated inspection seconds by scan profile.

Also: TerminalSafeBuf's destructor no longer lets an exception escape;
the health message clamps huge durations; replay timestamp overflow; the
Docker test build runs with -j2.

Tests: test_inspection_executor (every skip and execute path, revocation,
queue limits); shadow and replay acting cases; R10 fixture; fault injection
and invariant updates. Validation reported by the session that wrote it:
48/48 local, 46/46 Docker plus privileged live checks, 20 fuzz targets
(9.5M runs), three paired KPI runs without regressions (no acting model
was loaded, so active-inspection cost is not measured yet).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 21:03:57 -06:00
trvon
713122f845
Read process facts on macOS without procfs
include/strawberry/platform_process.hpp answers what /proc answers on
Linux: running PIDs (proc_listallpids), executable path
(proc_pidpath), parent and start time (sysctl KERN_PROC_PID, readable
for every process), argv (KERN_PROCARGS2) and a boot id
(kern.bootsessionuuid). A process is identified by its start time in
microseconds since the epoch plus the boot id, so node ids survive PID
reuse as on Linux. It is header-only, so the per-test source lists stay
as they are.

Users on macOS: resolve_process_ref (default root), the pipeline's
image hashing and exec-decision actor, and YaraScanner::scan_process
(scans the image by path). A synthetic procfs root still takes the
procfs code, so the existing procfs tests run on macOS too.

The resource governor samples Mach/sysctl on macOS: own CPU from
getrusage, RSS from task_info, load from getloadavg, available memory
from host_statistics64 (free + inactive + purgeable + speculative).

The behavior engine knows macOS debuggers (debugserver, dtrace) and
kext loaders (kernelmanagerd, kmutil), and macOS temp and Downloads
paths count as drop locations. The Linux lists are unchanged.

The KERN_PROCARGS2 parser is portable: a property test (exact argv
recovery, truncation never invents data, total on junk) and the
fuzz_procargs target run on every platform. test_platform_process
checks the live helpers against this process; the daemon test reads
the stopped state through sysctl on macOS.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 09:55:09 -06:00
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