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>
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>
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>
`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>
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>
- 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>
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>
Nothing shipped used the library after the event store landed. A small
reader/writer for its file format (src/store/legacy_kv) replaces it for
the legacy code, and the submodule, subproject and library test are
removed.
A writer open now imports a legacy database.db file into the event
store: indicators are replayed in an order consistent with the old
hash/rule indexes, the result is verified against the old file, the
old file is kept as database.db.migrated-<ts>, and an import
interrupted between its final renames is finished on the next open.
Read-only handles read a legacy file directly and switch to the store
once it is imported. Ids re-stored under another hash are reported
(their old index entries cannot be carried over).
Tests: legacy import properties I1-I6 (locked and corrupt files are
left untouched), the differential test now shares its comparisons, and
fuzz_legacy_kv covers the file parser. A copy of a real 137 KB legacy
database imported cleanly into 7 KB.
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>