Skip to content

Potential fix for code scanning alert no. 6: Arbitrary file access during archive extraction ("Zip Slip")#52

Merged
unknowIfGuestInDream merged 1 commit into
masterfrom
alert-autofix-6
Apr 14, 2026
Merged

Potential fix for code scanning alert no. 6: Arbitrary file access during archive extraction ("Zip Slip")#52
unknowIfGuestInDream merged 1 commit into
masterfrom
alert-autofix-6

Conversation

@unknowIfGuestInDream
Copy link
Copy Markdown
Contributor

Potential fix for https://github.com/tlcsdm/eclipse-rcp-example/security/code-scanning/6

To fix Zip Slip safely, normalize and validate each computed output path before any file operation. The best approach here is:

  1. Build a normalized base extraction directory (target.toAbsolutePath().normalize()).
  2. For each ZIP entry, resolve and normalize the output path:
    • resolvedPath = targetPath.resolve(entry.getName()).normalize()
  3. Reject entries whose normalized path does not start with the normalized target base:
    • if (!resolvedPath.startsWith(targetPath)) throw new IOException(...)
  4. Use the validated resolvedPath for directory creation and file copy.

This single validation point addresses all three alert variants (directory creation, parent directory creation, and file copy).
Edits are only needed in bundles/com.tlcsdm.eclipse.rcp.example.python3.win32.x86_64/src/com/tlcsdm/eclipse/rcp/example/python3/Activator.java, within install() around the ZIP extraction loop. No new dependency is required.

Suggested fixes powered by Copilot Autofix. Review carefully before merging.

…ss during archive extraction ("Zip Slip")

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Signed-off-by: 梦里不知身是客 <liang.tang.cx@gmail.com>
@unknowIfGuestInDream unknowIfGuestInDream marked this pull request as ready for review April 14, 2026 03:19
@unknowIfGuestInDream unknowIfGuestInDream merged commit 3e45961 into master Apr 14, 2026
10 checks passed
@unknowIfGuestInDream unknowIfGuestInDream deleted the alert-autofix-6 branch April 14, 2026 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant