π‘οΈ Sentinel: [CRITICAL] Fix Path Traversal in profile and snapshot handling#43
π‘οΈ Sentinel: [CRITICAL] Fix Path Traversal in profile and snapshot handling#43bitcoiner-dev wants to merge 1 commit into
Conversation
User-provided `profile` and `snapshot` names were directly passed into `Path::join` without validation, making the CLI vulnerable to critical path traversal attacks (e.g. `../../../etc/passwd`). Introduced a robust `validate_file_name` utility function to enforce an allowlist of safe characters (alphanumeric, dashes, and underscores) and added explicit checks in `src/paths.rs` and `src/commands/snapshot.rs`. Co-authored-by: bitcoiner-dev <75873427+bitcoiner-dev@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
π¨ Severity: CRITICAL
π‘ Vulnerability: Path traversal vulnerability in profile and snapshot path resolution.
Path::joininherently replaces paths or navigates backward when provided with absolute strings (/) or relative (..) constructs, which wasn't restricted for command-line inputs.π― Impact: A local user or automated process executing the CLI could perform arbitrary file reads/writes on the system under the permissions of the user running the tool if an attacker crafts malicious CLI arguments (e.g.
zinc-cli snapshot save --name ../../../etc/passwd).π§ Fix: Implemented strict validation for the
profileand snapshotnamestrings to only permit alphanumeric characters, dashes, and underscores usingcrate::utils::validate_file_name.β Verification: Tests run successfully (
cargo test --bin zinc-cli). Specifically addedtest_validate_file_namecoverage.PR created automatically by Jules for task 2944430463881924379 started by @bitcoiner-dev