π‘οΈ Sentinel: [HIGH] Fix Zip Slip path traversal vulnerability in skills import#148
Conversation
Added defense-in-depth against "Zip Slip" (path traversal) vulnerabilities during the extraction of zipped skill directories in `helpers/skills_import.py`. Iterates through `z.namelist()` and ensures that each extracted file resolves to a path that is strictly relative to the target extraction directory. Co-authored-by: thirdeyenation <133812267+thirdeyenation@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: HIGH
π‘ Vulnerability: Unsafe extraction of ZIP archives in
_unzip_to_temp_dir(helpers/skills_import.py) allowing path traversal (Zip Slip) viaz.extractall(target)without properly checking member paths.π― Impact: Maliciously crafted ZIP archives could contain relative path specifiers like
../to extract and overwrite files outside the intended temporary extraction directory, potentially leading to arbitrary code execution or file corruption elsewhere in the system.π§ Fix: Modified
_unzip_to_temp_dirto iterate throughz.namelist(), calculate the resolved absolute path for each member, and strictly verify usingpathlib.Path.is_relative_to()that the resolved path falls within the intendedtargetdirectory. If a path escapes the target directory, it raises aValueErrorrejecting the archive.β Verification: A temporary test script was written and executed verifying that a ZIP containing
../evil.txtcorrectly triggers theValueErrorexception and halts extraction without deploying the file. Cleaned up the testing code.PR created automatically by Jules for task 11254959432677005139 started by @thirdeyenation