Repository navigation
fix(cli): create credential files 0600 from the start - #104
Merged
Merged
Conversation
mr-kelly
enabled auto-merge (squash)
October 27, 2026 18:16
mr-kelly
disabled auto-merge
October 27, 2026 18:16
This was referenced Oct 27, 2026
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.
Problem
writeEnvFileAt(apps/busabase-cli/src/config-file.ts) wrote the credential file withwriteFileSyncand only then calledchmodSync(path, 0o600). Withumask 022a first login creates~/.busabase/.envas0644holding the API key. Another local user who can traverse the home directory can open it in that window, and a descriptor opened then keeps working after the chmod.Reported by the Omarchy plugin marketplace reviewer (omacom/omarchy-plugin-marketplace#12549).
Fix
openSync(path, "w", 0o600), so it is never wider than0600.fchmodSyncan already-existing looser file before the new secret is written..envstill points where it did.0700.Tests
New
config-file-perms.test.ts, run underumask 022:.envis born0600(opencalled with mode600), never viawriteFileSync0644file isfchmoded to0600before the write (call order asserted, not just final mode)~/.busabaseis0700.envstays a symlink and the target is tightenedAgainst the previous code 4 of the 5 fail; with this change all pass. Whole CLI suite: 470 passed.
tsc --noEmitand biome clean.Not in this PR
No version bump. Publishing is
publish-npm.ymlon push tomain, so the release version is the maintainer's call (suggest 0.99.2). The Omarchy plugin pins[email protected]and will move to the fixed release once it is on npm.