Repository navigation
fix(cli): create exports owner-only and make connect's config write safe - #1678
Merged
Merged
Conversation
…afe (#1668) namespace migrate's export and uteke export are created 0600 on Unix. connect's temp config is created with the original file's mode from the start, and a config changed between read and rename is not overwritten.
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
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
uteke_core::private_file::create_private: creates a file with mode 0600 on Unix (default elsewhere); withreplaceit tightens an existing file's mode before truncating it.namespace migrate's pre-migration export uses it (write_export).uteke export --outputincommands/maintenance.rs, both the plain and the--fullbranch. Nothing else in the repo writes a store export (the hook log, init and upgrade files hold no memories).connect'swrite_atomiccreates its temp file with the original file's mode (0600 when there is none) from the start, then restores the exact mode; a leftover temp is removed first so a planted symlink is not followed. Before the rename it re-reads the target and compares it with what was read: if another program changed it (or created it), nothing is written and the error says so, and the temp file is removed. The manifest write goes through the same check.docs/cli-reference.mdand CHANGELOG updated.namespace migrateandconnectare unreleased, so no compatibility shim; theuteke exportchange only tightens permissions.Why
The export holds every memory and was typically 0644; a private
~/.claude/settings.jsonwas briefly readable while the temp was written; and a concurrent write by the agent between read and rename was silently lost.Closes #1668
Testing
create_private(new, replace, must-not-exist), thenamespace migrateexport, anduteke export --outputover an existing 0644 file; the connect temp file's mode at creation (checked while the handle is open), including the no-original case and the leftover-symlink case.cargo fmt --check,cargo clippy -D warnings.