-
Notifications
You must be signed in to change notification settings - Fork 38
fix: restrict config file permissions to owner only #72
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -107,9 +107,12 @@ function readConfigFile() { | |
| // Write the full multi-profile config structure | ||
| function saveConfigFile(data) { | ||
| if (!fs.existsSync(CONFIG_DIR)) { | ||
| fs.mkdirSync(CONFIG_DIR, { recursive: true }); | ||
| fs.mkdirSync(CONFIG_DIR, { recursive: true, mode: 0o700 }); | ||
| } else { | ||
| fs.chmodSync(CONFIG_DIR, 0o700); | ||
| } | ||
| fs.writeFileSync(CONFIG_FILE, JSON.stringify(data, null, 2)); | ||
| fs.writeFileSync(CONFIG_FILE, JSON.stringify(data, null, 2), { mode: 0o600 }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This call only enforces Useful? React with 👍 / 👎. |
||
| fs.chmodSync(CONFIG_FILE, 0o600); | ||
| } | ||
|
|
||
| // Helper function to validate CLI-provided options | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
mkdirSync(..., { recursive: true, mode: 0o700 })does not correct permissions on an already-existing~/.confluence-clidirectory, so installs with older/broader directory modes (for example0755) keep those permissions and are not fully hardened. Add an explicit chmod for the existing directory case.Useful? React with 👍 / 👎.