FLT-359 fix round 4 (Cedric): re-gate findings¶
The findings are in docs/review-r5/. Andrew chose to fix these before landing (2026-10-31).
Constraints, same as before: - Approvals stay disabled by default. - No network, no secrets, no fleet wiring. - Clahadore commits. Don't push. - Write a red test first for every bug. If a test genuinely can't run on this OS, say so plainly.
High¶
- Ledger path swap / ancestor junction (Gronktayvius Red Team,
SqliteApprovalLedger.cs:30,49). - Reject reparse points and symlinks on every path component from the volume root, not only the leaf.
- Open the parent with no-follow semantics:
- Windows:
FILE_FLAG_OPEN_REPARSE_POINT, and refuse any reparse tag. - Unix:
O_NOFOLLOW | O_DIRECTORY.
- Windows:
- Create and open the database relative to that verified handle where .NET allows it. Otherwise re-verify identity after opening.
- Persist the file identity (Windows file ID plus volume serial; Unix device plus inode), the owner and the mode. Every later Open refuses the file if any of them differ.
- Tests: a junction in an ancestor folder is rejected; swapping the database file between opens is detected (identity mismatch), and fails closed.
- Initialize must not modify an existing directory (Gronktayvius General,
SqliteApprovalLedger.cs:40-45). - Check all preconditions first: no reparse point anywhere, owner OK, and empty, before any ACL or mode change.
- Create a brand-new directory with its security descriptor in the same create call (
DirectorySecurityoverload /CreateDirectorywith ACL;mkdirmode 0700). - If a re-check after locking finds entries, fail without having altered a pre-existing folder.
- Test: pointing it at an existing non-empty directory leaves that directory's ACL and mode unchanged and throws.
- Outbox marker atomic publish (Gronktayvius General,
Notifications.cs:167-170). - Write a temp file, fsync it, then do an atomic rename onto the marker path (no overwrite).
- On a write, flush or rename failure, delete the temp file and don't treat the notification as sent.
- Only a renamed marker counts as "already notified".
- Test: an injected write failure followed by a retry sends the notification.
P2 and Medium¶
- The size limit must survive a round trip (Cedric,
Models.cs:118-119). Apply the byte limit to the canonical serialized form at initial validation, so anythingParseaccepts also passesParse(Serialize(x)). Test: Cedric's reproduction (64-char<labels, 4 target fields, 8 recipients) is rejected up front, and a just-under-limit action round-trips. - Sanitize the push text (Gronktayvius Red Team + General,
TwilioProvider.cs:45,Models.cs:103). Replace control characters, bidi overrides (U+202A–U+202E, U+2066–U+2069), zero-width characters, U+2028/2029 and newlines inEffectBinding/HumanSummarybefore building the device message. The hash still covers the original canonical action. Test: a bidi-override and newline-injected fakeTarget:line can't appear as its own line in the device text. - Any other Medium in
docs/review-r5/*.mdyou agree with. Respond to each item indocs/review-r5/RESPONSES.md.
Verify¶
dotnet build --no-restore -warnaserroranddotnet test --no-restore. Use-p:OutputPath=bin/R6/if locked.- In the final message: the red-first bugs, the changes, the real output tails, and anything that can't be tested on Windows (e.g. the Unix no-follow path).