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.
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.
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>
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>
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>
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>
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>
Teacher signals and context for the learning stages, written to the
evidence stream (retention never removes it):
- label: operator actions from the control socket (quarantine, contain,
kill, suspend: positive; allowlist-add: negative; allowlist-remove and
quarantine-remove: retracted) and allowlist suppressions (negative,
once per entry, subject and rule). Never from the MCP.
- rules_generation: every rules load attempt, with sources, counts and
the error of a failed reload.
- policy_generation: each policy change, with a sha256 of the policy.
- lifecycle: daemon start and stop.
governor_sample (pressure level, CPU/IO/memory, per-class admissions) goes
to the telemetry stream once a minute.
Database::append_evidence writes records the evidence view ignores.
Tests: record round-trips; suppression labels and dedupe and rules
generations in the pipeline test; operator labels, policy generations and
lifecycle in the daemon test; the record fuzzer covers the new decoders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Stage 2 increment 1. Until now only detections were stored, so the
learning stages would never see a normal example.
- TelemetrySink: bounded lock-free multi-producer queue (8192); try_emit
never blocks, allocates or throws; a full queue drops and counts.
- A guarded writer thread drains it every 2 s (or at a quarter full)
into the store's root-only telemetry stream through the pipeline,
writing a gap record whenever events were dropped.
- The pipeline emits one process_exec (pid, parent, node ids, exe,
capped cmdline, sha256, deleted/memfd, live/inventory) and one
scan_result (outcome: scanned, cache_hit, too_large, unavailable,
read_error, no_rules, yara_error, pid_scan; bytes, scan time, rules
generation, matched rules) for every handled exec, detection or not.
- Config telemetry=true (default); status gains a telemetry block
(emitted, dropped, queued, written, gaps).
Tests: C1 (never blocks; exactly once and in order under concurrency,
clean under ThreadSanitizer), record round-trips, C2 (one process_exec
and one scan_result per handled exec, stored in the telemetry stream);
fuzz_telemetry_records.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The KPI detect phase still dropped events after the correlation fix.
Cause: every detection kept ~12 KB of evidence in memory, 20k detections
pushed RSS past the 512 MB budget, the governor went to emergency, and in
emergency every live exec scan waited 5 s, so the queue overflowed and
stayed full (memory that is evidence never comes back by waiting).
- The governor holds live exec scans for at most 5 s per emergency
episode, then lets them run (counted as forced); background work still
waits.
- Repeated detections of the same image and rules: the first 20 per
10-minute window are stored in full, then one summary indicator per
key keeps the count and first/last pid and time (rewritten at most
every 30 s). All detections are counted; alerts repeat at most once a
minute per key. Status reports pipeline.repeats_aggregated.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per the triage decisions:
- DeletedExecutable when a new file exists at the executable's path (an
update or reinstall) is stored as evidence only. A binary with nothing
left at its path still raises a low finding.
- scripts/install.sh writes /var/lib/strawberry/installed-files.sha256
(hashes of the units it installs, root-owned, written first). A
PersistenceWrite whose file matches its listed hash is evidence only;
other content at those paths, or a suspicious writer, is reported as
before. The daemon ignores a manifest that is not root-owned or is
group/world-writable.
Evidence-only indicators make no finding, alert or containment on their
own; correlation counts them when the same process has another signal.
Status reports pipeline.evidence_only. Tests cover the manifest, the
behavior hook, correlation and the pipeline (replaced vs deleted).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Triage of all 26 findings on a developer workstation (none malicious)
is in docs/false-positives.md: binaries replaced while running
(auto-updates, reinstalls), Strawberry's own installer writing its
systemd units, sanitizer/self-debugging ptrace, deliberate tests, and
the test marker matching process memory.
Fixes:
- behavior detections now honor path and rule allowlist entries (they
only checked sha256, which is computed for high severity only)
- finding summaries include what happened (file written, ptrace
target) and metadata.details
- Strawberry_Test_Marker only matches files that start with the marker
(EICAR-style); it no longer fires on processes holding the text
- ptrace between a parent and child running the same binary
(LeakSanitizer StopTheWorld) is low instead of medium; ProcessRef
carries the parent pid
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wire the policy, feeds, containment, exec guard, behavior, governor,
crash safety and event store into the daemon, detection pipeline, CLI
and meson build (zstd now required); Dockerfile, conan, systemd unit
(LimitCORE=0, resource limits) and installer updates; existing tests
adapted (store paths are directories now). Detections are counted and
notified even when evidence cannot be persisted (persist_failures in
status). prevention_timeout_ms is clamped and behavior dedupe handles
out-of-order events. Docs: API contract, developer guide, plan, UX,
agent rules.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>