Skip to content

πŸ›‘οΈ Sentinel: [CRITICAL] Fix path traversal in snapshot commands#23

Open
bitcoiner-dev wants to merge 1 commit intomasterfrom
fix-snapshot-path-traversal-11716124318840448427
Open

πŸ›‘οΈ Sentinel: [CRITICAL] Fix path traversal in snapshot commands#23
bitcoiner-dev wants to merge 1 commit intomasterfrom
fix-snapshot-path-traversal-11716124318840448427

Conversation

@bitcoiner-dev
Copy link
Copy Markdown
Owner

🚨 Severity: CRITICAL
πŸ’‘ Vulnerability: Path traversal in snapshot save and restore commands. 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 .json files on the filesystem (if formatted as a valid profile) via snapshot restore or overwrite arbitrary files via snapshot save.
πŸ”§ Fix: Implemented a strict allowlist character validation function crate::utils::validate_file_name that permits only alphanumeric characters, dashes, and underscores. Applied this validation to both snapshot save and snapshot restore commands 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 an Invalid 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

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>
@google-labs-jules
Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant