Repository navigation
v0.6.0
Security hardening from a review of the whole package, and a cleaner repository layout. The layout change moves no exported identifier: import paths, the API and every log line are unchanged.
Modules released: core v0.6.0, otelflightrec/v0.3.1 and grpcflightrec/v0.3.2 (READMEs for pkg.go.dev only). notifier/redisnotifier and notifier/natsnotifier are unchanged at v0.3.0.
Changed
- With OpenTelemetry middleware inside
HTTPMiddleware, a scope keyed by a request header (traceparent,X-Trace-Id,X-Request-Id) takes the server span's trace ID when the span starts, as a generated ID already did, so logs and spans agree in either middleware order. The header ID stays an alias: notifier notices for it still reach the scope (and its child scopes), failures are announced under both IDs, the per-trace cap of retained scopes applies to both, and flushed records and the summary line carry it asflightrec.request_id. The adoption is journaled, so recovered records carry the same IDs (#96). - Repository layout: the root package is organised by concern in 10 files, with machinery in
internal/(traceid,snapshot,notify,journal); community files moved to.github/,RELEASING.mdtodocs/, and the demo toexamples/demo.
Security
StartJournalrefuses a lock file (path.lock) that is not a private regular file of the current user with one link, instead of locking a file another user planted.- New guide, Running flightrec safely: settings for public-facing services, notifier authentication and channel permissions, sensitive data, where to put the journal, and resource limits.
- With
RetainorStartJournal,slog.Anyvalues were copied as JSON only, soslog.TextHandlerand other handlers that print values withStringorMarshalTextshowed the raw value: a type that redacts itself inString(a password type printing***) leaked once either feature was on. Copies now keep both renderings, made as slog's handlers make them (a nil pointer prints<nil>instead of panicking). Journals written by this version store both; an earlier version cannot recover records withslog.Anyvalues from them, so recover before rolling back. - Copied
slog.Anyvalues are capped at 64 KB each, and copying forRetainstops once a scope's copies exceedMaxRetained, so large values cannot make retention allocate far beyond its limits. WithSigningKeyauthenticates notifier messages with HMAC-SHA256 and a timestamp; unsigned, forged and stale messages are rejected. Without it, anyone who can publish on the notifier channel can trigger flushes in every service.