Repository navigation
fix(keystore): create private config directories owner-only - #419
Merged
Merged
Conversation
write_private_file now creates every missing directory under the Forge config dir as 0700 (ensure_private_dir is recursive), not only the direct parent, and dg auth export creates its default exports folder the same way. Directories outside the config dir are still never touched. Adds Unix tests for key and directory modes under umask 022 and for a symlink at the destination, and a docs note on Windows ACLs. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 59 minutes. View limit detailsLimit details: You’ve used the included review currently available. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
What
write_private_file(forge-core keystore) now creates every directory it has to make under the Forge config directory as 0700, not only the direct parent.ensure_private_diris recursive (and public sodgcan use it); a directory that already exists is left alone, and paths outside the Forge config directory (for example a folder named with-o) still get the plaincreate_dir_alland are never chmodded.dg auth exportcreates the default<config>/exportsfolder through the same helper, so it is 0700 too. A folder named with-ois not touched.docs/guides/identity-and-keys.mdthat key files are owner-only on macOS/Linux and rely on the user profile's default permissions on Windows, so choose an export location only you can read.Why
Key files were already written 0600 through an exclusive temporary file and an atomic rename. Missing ancestor directories, however, were created with the process umask (typically 0755), so on a shared host the config tree could be listable by other accounts even though the key files were not readable. All directories Forge creates for its own key material are now owner-only regardless of umask.
How tested
Unix tests (umask set to 022 inside the test, serialised and restored):
dg auth exportdefault folder is 0700 (this test uses the process umask, so it fails before the change under the usual 022).The directory-mode tests fail without the change and pass with it.
cargo fmt --checkandclippy --workspace --all-targets -D warningspass; the forge-core, forge-relay and other workspace test suites pass, and the new dg test passes.Limits
🤖 Generated with Claude Code