Skip to content

🛡️ Sentinel: [HIGH] Fix ZIP extraction bypass by using sanitized filename#320

Merged
madara88645 merged 1 commit into
mainfrom
sentinel-fix-zip-extraction-4218338266362141345
May 12, 2026
Merged

🛡️ Sentinel: [HIGH] Fix ZIP extraction bypass by using sanitized filename#320
madara88645 merged 1 commit into
mainfrom
sentinel-fix-zip-extraction-4218338266362141345

Conversation

@madara88645
Copy link
Copy Markdown
Owner

Severity: HIGH | Vulnerability: Unvalidated ZIP members | Impact: Path traversal bypass | Fix: Used return value of normalize_uploaded_filename | Verification: pytest tests/test_upload_security.py


PR created automatically by Jules for task 4218338266362141345 started by @madara88645

@google-labs-jules
Copy link
Copy Markdown

👋 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.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
vibegraph Ready Ready Preview, Comment May 11, 2026 11:11pm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the /api/upload-project ZIP upload path by unifying ZIP member filename validation with the existing normalize_uploaded_filename() utility, aiming to prevent ZIP slip/path traversal bypasses and keep upload sanitization consistent across multipart and ZIP uploads.

Changes:

  • Use safe_filename = normalize_uploaded_filename(member.filename) for ZIP members before joining/realpath containment checks.
  • Remove the inline “sensitive hidden names” blocklist from the ZIP loop in favor of the centralized normalizer.
  • Add a new security-learning entry to .jules/sentinel.md documenting the vulnerability and prevention guidance.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
app/routers/upload.py Switch ZIP member extraction to use the sanitized filename from normalize_uploaded_filename() for path building and validation.
.jules/sentinel.md Document the ZIP extraction validation issue and the intended prevention strategy.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/routers/upload.py
Comment on lines 143 to +144
try:
safe_filename = normalize_uploaded_filename(member.filename)
Comment thread .jules/sentinel.md
Comment on lines +36 to +39
## 2025-05-11 - Zip Extraction Path Traversal and Sensitive File Bypass
**Vulnerability:** The ZIP extraction logic in `app/routers/upload.py` implemented custom, inline path traversal and sensitive file checks that differed from the application's standard file upload validation. This could potentially allow bypasses if edge cases were missed. Additionally, the standard normalizer (`normalize_uploaded_filename`) can be misleading if its return value is ignored.
**Learning:** Security validation logic must be unified across all upload paths. Implementing separate inline checks for ZIP members creates an inconsistent security boundary. Furthermore, when using a normalizer, it is critical to use its *return value* as the finalized path. Calling a normalizer but continuing to use the raw unsanitized input path completely bypasses the intended security sanitizations.
**Prevention:** Unify validation logic by always calling the core `normalize_uploaded_filename()` utility on extracted ZIP members, and explicitly using its return value (`safe_filename = normalize_uploaded_filename(...)`) for all subsequent path operations to enforce a single, robust security boundary.
@madara88645 madara88645 merged commit d340ef5 into main May 12, 2026
12 checks passed
@madara88645 madara88645 deleted the sentinel-fix-zip-extraction-4218338266362141345 branch May 12, 2026 19:44
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.

2 participants