fix(snapshot): age-guard stale tmp cleanup; tighten .env filter (#408, #410)#416
fix(snapshot): age-guard stale tmp cleanup; tighten .env filter (#408, #410)#416
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3ca345a32c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (basename.len >= 4 and std.mem.eql(u8, basename[0..4], ".env") and | ||
| (basename.len == 4 or basename[4] == '.')) return true; |
There was a problem hiding this comment.
Restore .env secret filtering in path checks*
The new .env predicate only matches exact .env or .env.-prefixed names, so files like .envrc (commonly used to hold environment secrets) are now treated as non-sensitive and will be indexed/searchable; the same narrowed check was added in src/snapshot.zig, so these files can also be persisted into snapshots. This is a security regression from the previous .env* behavior and conflicts with the privacy guarantee in README.md that sensitive .env* files are auto-excluded.
Useful? React with 👍 / 👎.
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
…iles snapshot.zig:cleanupStaleTmpFiles deletes any matching <basename>*.tmp file in the snapshot directory with no age guard. A sibling writer that just created its in-flight tmp gets unlinked by a concurrent loadSnapshotValidated() before it can rename(tmp, dest). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…files snapshot.zig:isSensitivePath uses a raw 4-byte prefix match (`basename[0..4] == ".env"`) to catch .env*, which also rejects legitimate non-secret files like .envoy.json and .environment. These files round- trip incorrectly through writeSnapshot/loadSnapshot — they are silently dropped from the snapshot. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3ca345a to
524bd2d
Compare
Benchmark Regression ReportThresholds: 10.00% and 50,000 ns absolute delta
|
Closes #408, #410. cleanupStaleTmpFiles now skips tmps under ~60s old (preserving in-flight writes). isSensitivePath .env filter requires exact match or '.env.' prefix. Tests pass; suite green.