Fix slipery zip extraction - #4592
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThe changes add filename-specific request validation. ZIP extraction now tracks a canonical extraction root and constrains destinations and entry paths to that root. ChangesSecurity validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Poem
🚥 Pre-merge checks | ❌ 1❌ Failed checks (1 warning)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 7b89acce-5f74-480a-a81a-0313bb5b04ff
📒 Files selected for processing (4)
app/Http/Requests/Photo/UploadPhotoRequest.phpapp/Jobs/ExtractZip.phpapp/Rules/FilenameRule.phptests/Unit/Rules/FilenameRuleTest.php
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 635e74c3-329a-4969-82fb-98944bd918eb
📒 Files selected for processing (4)
app/Jobs/ExtractZip.phpapp/Rules/FilenameRule.phpapp/Services/Zip/SafeZipExtractor.phptests/Unit/Rules/FilenameRuleTest.php
🚧 Files skipped from review as they are similar to previous changes (2)
- app/Rules/FilenameRule.php
- tests/Unit/Rules/FilenameRuleTest.php
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/Unit/Jobs/ExtractZipTest.php (1)
71-78: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick winCover extraction-time destination enforcement.
callValidateZip()only invokesvalidate_zip(). The destination constraint is exercised when extraction writes throughSafeZipExtractor. Add a focused test for an allowed destination and a destination outside the canonical extraction root, or add a dedicatedSafeZipExtractorunit test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f8eb2650-2737-4887-8518-aff779b94577
📒 Files selected for processing (1)
tests/Unit/Jobs/ExtractZipTest.php
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
Alpastx
left a comment
There was a problem hiding this comment.
the updated PR looks good. The pre-create realpath issue is addressed, and FilenameRule + base-dir containment in SafeZipExtractor close the reported path.
Summary by CodeRabbit
Bug Fixes
Tests