161 commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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> |
||
|
|
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>
|
||
|
|
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> |
||
|
|
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> |
||
|
|
e93f8e37da |
Detection: aggregate repeated exec-guard decisions; read /proc outside the lock
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 exec-guard would-block recording path stored one indicator (and, via correlation's per-process grouping, one finding) per exec, with no aggregation, unlike the scan path. A critical feed or rule matching a frequently-run binary would flood evidence the way /usr/bin/ss did. - record_exec_decision now collapses repeated identical decisions (keyed by verdict|hash|rule) with the same 10-min window / 20-full-then-summary scheme as handle_process (new exec_repeats_ map; counts into repeats_aggregated_). Beyond the window it refreshes one "exec-repeat" summary indicator and returns before the per-exec graph write. - The actor's /proc identity reads are now done before taking mutex_, not under it. The clang static analyzer (new strict gate) flagged ::read in a critical section (unix.BlockInCriticalSection) here; this also honors the AGENTS rule that scans/reads stay off DetectionPipeline::mutex_. Analyzer now clean. Test: test_repeated_would_block_is_summarized drives 30 identical would-block decisions and asserts exactly 20 full exec-audit indicators + 1 exec-repeat summary and repeats_aggregated == 10. Suite 50/50; analyzer and clang-tidy clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
6453d14589 |
Detection: IOC hash severity comes from per-feed trust, not a hardcoded critical
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 benign system binary (/usr/bin/ss) whose SHA-256 was on a noisy community hash feed produced thousands of critical "would have been blocked" findings: IOC hash matches were hardcoded severity "critical" at every site, and in exec_guard an ioc_match forces a prevention hit regardless of the severity threshold. - FeedSpec gains `max_severity` (append-only; serialize/parse/validate, control socket `feed-add` accepts it). Empty = default for the kind: hash feeds are advisory "high", not "critical". PolicyStore::ioc_feed_severity() resolves it. - All three IOC severity sites now use the feed's severity (detection_pipeline.cpp scan_image, assess_exec, handle_process), replacing the hardcoded "critical". - Trust gating: ExecAssessment::ioc_match is set only when the matched feed resolves to "critical" (a curated feed that should force prevention). A community feed stays advisory — its "high" is subject to prevention_min_severity (default "critical"), so it no longer would-blocks system tools per exec. Tests: test_ioc_hash_detection uses an explicit critical feed (trusted path) and asserts assess_exec forces the hit; new test_ioc_community_feed_is_advisory asserts a default feed is "high", ioc_match is not forced, and decide_exec allows it in audit and enforce; test_policy covers max_severity validation, the advisory default, and a critical round-trip. Suite 50/50; clang static analyzer and clang-tidy clean on the changed TUs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
09e6b441ae |
Audit flow: add the clang static analyzer as a strict per-change gate
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
- scripts/analyze_changed.sh + `make analyze`: clang-check --analyze over the changed TUs via builddir/compile_commands.json (host build may be gcc; clang tolerates those flags), nice -n 19, 2 at a time. Strict by default (any analyzer diagnostic fails), ANALYZE_STRICT=0 reports only; ANALYZE_FILES/--all override selection. Results in build/audit/out/analyze.log. - AGENTS.md "Per-change checks": new analyzer row, positioned as path-sensitive intra-TU analysis that complements fold's bounded symbolic cross-call pass and the syntactic invariants (run all three); YAMS index-at-checkpoint reminder. - CLAUDE.md: analyzer added to the checks pointer + a Performance & C++ bullet (perf-kpi + Tracy/PerfStats). - docs/prompts/PROMPT-strawberry-audit.md: "Clang static analyzer" subsection under Symbolic SAST. No C++ changed; unit suite 50/50 green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> |
||
|
|
ebbc96f8b1 |
OpenSnitch events listener: Linux-only (accept4, pipe2); parsing stays portable
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
8f6bd1d4e0 |
Privacy: attribute tracker contacts to programs via OpenSnitch events
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> |
||
|
|
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> |
||
|
|
f172bc1710 |
Replay and training take several trace files; fix an autostart label
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
--inject and --inject-train are now repeatable (training.trace plus threats-train.trace, standard.trace plus threats-eval.trace). Trace names must be unique across the files. standard.trace labelled its autostart write "XDG autostart", but the file watcher emits "desktop autostart", so that write never matched what a real host records. No gate evaluation has used standard.trace yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
085e8bdd2d |
Stage 4: pre-register threat-grounded traces (cutoff 2025-07-01, family split)
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
Written before any threat trace is collected or evaluated. Train on families first reported before 2025-07-01, evaluate on families first reported after it (new-family bucket primary), from public write-ups and Atomic Red Team only: Triage and MalwareBazaar terms forbid ML training. Adds gate criterion 5 (model recall >= rarity-greedy on new families). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4bb51030b6 |
Stage 4: ship a training trace set; install traces
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
`model train` on a host without detections stops with "0 positive windows" and pointed at --inject-train FILE, but only the evaluation set (standard.trace) existed. Add config/traces/training.trace: 7 attack shapes (document macro dropper, web reverse shell, cron miner, /dev/shm perl stager, ssh key backdoor, npm postinstall, ld.so.preload) that differ from the evaluation set, so the gate never judges a model on what it trained on. P4 in test_trace enforces that (no shared trace name or exec sequence); it caught an evince -> python3 overlap in the first draft. Both installers put the traces in /usr/local/share/strawberry/traces/ (install_traces in install_common.sh); the hint and README name it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
edb774acd6 |
Rewrite the README around install and usage
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
Install (Linux, macOS, ES requirements, installed files), usage with the current CLI, then features with per-OS notes and a backend table. Drops the dated status log and the duplicate feature list. MCP registration for Claude Code, Codex and pi (README and strawberry-mcp --help). CI and README use Homebrew's openssl (now openssl@4). AGENTS/DEVELOPER: install facts and platform map rows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
2a4812829f |
Use macOS store paths and launchd hints in the CLI, app and MCP
The CLI fallback, the tray app and strawberry-mcp looked for evidence in /var/lib/strawberry; kSystemStorePath (config.hpp) is /var/db/strawberry on macOS. User-facing hints quoted systemctl and journalctl; they come from include/strawberry/service_hints.hpp (launchctl and /var/log/strawberry.log on macOS), including doctor's log-rotation note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f7d3998f88 |
Fix the macOS install: signing, monitoring, updater user
scripts/install.sh hands off to scripts/macos_install.sh on Darwin (it failed on getent/groupadd) and runs from the repo root. `make install` runs it on either OS. Signing: an ad hoc signature carrying the ES entitlement is killed at launch while SIP is on, and the hardened runtime rejected the Homebrew dylibs (different Team ID). Both entitlement files now disable library validation; with SIP on and IDENTITY=- the installer signs with strawberry-base.entitlements (libproc fallback), test-launches the binary and re-signs without ES if it is killed. `make macos-sign` refuses the combination that would be killed. The installer no longer sets enable_bpf_monitoring=false, which turned off all process monitoring; it sets db_path explicitly. The rule updater runs as the new _strawberry user, which owns only feeds/, and starts on update-requested via KeepAlive PathState (WatchPaths also fired on removal). launchd jobs use `daemon run` / `rules fetch`. Parity with Linux: completions, the installed-files manifest, evidence permissions, group offer. Shared helpers in scripts/install_common.sh. MCP registration moved to the README. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f76db466eb |
Stage 4: keep the live rarity model across daemon restarts
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 shadow scorer's rarity model started empty at every daemon start, so each restart cost an hour of warm-up with no decisions. The daemon now saves it to model_dir/rarity.state (checksummed, atomic write, hourly and at stop) and restores it at start. A restored state younger than the 7-day half-life skips the warm-up; decay catches up on the first event. A file made with other rarity settings, a bad checksum, or a negative or non-finite count is refused with a reason (status model.rarity_state, doctor model.rarity_state) and the model starts empty. The file must be owned by the daemon user and not group/world writable, like model files. Also fixes status model.warmup_windows, which was never filled in. Tests: R1/R2 in test_learn (round trip, decay clock, refusals), S8 in test_shadow (warm-up skipped only when recent), daemon restart restores the saved state, doctor warning; new fuzz_rarity_state target. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
b6d667b797 |
Stage 4: evaluate inspection policies in replay; gated promotion
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
- replay --policy-eval: over ranked windows, simulates the model and rarity-greedy (the same chooser, rarity score / 48 as the value), each with its own hourly budget, and tallies the shadow decisions the daemon logged. Hits are inspected "extra" positives: late labels or injected evaluation traces on windows rules did not flag at exec time. Labels are known after the fact, so every action's payoff is computable without propensity weighting. Reports CPU-seconds, inspections, hits, recall, hits per CPU-second and budget refusals. - docs/evaluation/stage4-promotion-gate.md (pre-registered): at least 10 extra positives, model efficiency >= 1.5x rarity-greedy, model recall not lower. promotion_gate() checks it. - strawberry model promote [--inject FILE] [--warmup H] [--yes]: replays with the shadow model, applies the gate and only then writes promoted.sbm; asks for confirmation. - learn/inspection.hpp: options, the greedy chooser and the inspection_action record, shared by shadow mode and the evaluation. - Fix: the hourly budget reset whenever a window closed with an earlier timestamp than the hour's start (windows close roughly, not strictly, in time order), letting spend exceed the budget; in both shadow mode and the evaluation. Tests: test_replay R11 (gate criteria; extra positives exclude rule-flagged windows; spend within the budget; logged shadow decisions joined to their windows); CLI translations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
0006a86ff4 |
Stage 4: shadow mode for the inspection model
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 daemon now scores live windows with the shadow model and logs the inspection it would request. Nothing is executed. - learn/shadow: a live replay engine (same windows and rarity as `strawberry replay`) fed every telemetry record on the writer thread. When a window closes, the model's value v gives each action a benefit v x reach - lambda x CPU cost; the best positive one is chosen if the hour's budget (10/30/120 CPU-s by scan profile) allows, else none. With probability 0.02 a uniformly random other action is taken instead, and every decision records its propensity for off-policy evaluation. Decisions are inspection_action telemetry records. - Replay gains a live mode (no ranking bookkeeping, so memory stays bounded) and a window-closed callback. - Daemon: model_shadow (default on) loads <model_dir>/shadow.sbm when it appears or changes, checked every minute; an invalid file is reported and not used. Status gains a `model` block (kernel, generation, decisions by action, exploration, would-be spend, budget refusals). - learn_sources in src/meson.build: tests that compile the daemon from sources take the learning library whole. Limits, documented: decisions come when a window closes (a few minutes after its first exec), and the live rarity model starts empty at each daemon start (the first hour is learned, not decided). Tests: test_shadow (no model, greedy choices, budget never exceeded, determinism, exploration rate and propensities, record codec); daemon status; fuzz_telemetry_records covers inspection_action. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6a3efbc22a |
Stage 4: train the inspection model offline from replay
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
- Replay builds each window's WindowSummary as it goes (exec depth and locations, connections, writes, ptrace, module loads, scan outcomes, surprisal) and can collect training examples: features, a label (a detection or late label touched the window), time, root program and the rarity score. Sampled to at most 50k: positives up to a fifth, negatives by reservoir with at most 1% per root program. --inject-train traces become positive examples and are not evaluated. - learn/train: the value head (and hidden layers) learn P(teacher positive) with a class-weighted log loss and Adam; positive-unlabeled data, so unlabeled is "not known bad", documented. Split by time (newest 20% tested); reports test loss, top-k hits and ROC AUC for the model and for the rarity baseline. Refuses with fewer than 5 positives. Deterministic for a seed. The policy head waits for shadow-mode inspection outcomes. - CLI: `strawberry model train [store_dir] [--inject-train FILE] [--epochs N] [--seed N] [--out FILE] [--json]` writes the shadow model (generation after the newest existing one, a note saying what it was trained on); `strawberry model show [file]`; `strawberry replay --model FILE` ranks windows (and evaluates injections) by the model's value. Config model_dir (default /var/lib/strawberry/model). - doctor: the model check loads promoted.sbm and shadow.sbm; an invalid file is a problem (it is never used). Tests: test_train (gradients against finite differences, skipping steps that cross a ReLU kink; a planted pattern learned to high AUC; determinism; refusal without labels; roc_auc); test_replay R10 (examples, labels, per-program cap, training traces, model ranking); CLI and doctor cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
db81372e19 |
Portability: 128-bit file_clock counts (libc++), split a hex-escape literal
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
Clang rejects "\x80evil" (the escape takes the 'e'); GCC accepted it and the test used a different string than written. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
1acaf9f563 |
Store housekeeping: read mtimes on macOS (st_mtimespec)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
324d5f4865 |
Add a macOS CI job and document the port
The macos job (macos-15, Homebrew deps, Qt app skipped) builds and runs meson test. It only runs on GitHub: Forgejo also reads .github/workflows and has no macOS runner. README: macOS build, the Linux to macOS backend map, ES requirements and installed files. API_CONTRACT: macOS socket path and peer credentials, the endpoint_security and libproc backend values, and the macOS status fields. DEVELOPER: platform map and the GitHub + Forgejo remotes. AGENTS: current state of the port, including that the ES backends have not run live yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
f2f692263c |
Package for macOS: launchd jobs, signing and install
packaging/macos/ holds the ES entitlement and two LaunchDaemons: the scanner (root, group strawberry, umask 027, XDG_DATA_HOME=/var/db so evidence lands in /var/db/strawberry) and the rule updater (daily, and on feeds/update-requested like strawberry-update.path). scripts/macos_install.sh creates the group with dseditgroup, the config (/run paths moved to /var/run), state directories, signs the binary with the entitlement and bootstraps both jobs. make macos-sign (IDENTITY=- ad hoc, or a Developer ID), make macos-install, and make macos-live-tests (signs and runs macos_es_live under sudo). An ad hoc signature carries the ES entitlement only with SIP disabled; the install script says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
abe945097e |
Monitor execs and file writes on macOS with Endpoint Security
New meson option enable_endpoint_security (auto, macOS only) links EndpointSecurity and bsm and builds three ES backends behind the existing interfaces. Helpers are in src/platform/es_support.hpp. - ProcessMonitor: NOTIFY_EXEC events (pid, parent, path, dev:ino, argv, start time) plus NOTIFY_TRACE and NOTIFY_KEXTLOAD for the behavior rules. Events go to a bounded queue (4096, overflow counted in events_dropped) drained on the monitor thread, so callbacks stay on one thread. Without an ES client the monitor polls libproc (backend "libproc"). backend_name() reports "endpoint_security". - ExecGuard: AUTH_EXEC with the fanotify guard's rules. It fails open at min(timeout, ES deadline - 500 ms) and on a full queue, and on macOS 27+ ES_DEADLINE_MISS_MODE_FAIL_OPEN makes the kernel allow a missed deadline too. Platform binaries and SIP paths are never denied, and our own execs are muted. ES does not cache verdicts, so rule changes apply on the next exec. Our own cache keys on dev:ino:size:mtime:generation. The image is opened by path and its dev:ino checked against the event; a swapped file counts as unscanned. - FileWatcher: NOTIFY_CREATE/RENAME/CLOSE(modified) with inverted target-path muting: named entries selected literally, whole directories by prefix. macos_watch_specs() covers launchd agents/daemons, periodic jobs, cron tabs, sudo drop-ins, shell rc files, authorized_keys, Downloads and the temp directories. match_watch_spec() (direct children, as with fanotify directory marks) is portable and tested. Home dirs come from the directory service (local_home_dirs). Every ES handler is noexcept and records swallowed exceptions. Client errors name the missing requirement (root, entitlement, Full Disk Access), and the daemon keeps running detection-only. macos_es_live (root, ES entitlement) checks deny/allow/cache/ platform-binary/fail-open/audit for the guard, exec telemetry and the file watcher, using small signed payload binaries. It has not run yet: the development Mac has SIP enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
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> |
||
|
|
8fda6206c0 |
Build on macOS: portable syscalls, sockets and tray
The tree now compiles on macOS. Each Linux-only call gets a Darwin branch, and the Linux branch stays as it was: - io::fdatasync uses fcntl(F_FULLFSYNC): fsync alone only reaches the drive cache on APFS, and the store's crash atomicity relies on it. - Control socket: FD_CLOEXEC set after socket/accept/recvmsg (no SOCK_CLOEXEC, accept4 or MSG_CMSG_CLOEXEC), SO_NOSIGPIPE, peer credentials from LOCAL_PEERCRED + LOCAL_PEERPID, getgrouplist with int groups and a growing buffer. launchd has no RuntimeDirectory, so the socket directory is created (0750, access group) when missing. Default socket path is /var/run/strawberry/control.sock. - CRC32C detects ARMv8 CRC with hw.optional.armv8_crc32 (no auxv). - stat mtime via st_mtimespec; the BPF shared header uses stdint typedefs off Linux. - Background threads join the PRIO_DARWIN_BG band (lower CPU and I/O); crash safety zeroes RLIMIT_CORE in place of PR_SET_DUMPABLE. - The desktop app drops Qt DBus off Linux and shows notifications as tray messages (app/notifier_tray.cpp). - make setup passes Homebrew's keg-only libarchive to meson. Tests: behavior_live (Linux ptrace API) builds on Linux only, the control-server fd count reads /dev/fd, the crash test checks the core limit on macOS, and the runtime pipeline test no longer references a YARA-only helper when YARA is absent (that also broke Linux builds without libyara). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
fdd66e8bab |
Stage 4 groundwork: window features, inspection MLP, model files
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
Nothing runs in the daemon yet; these are the pieces the next increments train and run in shadow. - learn/features: a WindowSummary accumulated from a window's events (exec locations, memfd/deleted/uid0 execs, depth, connection classes and ports, persistence and drop writes, ptrace, module loads, scan outcomes, capped surprisal per tuple kind, bounded tokens) and featurize(): 48 explicit features scaled to about [0, 1] plus signed hashing of tokens into 208 dims, with the governor level and budget left as context. A window's own detections are never features: they are the teacher labels. - learn/mlp: 256 -> 128 -> 64 ReLU with a policy head over the inspection actions (none, memory_scan, deep_rescan, watch_subtree, rescan_on_next_rules) and a value head. Scalar reference, AVX2+FMA chosen at runtime, NEON on aarch64; safe default (no inspection) on a wrong input size or an inconsistent model. Deterministic init per seed. - learn/model_file: "SBMD" format with bounded dimensions, exact length, a sha256 trailer and finite weights checked on load, each failure named; atomic save into a 0700 directory. Tests: test_model (kernels against scalar for arbitrary sizes, forward pass invariants, deterministic init, round-trip, every flipped byte and truncation rejected, non-finite weights rejected, features bounded and deterministic). fuzz_model_file. NEON is built and tested only on aarch64. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
cedd7e7ad9 |
test_cli: completions list --yes for doctor fix
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
Fixes the test left failing by
|
||
|
|
47c3af735c |
CLI: exit code 3 for "could not run here", confirm destructive actions
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
Decided 2026-10-27 (docs/cli-ux.md): - Exit codes: 0 done/healthy, 1 negative result (unhealthy, not found, daemon refused), 2 usage, 3 could not run here (daemon unreachable, permission denied, store not readable, feature not built). Daemon unreachable used to exit 2, like a usage error. - Process kill/suspend, quarantine, allowlist-add, protection-set to enforce, store compact and doctor fix (without --dry-run) say what they will do and ask "Proceed? [y/N]" on a terminal; Enter or EOF is no. Without a terminal they need --yes, else exit 2 with nothing done. This applies to the flag form too (--policy-set process-kill ...). The desktop app talks to the control socket directly and is unaffected. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
bf1e779706 |
CLI: safe terminal output, completions, no accidental daemons; UX guide
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
- Evidence strings are attacker-controlled: every CLI command's stdout and stderr now pass through a filter that shows control characters (C0, DEL, C1) and invalid UTF-8 as \xNN (src/term_safe.hpp), so a crafted process name or path cannot inject terminal escape sequences. The daemon's journal output is unchanged. - `strawberry` alone prints help; an unknown word (`strawberry fix`) is an error with a "did you mean" hint. Both used to start a daemon as the calling user with the word as its config path. Config paths (contain '/' or end in .conf) still run the daemon, for older units. - Shell completions generated from the command table: `strawberry completion bash|zsh|fish`; install.sh installs them under /usr/local/share. - One correlation pass at daemon start (stored findings catch up with the current rules, e.g. stable ids), and retire-superseded-findings correlates first, so replacements exist before old copies are retired. The user's first run reported "no duplicates" for that reason. - docs/cli-ux.md: CLI UX rules adapted from yams (grammar, flags, human and JSON output, status words, security rules for output, help and completions, adding a command, known gaps). Exit code 3 and confirmation prompts are proposed there, pending a decision. AGENTS.md and CLAUDE.md point to it. tests/test_cli.cpp: bare and unknown words, terminal_safe and the stream filter, completion scripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
fb6b905860 |
CLI: yams-style commands, with doctor and doctor fix
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
strawberry [--config PATH] [--json] <command> [<subcommand>] [args] [--flags] status, doctor, doctor fix <action>, daemon run, findings list/show/ correlate, process search/trace/trace-node/suspend/resume/kill, scan file/processes/memory, rules reload/update/check/fetch, policy show/set, opensnitch enable-checksums, store verify/compact, replay, demo seed, help [command], version. One table in src/cli_commands.cpp defines each command (words, positionals, flags, help) and how it maps onto the existing flag form, which main() still parses; help is generated from the same table. Unknown options and wrong arity print the command's usage. Process actions validate node ids before building their JSON payload. The older flag form (strawberry --status, strawberry <config>) still works. The systemd units now run `strawberry daemon run --config ...` and `strawberry rules fetch --config ...`. README, AGENTS.md and the false-positive guide use the command form. doctor renders the daemon's checks with their fixes; doctor fix runs a maintenance action (with --dry-run). Against an older daemon the CLI says to reinstall rather than "unknown command". replay explains that telemetry is root-only instead of reporting zeros, and keeps config output out of --json. tests/test_cli.cpp: translations, flag-form passthrough, errors, help. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
b55723547d |
Add doctor checks and maintenance actions to the daemon
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
- doctor (control verb, read-only): store health and disk floor, telemetry growth per day and days until the floor when retention is unlimited, leftover store files, superseded findings, retro-hunt state, thread/write errors, logs (journald rotates them), model (none yet). Each check carries a maintenance action or advice. Pure checks over gathered inputs (src/doctor.cpp), so they test without a daemon. - maintain (control payload verb, privileged, rate limited, audited): retire-superseded-findings and clean-store, each with dry_run. - finding_retired evidence record: removes a finding from view; it stays in the stream's history. CorrelationEngine::superseded_findings finds old hash/rule findings by recomputing the stable id, and old lineage findings only when the current one's parent process is among their nodes (a reused pid on another boot is not a match). Lineage findings now record parent_process_node_id. - store::inspect_store_files / clean_store_leftovers: orphan/ files older than N days and *.compact / MANIFEST.tmp temp files; never a listed segment. Tests: test_doctor (check statuses, superseded detection including pid reuse and no-replacement cases, retirement surviving a reopen, cleanup keeping recent orphans and listed segments); daemon test exercises both verbs over the socket. fuzz_evidence_records covers finding_retired. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
d54d987b3a |
Retro-hunt: re-scan binaries seen before when the rules change
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
The main source of teacher labels over time: rules improve daily, while most malware runs once. - The pipeline remembers every binary that ran (image_seen evidence record: sha256, path, first/last seen, size; at most one write per hash a day). Deleted and memfd images are skipped: nothing to find again. - Each rules load computes a digest of the rule files and IOC hash lists (paths after resolving symlinks, sizes, mtimes). - RetroHunter (src/retro_hunt.cpp, own thread, idle priority, paced at retro_hunt_pace_ms, deferred by the governor as WorkClass::retro_hunt) re-scans when the digest differs from the last completed pass, most recently seen first. Only paths that still hold the same content are scanned (O_NOFOLLOW, regular files, hash compared); others count as changed or missing. A completed pass is recorded (retro_hunt record) so a restart does not repeat it; an interrupted one starts over. - New matches (rules not recorded before for that hash, not allowlisted) become indicators with scan_kind retro_hunt, a file/indicator graph link, a positive label and a notification. Correlation turns them into findings titled "YARA match on a binary that ran here (found after a rules update)". Nothing is blocked or contained from here. - Replay reads positive labels from the evidence stream and marks windows that ran a binary labelled bad later (LATE in the CLI). - Status: a retro_hunt block (API_CONTRACT.md); config: retro_hunt, retro_hunt_pace_ms. Tests: test_retro_hunt (remembered once; passes only on a digest change and survive a restart; a clean-at-exec binary matching a new rule becomes an indicator, label, finding and notification; a replaced binary is counted as changed, never scanned as the old one; a stop abandons a pass unrecorded); test_replay R9 (late labels, from a real store). fuzz_evidence_records covers the new records. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
da41b04512 |
Replay: say how much history there is when traces cannot be injected
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4e25666a70 |
Inject scripted attack traces into replay and score them
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
- src/learn/trace.cpp: a small trace format (exec, connect, write, ptrace, module with +offsets and process aliases) compiled to telemetry records with pids above any pid_max and node ids that name the trace and copy. - --replay --inject FILE [--inject-copies N]: copies are spread evenly over the ranked history (a first pass reads the time range), scored but never learned from, and checked against alert budgets of 1, 3 and 10 per day: is the copy's best window above the (budget x days)-th best real window? Ties count against. Injection leaves real windows and their ranking unchanged. - config/traces/standard.trace: the six plan traces (browser to curl|sh, systemd user persistence, memfd loader, ptrace injection, download then exec, python from a PDF viewer). - docs/evaluation/stage3-rarity-preregistration.md: method and pass thresholds, written before any run on host data. Tests: test_trace (standard traces, error messages with line numbers, records); test_replay R8 (every copy found, real ranking unchanged, a novel chain caught at 10/day and a bare shell not). fuzz_trace_dsl. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
5fa2031c62 |
Replay: reorder over 2 minutes, not 30 s
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
On the host, 586 of 303k records arrived more than 30 s late: exec records of large images are written after their paced, deferrable scan. Replay is offline, so holding 2 minutes of records costs nothing that matters. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
6fa5e68405 |
Make replay rankings fair over time and readable
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
From the first replay of real host data (3.5 h, 266k records):
- A never-seen event scored higher the more the model had seen, so the
ranking favoured whatever happened last (the reinstall's systemctl
and generator runs). Each event is now capped at 16 bits (never
seen), and a window scores the sum of its three most surprising
distinct events.
- Warm-up: on a fresh history nearly everything is new. Windows in the
first 12 h are learned from but not ranked (--warmup H); detections
are always listed. The CLI says so when nothing is ranked yet.
- Windows with the same root program and top pattern are one line with
a count ("x40 similar").
- Counts: file writes split by persistence; events from processes
started before recording are reported as such, not as an error;
records more than 30 s out of order are counted as late.
tests/test_replay.cpp R7: warm-up, equal scores for a novel event early
and late, grouping, late-record counting.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
||
|
|
92cb4e9ba8 |
Add --replay, and keep non-UTF-8 host strings from breaking JSON
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> |
||
|
|
134aebf7a9 |
Add the tokenizer and rarity model for the learning stages
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
src/learn/ (pure libraries; nothing in the daemon calls them yet, Stage 3 uses them in replay): - tokenize: path templates (user homes, per-uid dirs, pids, digit and hex runs, UUIDs, mktemp-style names abstracted) and command-line shapes (flags kept, values, paths, URLs, IPs, numbers and encoded blobs classed; the first plain word kept as a subcommand; long argument lists summarized). Bounded and noexcept. - rarity: decayed count-min sketches over parent>child, grandparent> parent>child, exe+command-line shape, exe+connection class and exe+persistence location, scored as surprisal in bits; a bounded first-seen table; deterministic hashing for replay. About 1.3 MiB. tests/test_learn.cpp: tokenizer cases and idempotence; count-min never underestimates (also after decay); determinism; rare scores above common; half-life decay; bounded first-seen. fuzz_tokenizer found two idempotence bugs (truncation before templating, and a cut that left a " (deleted)" suffix), fixed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
72d239dee9 |
Give hash, rule and lineage findings one stable id each
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
Their ids included the member pids (and rules or hashes), so every new process joining a group created a new finding and left the previous one behind as a duplicate. The id is now the group key alone: the hash, the rule name, or the parent process. The finding is updated in place as the group grows; the pids stay in its metadata and summary. Findings stored under the old ids stay as they are (one last duplicate per group after upgrading). The incremental property test now also checks that add-only runs leave exactly one finding per group. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
e746eaa70d |
Correlate incrementally: rebuild only the groups that changed
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
Every finding is a function of one group of indicators (a process, a parent, a hash or a rule). IncrementalCorrelator keeps group membership (ids and keys, not indicator contents) and rebuilds only the groups that new or changed indicators touch. Each pass used to copy every indicator and rebuild every finding; it now costs about the size of what changed. - correlation_engine.cpp: the four group loops become per-group functions (re-indented; logic unchanged), shared by the full pass and the incremental one. - EvidenceView keeps a bounded change log of written indicator ids (resets after clear(), at first use, or past 65536 entries); Database::take_indicator_changes / find_indicators expose it, with rolled-back writes reported as removed. - DetectionPipeline holds its lock only to read changes and members and to store findings, as before. Fix found by the oracle test: an indicator naming a process node but no pid formed a second group for the same process with the same finding id, and the two findings overwrote each other. The group pid now comes from the node id when the pid is missing (finding ids are unchanged). tests/test_correlation_incremental.cpp: random batches of new and updated indicators give exactly the findings the full pass after every batch stored (I1, I2); a batch touching one process rebuilds only its groups (I3); the store's change log, including a rolled-back write. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
4366a368bb |
Document the telemetry and command-line redaction settings
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
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
c452be93d4 |
Unify file ids, record uid/comm, redact command lines
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
File node ids: include/strawberry/node_ids.hpp is now the only place they are built (file_<sha256> or file_path_<sha256 of path>). The three modules disagreed: correlation used a 16-digit path hash and behavior detections the raw path, so path-keyed evidence never met the rest. An exec detection with a known hash also writes a same_path edge from the path id to the content id. Source invariant R8 rejects hand-built file ids in src/ and include/. Processes carry the real uid and kernel comm: from the eBPF exec event (which now includes the uid) or /proc. Stored on process nodes and in process_exec telemetry (fields 14, 15). Command lines are redacted before any storage (capture_redact_cmdline, default on): sensitive flags and KEY=value pairs, Authorization/Bearer credentials, URL passwords, tokens used as URL user names, well-known token shapes (GitHub, GitLab, Slack, AWS key ids, sk-, JWTs) and mysql -p<password>. The rules repeat to a fixed point, so redaction is idempotent by construction. tests/test_redact.cpp covers the rules plus idempotence, size and planted-secret properties; fuzz_cmdline_redactor found two idempotence bugs and a leak (--password --token X) that are fixed here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> |