`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>
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>
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>
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>