Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The modem stack's private files (its change journal, policies and data-usage records) can briefly expose their contents while a temporary file is being written, and saving ownership metadata leaves an existing readable lock file readable. Bun can ignore the requested file mode, and Node only applies it when it creates a file, so "owner-only" isn't actually guaranteed. A stale temporary symlink can also redirect a policy write into another file.
What
How: a shared internal writer (
control/src/private-file.ts) opens files with an explicit 0600 mode and sets permissions on the open file before writing. The journal stays append-only and the flock ownership stays on the same file; the certification command uses the same order inside the CLI package.How to verify
Run the new and changed tests, for example
control/src/private-file.test.ts,cli/src/commands/certify-permissions.test.tsand the policy, usage and journal store tests. They check file permissions, symlink and FIFO refusal, tightening of an existing journal and cleanup of old temporary files.Testing and limits
Risks
Low. A tool that read these files as another user would now be refused; nothing in the stack does that.
Checklist