Commit graph

152 commits

Author SHA1 Message Date
trvon
1733bc5656
Stage 3.5 bench: make write->exec linkage global (fixes self_written_execs)
All checks were successful
release / draft (push) Successful in 21s
release / build (debian:trixie, trixie) (push) Successful in 1h1m23s
release / build (ubuntu:24.04, noble) (push) Successful in 56m1s
release / publish (push) Successful in 14s
v0.2.1
The write->exec data-flow feature used a PER-WINDOW written_paths set, but a
dropper/download and the exec of the dropped file routinely land in different
replay windows (writer's window vs the exec's parent window, or a window that hit
max_window_events) -- so self_written_execs fired for only ~1/15 real download
chains. Mirror the live behavior engine's drop_writes_: record written paths in a
global bounded FIFO (recent_writes) and match on exec. Now a base64-decode evasion
that DownloadThenExecute misses (detections=0) is scored 0.594 by a data-flow
model vs 0.021 by a no-provenance model and ~0 by the detectors -- the data-flow
model generalizes to the detector-evading attack it never trained on. Benign ~0 for
both (no FP).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 18:26:51 -07:00
trvon
0b730eace2
Stage 3.5 bench: strawberry-model-score dev tool (per-window model scoring)
Some checks failed
release / draft (push) Has been skipped
release / build (debian:trixie, trixie) (push) Has been cancelled
release / build (ubuntu:24.04, noble) (push) Has been cancelled
release / publish (push) Has been cancelled
Build-only tool: loads a trained model (.sbm) and an export bundle, applies
forward(model, features) per window, prints TSV window_id/value/label/x[42] plus
a summary partitioned by the write->exec feature slot. Unblocks the novel-chain
benchmark: replay --model ranks by rarity (model_value null), so it could not
measure a model's score on holdout windows; this does. On the detector-covered
train bundle the data-flow model scores write->exec windows 0.634 vs 0.0003 for
the rest -- it clearly learned the x[42] feature.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 16:59:30 -07:00
trvon
fdd96ed64f
Release v0.2.0: bump version + fix license to GPL-3.0
All checks were successful
release / draft (push) Successful in 19s
release / build (debian:trixie, trixie) (push) Successful in 54m43s
release / build (ubuntu:24.04, noble) (push) Successful in 50m32s
release / publish (push) Successful in 13s
v0.2.0
Bump project + daemon version 0.1.0 -> 0.2.0. Correct meson `license` from the
stale `MIT` to `GPL-3.0-or-later` to match the GPLv3 LICENSE file and README.
First tagged release carrying Stage 6 fleet learning and Stage 3.5 provenance
work (3.5a fleet-train flags, 3.5b2 write->exec data-flow feature).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 16:40:04 -07:00
trvon
0282066340
Stage 3.5b2: replace exec-lineage with write->exec data-flow feature
Some checks failed
release / draft (push) Has been skipped
release / build (debian:trixie, trixie) (push) Has been cancelled
release / build (ubuntu:24.04, noble) (push) Has been cancelled
release / publish (push) Has been cancelled
3.5b's ordered exec-lineage proved inert in clean A/Bs; replace it with a general
write->exec data-flow feature: WindowSummary.self_written_execs (exec of a file
written earlier in the same window) at x[42], tracked via OpenWindow.written_paths.

Honest status: this is the conceptually-correct provenance feature (it separates
download->exec-the-same-file from download->exec-unrelated), but it ALSO shows no
AUC gain on detector-labeled data -- for the same structural reason as 3.5b: the
teacher labels (DownloadThenExecute etc.) correlate with existing count/location
features or re-derive the detector. Validating provenance LEARNING requires the
novel-chain generalization benchmark (train on detector-covered, hold out
detector-evading attacks); committed as that benchmark's feature foundation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 16:37:06 -07:00
trvon
e1a619f44d
CI: one compile job per build (runner caps jobs at one CPU)
Some checks failed
release / draft (push) Has been skipped
release / build (ubuntu:24.04, noble) (push) Has been cancelled
release / publish (push) Has been cancelled
release / build (debian:trixie, trixie) (push) Has been cancelled
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 16:34:07 -07:00
trvon
8544e921a2
Stage 3.5b: ordered lineage-path bigram features
All checks were successful
release / draft (push) Has been skipped
release / build (debian:trixie, trixie) (push) Successful in 28m43s
release / build (ubuntu:24.04, noble) (push) Successful in 26m22s
release / publish (push) Has been skipped
Feed ordered parent->child exe-template bigrams into the window feature vector
(WindowSummary.lineage_edges, note_lineage_edge, a salted hash loop in featurize,
wired at replay on_exec). The model already got per-kind lineage surprisal
(x[25..29]); this adds path ORDER, which the unordered token bag discarded.

Clean A/B on a fixed corpus (same 697 windows, same flags, only the binary
differs): model AUC 0.734 -> 0.737 (rarity 0.520 unchanged). Null on this
shallow-lineage data (marker execs are 1-process, synthetic data flat) but the
feature is correct and order-sensitive (test: A>B != B>A). Kept as the path
representation that Stage 3.5c's retro-hunt attribution head needs; its payoff is
expected on real multi-stage attack telemetry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 14:22:14 -07:00
trvon
2cc137b8e7
Stage 3.5a: fleet-train --max-node-share/--test-fraction/--split
Expose the merge cap and train/test split on `strawberry fleet train` so a
single-node real-attack bundle can pre-seed a model. Default stays temporal +
cap 0.25 (behavior-preserving); `--split random` + `--max-node-share 1` lets the
Caldera-attack export (15 positive windows) train. Verified: real-only train AUC
1.0 vs rarity 0.563; default still refuses identically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 12:18:32 -07:00
trvon
50254dc8cc
Docs: codify the system + lean AGENTS/CLAUDE for open-source navigation
All checks were successful
release / draft (push) Has been skipped
release / build (debian:trixie, trixie) (push) Successful in 31m52s
release / build (ubuntu:24.04, noble) (push) Successful in 29m30s
release / publish (push) Has been skipped
- README: front door states the full system (core + experimental shadow-only
  inspection model + distributed fleet learning); new "Fleet learning" usage
  section; learn/ + fleet_export/merge + governor in Architecture; a proper
  "Documentation" map; license corrected MIT -> GPLv3 (matches LICENSE).
- AGENTS.md: crisp YAMS work-loop (retrieve/inspect/persist/report), replaced
  the stale ~64-line dated "Current Project Reality" with an accurate concise
  state + pointers (PLAN/DEVELOPER/git/YAMS), trimmed stale work-order/milestone,
  added "Keep This File Lean".
- CLAUDE.md: work-loop + evidence rule up top.
- gitignore the local validation/attack-range harness (deploy/validation/{docker,vm}).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 10:41:05 -07:00
trvon
8f061ad902
Merge ci/release-workflow: Forgejo release workflow, test lane and runner probe
Some checks failed
release / draft (push) Has been cancelled
release / build (debian:trixie, trixie) (push) Has been cancelled
release / build (ubuntu:24.04, noble) (push) Has been cancelled
release / publish (push) Has been cancelled
Forgejo now reads .forgejo/workflows and ignores .github/workflows, whose
ubuntu-24.04/macos-15 labels no runner here provides. The test lane runs on
the ghost-ci runner (label docker).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 10:21:42 -07:00
trvon
120e296acb
Stage 6: local multi-node fleet-loop validation (gap #4)
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
run-fleet-loop.sh + README: proves the distributed loop end to end with real binaries
(seed N nodes -> round-1 export -> central fleet train + fleet overlay -> distribute ->
round-2 export), asserting the fleet signal propagates (round-1 fleet_feat=0 ->
round-2 fleet_feat>0, N distinct nodes, non-empty overlay). Verified: 2 nodes PASS.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 09:32:32 -07:00
trvon
cd93ec4da3
Stage 6: strawberry-fleet-inspect dev tool (bundle record + fleet_bits stats) 2026-11-08 09:29:24 -07:00
trvon
0bc61ac714
Stage 6: strawberry-fleet-seed dev tool (deterministic synthetic telemetry store for fleet validation; gap #4a) 2026-11-08 09:27:09 -07:00
trvon
39912f6e64
Stage 6: wire config node_id to export (stable node identity; gap #2) 2026-11-08 09:05:25 -07:00
trvon
b95bdb04de
Stage 6: strawberry fleet overlay CLI — produce the fleet overlay from a bundle directory (gap #1) 2026-11-08 08:59:52 -07:00
trvon
621d00b86e
Stage 6: Salt pillar + deployment contract for distributed mode
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
Pillar data (deploy/salt/pillar/) + README for the deploying agent: hub-and-spoke
(sensor export -> central fleet train + overlay -> distribute), role assignment,
CLI surface, security invariants, and the honest gaps (no `fleet overlay` CLI yet,
node_id not wired, no multi-node/docker-swarm validation).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-08 08:21:44 -07:00
trvon
446e5c3afe
Stage 6: export populates fleet_bits from a local overlay (export_store fleet_surprisal callback; run_export loads fleet-overlay.sbo) 2026-11-08 08:09:47 -07:00
trvon
9313134aee
Stage 6: populate WindowSummary.fleet_bits from a fleet overlay during scoring (ReplayOptions.fleet_surprisal callback) 2026-11-08 08:01:40 -07:00
trvon
97374a16d2
Stage 6: fleet-overlay feature — per-kind fleet_bits[5] in featurize (reserved slots x[37..41], back-compatible) 2026-11-08 07:55:40 -07:00
trvon
7ad7596bda
Stage 6: load fleet overlay + sketch_surprisal_bits (query fleet-wide rarity for a tuple) 2026-11-08 05:38:00 -07:00
trvon
c939c3536b
Stage 6: fleet rarity overlay — sum per-node count-min sketches and serialize as an overlay bundle 2026-11-07 21:28:35 -07:00
trvon
31e4833169
Stage 6: strawberry fleet train — merge a bundle directory and train the shadow model; fleet_merge populates rarity_bits 2026-11-07 21:22:14 -07:00
trvon
ae4555ec38
Stage 6: central fleet merge core — export bundles to capped TrainingExamples (max_node_share) 2026-11-07 21:12:42 -07:00
trvon
6a028810da
Stage 6: export rarity sketches (export_rarity_delta) from the saved RarityModel state; CLI attaches them when present 2026-11-07 20:47:53 -07:00
trvon
caa7740265
Stage 6: strawberry export CLI verb + node_uid manifest + store-dir e2e (closes 1e deferred validation) 2026-11-07 20:34:33 -07:00
trvon
45f13f7f16
Stage 6: extract windows/features/labels from the store via the replay pipeline into an export bundle 2026-11-07 20:20:41 -07:00
trvon
b5bb1689f9
Stage 6: export rarity-delta record (per-TupleKind count-min, bounded decode) + harden R13 for braced initializers 2026-11-07 19:39:22 -07:00
trvon
fdd699f037
Stage 6: export payload records (window/feature/label, hybrid token hashes) + R13 redaction invariant 2026-11-07 19:32:47 -07:00
trvon
23e70fe823
Stage 6: export bundle format (fleet_export) — sealed segment reusing the store codec; RecordType export_* + R12 2026-11-07 19:12:40 -07:00
trvon
b7336de261
Stage 6: node identity (fleet.hpp) — pure node_uid + wrapper 2026-11-07 18:59:51 -07:00
trvon
f58a765033
CI: Forgejo release workflow, test lane and runner probe
All checks were successful
release / draft (push) Has been skipped
release / build (debian:trixie, trixie) (push) Successful in 31m13s
release / build (ubuntu:24.04, noble) (push) Successful in 26m59s
release / publish (push) Has been skipped
release.yml builds, tests and packs a Linux install tree per distro
(debian:trixie, ubuntu:24.04), one at a time with JOBS=2 and nice.
Branches (main, ci/**) and PRs run the test lane and print each sha256;
a v* tag uploads the tarballs and .sha256 files to a draft release and
publishes it only when every build passed.

runner-probe.yml checks that a runner with the docker label picks up
jobs, can clone this repo with the job token and reach the API.

packaging/ci/build-release.sh is the shared build step. It refuses to
run outside CI because it installs packages.

Forgejo now reads .forgejo/workflows and ignores .github/workflows,
whose ubuntu-24.04/macos-15 labels no runner here provides.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 18:26:02 -07:00
trvon
253c84111f
Ignore local tool output (.pi/, .clangd) and the brick.html audit artifact
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
brick.html is a ~9.5 MB brick (structure audit) report; .pi/ and .clangd are
local tool state. None belong in the tree.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-05 16:24:54 -07:00
trvon
74aa9664ad
Pipeline: keep oversized cache refusals unscanned
Do not turn an empty cached digest into an unbounded descriptor hash. Distinguish size refusals from YARA results so the exec guard applies its own bounded scan/degrade policy. Cover cached read budgets across size boundaries, known hashes, inventory/live events and real guard-cache reuse. Fold/live/KPI and post-rollout CPU acceptance remain pending; OpenSnitch checksum work is separate.
2026-11-03 06:57:35 -07:00
trvon
a5f2dbedfc
KPI: bound collection and reject incomplete measurements
Use suspend-aware BOOTTIME waits and owned-container cleanup without changing the workload. Reject missing coverage and preserve producer/report failures. Include runtime/helper regressions, constrained build-job support and live exec-guard crash safety. Document the failed live/idle gates without relaxing thresholds or claiming production acceptance.
2026-11-03 06:57:00 -07:00
trvon
be237d6040
Findings: reconcile evidence and harden policy rebuilds
Preserve independent support, typed rule namespaces and stable process lifetimes. Share authoritative managed-set reconciliation across daemon and offline correlation, load offline policy without seeding/migration, and release resources after shutdown-flush exceptions. Keep retirement history, transaction ownership and fault/allocation regressions; no whole-set crash-atomicity or live acceptance claim.
2026-11-03 06:55:47 -07:00
trvon
29e490dcab
Replay: add strict read-only training summaries
Reuse the existing resolver/sampler for opt-in aggregate training summaries. Reject incomplete or undecodable snapshots without usable partial reports, retain best-effort readers elsewhere, and document cooperative extent checks rather than atomic snapshot guarantees. Include command-table/help, JSON, fixture and corruption regressions; no model training or promotion.
2026-11-03 06:54:17 -07:00
trvon
52b02f1dc7
Learn: preserve label provenance and bound replay sampling
Resolve allowlist and quarantine retractions without erasing independent support. Refresh capped entity reservoirs and bound allocated slot bookkeeping; retain deterministic seeded mutation regressions.
2026-11-03 06:53:28 -07:00
trvon
c565cb5aee
Learn: handle extreme restored rarity clocks
Represent full-range ordered clock differences without signed overflow and allow complete decay. Add seeded restore-clock regressions and a dedicated fuzz seed.
2026-11-03 06:52:20 -07:00
trvon
2488423fbd
Allowlist: retire a binary's stored findings when it is allowlisted
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
Allowlisting a binary suppressed only *new* detections: the findings
already stored for it stayed in the evidence store, and every reload
re-materialised them. That is why the ~9k iproute2 `ss` false positives
kept "coming back" after the hash was allowlisted a day earlier -- nothing
retracted them, and the only cleanup was `doctor fix
retire-allowlisted-findings`, which operators do not know to run.

allowlist-add now retires the now-allowlisted findings at the moment of
the action (alongside the existing containment release) and reports the
count as `retired_findings` in its reply. retire_allowlisted_findings is
hash-based and self-filtering, so a path/rule entry that matches no
fully-allowlisted finding retires nothing.

Regression test (test_daemon_runtime): a detected binary's finding is
materialised (forced correlation), allowlist-add reports
retired_findings >= 1, and after correlation re-runs the finding does not
come back (A already makes correlation skip allowlisted entities).

Also refresh the doctor findings.allowlisted message, which claimed
allowlisting does not delete stored findings -- it now does.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-29 13:53:21 -06:00
trvon
182e49b4c0
Build: keep LTO temporaries off tmpfs so a relink can't OOM the host
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
/tmp is tmpfs (RAM) on the dev host; a large GCC LTO relink writes its
ltrans files to $TMPDIR and, when that is /tmp, can exhaust memory and
freeze the machine (observed this session). Point the build's TMPDIR at a
disk-backed build/tmp, created as an order-only prerequisite of the
compiling targets (build, conan-build, fuzz). Override with BUILD_TMPDIR=.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 22:38:02 -06:00
trvon
728b2462e7
Governor: background work no longer starves under sustained pressure
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
On a host that sits at critical/emergency for a long time (its own apps holding
most of RAM, or the daemon slightly over its soft budget), the starvation guard
was disabled (`!hard`), so correlation, retro-hunt and inventory deferred
forever — observed deferred 153 min with forced=0, which also starves the
retro-hunt delayed labels that Stage 4 training needs.

- Tiered starvation guard: it now fires under critical/emergency too, but after a
  level-scaled window (1x warning, 4x critical, 12x emergency) so background work
  is rare under load, not zero. A true host-memory crunch (host_severe_,
  MemAvailable below the severe floor) still holds everything, since forcing work
  then could tip the host toward OOM. exec guard/scan paths unchanged.
- Raise the balanced own-memory soft budget 512 -> 768 MiB: the daemon's steady
  footprint grew (telemetry buffers, the ingest server, the shadow model), so 512
  left it permanently over budget -> pinned critical/emergency. 768 fits the real
  baseline, still well under the 1.5 GiB cgroup cap.

Tests updated for the 768 budget and the tiered guard (critical forces after the
4x window; severe holds it). Suite 51/51; analyzer + clang-tidy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 22:33:25 -06:00
trvon
4ade69ec7e
Learn: allowlisted binaries are negative labels, not teacher positives
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
The teacher-label join made a window a positive if it was detected
(replay.cpp), but it never applied the allowlist, so a window running a cleared
false positive (e.g. /usr/bin/ss) was labelled a teacher positive — poisoning
Stage 4 training. Negative labels were written to the stream but replay dropped
them.

- replay_store now collects negative labels into ReplayOptions.negative_labels
  (it used to ignore any non-positive label).
- A window whose exec hash is negatively labelled is marked `suppressed`; the
  example/policy-eval positive is gated on `!suppressed`, so such a window is
  kept as a *negative* training example (useful signal) and never a positive,
  even if a cleared rule "detected" it.
- DetectionPipeline seeds a negative label for every allowlisted sha256 at init,
  so evidence stored before the allowlist (the historical ss storm) is covered
  without waiting for a re-exec.

Test: a detected window with a stored negative label for its hash is a positive
before the label and a kept-negative after. Suite 51/51; analyzer + clang-tidy
clean on replay.cpp and detection_pipeline.cpp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 22:02:56 -06:00
trvon
db654cc217
Correlation honors the allowlist, so cleared false positives stop regenerating
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
Correlation runs over the whole store and never consulted the allowlist, so an
allowlisted hash (e.g. the /usr/bin/ss feed false positive the operator cleared)
regenerated the same findings on every pass from already-stored indicators —
`doctor fix retire-allowlisted-findings` cleared them but they came straight back
(~9,400 findings observed again). This also meant the findings were a poisoned
teacher-label source for training.

- classify() now skips an indicator whose (hash, path, rule) is allowlisted, the
  single chokepoint shared by CorrelationEngine::build_findings (the oracle) and
  IncrementalCorrelator::update, so both agree. New AllowlistFn; build_findings /
  correlate take an optional predicate (default = no filtering, existing tests and
  the incremental==full oracle unchanged); IncrementalCorrelator::set_allowlist.
- DetectionPipeline wires the predicate to PolicyStore::match, so the live
  incremental path skips allowlisted evidence. Retiring the findings now sticks.

Test: build_findings with an allowlist predicate emits nothing for the matched
hash and is unaffected for others. Suite 51/51; analyzer + clang-tidy clean.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 19:52:36 -06:00
trvon
c3dc258d5a
App: tray icon survives the sway/waybar startup race
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
strawberry-tray did a one-shot QSystemTrayIcon::isSystemTrayAvailable() check at
startup and, if no StatusNotifier host was up yet, permanently fell back to
window-only mode (never creating the tray icon). Under sway the app is usually
`exec`ed before waybar registers its tray module, so the indicator never showed
even after waybar came up.

- main.cpp no longer disables the tray on that one-shot check; it keeps the tray
  and logs a hint.
- AppController::start(): if the tray host isn't available yet, retry every 1.5 s;
  when it appears, hide()+show() the icon to (re)register with the host. Only if
  no host shows up within ~15 s does it fall back to opening the window.

Verified live on sway: with waybar up, the fixed binary registers a
StatusNotifierItem (icon visible); the retry covers the start-before-waybar case.
Suite 51/51; clang static analyzer clean on the changed app TUs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 19:15:12 -06:00
trvon
4ac7ad77ea
Privacy: fix macOS link of the Little Snitch source (environ)
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
`extern char** environ;` inside namespace strawberry declared strawberry::environ
(undefined at link on arm64). Use `*_NSGetEnviron()` (<crt_externs.h>), the
macOS-blessed way to get the environment for posix_spawn. macOS validated on the
Mac via ssh: meson compile + 46/46 tests green in a throwaway worktree at the
previous commit with this file patched in. Linux unaffected (macOS-only code).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 18:59:56 -06:00
trvon
c77bc79dc7
Privacy: macOS tracker source via Little Snitch log-traffic (WS2 macOS)
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
Completes the tracker-attribution transport on macOS. There is no network
sandbox to work around there, so the daemon (root) reads Little Snitch's traffic
stream directly and feeds the same on_opensnitch_connection consumer — no relay
or ingest socket (those are the Linux sandbox answer).

- LittleSnitchParser (cross-platform, unit-tested): parses `littlesnitch
  log-traffic` CSV via a header-name->index map (tolerates column reordering),
  yielding the shared redacted OpenSnitchConnection for outbound rows only
  (program, uid, host/ip/port, protocol 6->tcp/17->udp). Little Snitch's CSV has
  no argv/env, so redaction is structural. split_csv_line handles quoted fields.
- LittleSnitchSource (macOS only): posix_spawns `littlesnitch log-traffic
  --stream`, reads the pipe on a guarded thread, parses and calls back; stop()
  SIGTERMs the CLI (EOF -> loop ends) then reaps it.
- Daemon: start_tracker_attribution gains an __APPLE__ branch that starts the
  source; shutdown/status handle it. New config littlesnitch_cli (default CLI
  path). status privacy.listener source "little-snitch".
- docs: macOS section rewritten (needs Little Snitch "Allow access via Terminal").

Test E10 covers the parser (header, outbound/inbound, deny, quoted exe, no-dest).
Linux suite 51/51; analyzer + clang-tidy clean (Linux view). The __APPLE__ code
compiles/validates on the Mac next (ssh); live spawn needs root + LS Terminal access.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 18:54:27 -06:00
trvon
94c8a8f9f1
Privacy: host-namespace tracker relay + install/units/docs (WS2b/WS2c)
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 half of the sandbox-safe tracker transport. A small relay in the host
network namespace bridges OpenSnitch to the sandboxed daemon, so the daemon keeps
PrivateNetwork=true + RestrictAddressFamilies=AF_UNIX and never sees argv/env.

- `strawberry opensnitch relay` (new CLI verb, Map::flag -> --opensnitch-relay):
  binds the OpenSnitch loopback port via the existing OpenSnitchEventListener
  (root-peer check, argv/env dropped at parse), and forwards each redacted tuple
  (encode_connection) to the daemon's AF_UNIX ingest socket, reconnecting on
  failure. Foreground loop until SIGTERM/SIGINT; drops (not blocks) when the
  socket is down. Linux-only. The listener callback runs on one thread, so the
  sink needs no lock.
- scripts/strawberry-trackerd.service: runs the relay in the host namespace with
  only CAP_NET_BIND_SERVICE, no PrivateNetwork, and /proc/net kept readable for
  the peer check (no ProcSubset=pid); otherwise the same tight sandbox as
  strawberry-update.service. install.sh installs+manifests+starts it when
  OpenSnitch is present and privacy_trackers is not false.
- docs/tracker-attribution.md: replace the "known limitation" with the relay
  architecture (rejected alternatives noted). API_CONTRACT: privacy.listener now
  describes the ingest socket + relay; also documents feed-add max_severity (B1).

Suite 51/51; clang static analyzer and clang-tidy clean on main.cpp and
cli_commands.cpp. Full relay->OpenSnitch end-to-end needs host validation
(sudo + a real OpenSnitch); the socket path is covered by E9.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 17:56:23 -06:00
trvon
b09c416b32
Privacy: daemon-side AF_UNIX ingest socket for the tracker relay (WS2a)
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 half of the sandbox-safe tracker transport (architecture deep dive). The
daemon's old loopback TCP listener could not bind under its own sandbox
(PrivateNetwork=true + RestrictAddressFamilies=AF_UNIX). Replace it with an
AF_UNIX ingest socket the daemon *can* bind under the sandbox; a host-namespace
relay (next change) will bind the OpenSnitch port, strip argv/env, and forward
redacted tuples here.

- opensnitch_events.hpp/cpp: encode_connection / decode_connection serialize only
  the redacted fields (never argv/env, which the parser already drops) as one
  JSON object — the relay->daemon wire form. New TrackerIngestServer: an AF_UNIX
  stream listener (Linux-only, like the TCP listener) that accepts only a root
  peer (SO_PEERCRED), frames with take_json_objects, decodes and calls back;
  bounded clients/object/buffer as before.
- daemon: start_tracker_attribution now opens the ingest socket
  (opensnitch_ingest_socket, default /run/strawberry/trackers.sock) instead of
  the in-sandbox TCP listener, so it works with the sandbox unchanged and is
  simply idle until a relay connects. status privacy.listener reports the ingest
  socket + relay_events; shutdown stops it. New config key opensnitch_ingest_socket.
- Tests: E8 encode/decode round-trip + redaction (no args/env on the wire);
  E9 TrackerIngestServer end to end (connect, two tuples, callback, stats);
  daemon-runtime configs set privacy_trackers=false (not under test).

Suite 51/51; clang static analyzer and clang-tidy clean on the changed TUs. The
relay run-mode + systemd unit + install wiring + docs follow in WS2b/WS2c.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 17:50:16 -06:00
trvon
4664ae4458
Detection: unify the two repeat-aggregation sinks + IOC severity resolution
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
The scan path (handle_process) and the exec-guard recording path
(record_exec_decision) had grown two near-identical repeat-aggregation maps
(repeats_ / exec_repeats_) plus three copies of the IOC-feed severity idiom.
Refactor to one implementation; no behavior change (the existing aggregation and
IOC-severity tests are the oracle and pass unchanged).

- New include/strawberry/repeat_aggregator.hpp: RepeatAggregator owns the
  per-key window map, the 20-full-then-summary cadence and the aggregated count;
  observe(key, now, seen_ns, pid) returns {full, at_threshold, aggregated,
  emit_summary, notify, state}. Each caller keeps its own key, summary-id prefix,
  summary shape and notify behaviour. Both pipeline sinks now hold one instance
  (scan notifies at most hourly; exec passes notify_ns=0). status
  repeats_aggregated sums both totals (atomic, lock-free read).
- ioc_hit_severity(feed): one source for the three IOC match sites (scan_image,
  assess_exec, handle_process) that was the policy_->ioc_feed_severity ternary.
- Leaves the latency-critical assess_exec/decide path untouched; both sinks still
  run under mutex_, off the FAN response.

Unit test tests/test_repeat_aggregator.cpp (window reset, threshold, summary and
notify cadence, per-key independence). Suite 51/51; clang static analyzer and
clang-tidy clean on detection_pipeline.cpp; fold's 7 int-overflow are the accepted
monotonic-timestamp FP class (unchanged by the move); perf-kpi PASS, no regression
(exec_decision p50 unchanged, exec_assess/db_commit within noise or faster).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 17:39:48 -06:00
trvon
36982c4b56
Doctor: detect and retire findings for hashes you have since allowlisted
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
Allowlisting a hash suppresses new detections but does not delete findings
already stored for it (e.g. the /usr/bin/ss false-positive storm). That cleanup
now lives in doctor instead of a one-off compaction.

- DetectionPipeline::retire_allowlisted_findings(dry_run): a finding is stale
  when it references at least one hash and every hash it references (from
  metadata "hashes" and file_<sha256> nodes) is allowlisted, so a finding that
  also implicates a non-allowlisted binary is never dropped. Mirrors
  retire_superseded_findings (retire_finding + transaction).
- node_ids.hpp gains content_hash_of_file_node_id() (the inverse of
  file_node_id for the content case) so the pipeline parses file ids through the
  canonical helper, not a "file_" literal (source invariant R8).
- Doctor check findings.allowlisted (warn) with maintenance action
  retire-allowlisted-findings; DoctorInputs.allowlisted_findings gathered by the
  daemon; run_maintenance handles the action; CLI `doctor fix` help + completion
  and API_CONTRACT updated.

Tests: test_retire_allowlisted_findings (two execs of a flagged binary -> a
finding; allowlist the hash -> dry-run lists it, apply retires it, idempotent);
doctor check ok/warn cases; CLI completion string. Suite 50/50; clang static
analyzer, clang-tidy and source invariants clean on the changed TUs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 11:37:52 -06:00
trvon
9bfa008253
Privacy: tracker attribution fails clean under the service sandbox
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
The packaged strawberry.service runs with PrivateNetwork=true and
RestrictAddressFamilies=AF_UNIX, so the OpenSnitch-events loopback listener
cannot bind (EAFNOSUPPORT/EPERM) and could not reach OpenSnitch's host namespace
anyway. Rather than surface a bare errno:

- start_tracker_attribution() translates the sandbox bind failure into a plain
  explanation in status privacy.error (names PrivateNetwork/RestrictAddressFamilies
  and points at docs/tracker-attribution.md). Nothing blocks, no finding.
- install.sh no longer implies tracker events are working: it says OpenSnitch was
  *configured* to send, and to check `strawberry status` (privacy.listener), since
  the daemon can only receive if its sandbox permits a loopback listener.
- docs/tracker-attribution.md documents the limitation and that the planned fix is
  a host-namespace relay over the AF_UNIX control socket (sandbox preserved);
  relaxing the sandbox is an operator choice, not a default.

Transport redesign deferred to the architecture deep dive. Suite 50/50; clang
static analyzer and clang-tidy clean on daemon_app.cpp.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 10:38:43 -06:00