π‘οΈ Sentinel: [CRITICAL] Fix path traversal in snapshot commands#23
π‘οΈ Sentinel: [CRITICAL] Fix path traversal in snapshot commands#23bitcoiner-dev wants to merge 1 commit intomasterfrom
Conversation
Implemented `validate_file_name` to strictly check snapshot names and prevent path traversal vulnerabilities (`../`) in the `snapshot save` and `snapshot restore` commands. 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 in snapshot
saveandrestorecommands. The snapshot name parameter provided by the user was concatenated directly with the snapshot directory path without validation, allowing a user to break out of the directory using../.π― Impact: An attacker or malicious script could read arbitrary
.jsonfiles on the filesystem (if formatted as a valid profile) viasnapshot restoreor overwrite arbitrary files viasnapshot save.π§ Fix: Implemented a strict allowlist character validation function
crate::utils::validate_file_namethat permits only alphanumeric characters, dashes, and underscores. Applied this validation to bothsnapshot saveandsnapshot restorecommands before processing the file path.β Verification: Verified by attempting to run
zinc-cli snapshot save --name "../../../../../tmp/hacked"and confirming the program now exits safely with anInvalid input: invalid character in file name: '.'error instead of creating the file. Ran the complete test suite.PR created automatically by Jules for task 11716124318840448427 started by @bitcoiner-dev