Skip to content

Commit b7c3b06

Browse files
🛡️ Sentinel: [HIGH] Fix insecure directory creation permissions for snapshots
Severity: HIGH Vulnerability: `src/commands/snapshot.rs` uses `std::fs::create_dir_all` to create the snapshot directory. This relies on the default system umask, meaning sensitive snapshot files could be stored in a directory readable by other users on a shared machine. Impact: Local privilege escalation or exposure of sensitive user data on a shared machine. Fix: Replaced `std::fs::create_dir_all` with `crate::paths::create_secure_dir_all`, which correctly creates the directory with `0o700` permissions on Unix platforms. Verification: Ran `cargo test` which completes successfully. Co-authored-by: bitcoiner-dev <75873427+bitcoiner-dev@users.noreply.github.com>
1 parent 25d33d3 commit b7c3b06

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎src/commands/snapshot.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::fs;
77
pub async fn run(cli: &Cli, args: &SnapshotArgs) -> Result<CommandOutput, AppError> {
88
let profile_path = profile_path(cli)?;
99
let snap_dir = snapshot_dir(cli)?;
10-
fs::create_dir_all(&snap_dir)
10+
crate::paths::create_secure_dir_all(&snap_dir)
1111
.map_err(|e| AppError::Config(format!("failed to create snapshot dir: {e}")))?;
1212

1313
match &args.action {

0 commit comments

Comments
 (0)