Skip to content

Conversation

@tausbn
Copy link
Contributor

@tausbn tausbn commented Dec 9, 2025

See https://docs.python.org/3/library/compression.zstd.html for information about this library.

As far as I can tell, the zstd library is not vulnerable to things like ZipSlip, but it could be vulnerable to a decompression bomb attack, so I extended those models accordingly.

@github-actions github-actions bot added the Python label Dec 9, 2025
See https://docs.python.org/3/library/compression.zstd.html for
information about this library.

As far as I can tell, the `zstd` library is not vulnerable to things
like ZipSlip, but it _could_ be vulnerable to a decompression bomb
attack, so I extended those models accordingly.
@tausbn tausbn force-pushed the tausbn/python-add-models-for-zstd-compression branch from f102f9f to ad68a5e Compare December 9, 2025 22:52
@tausbn tausbn changed the title Python: Add models for zstd.compression Python: Add modelling for zstd.compression Dec 9, 2025
@tausbn tausbn force-pushed the tausbn/python-add-models-for-zstd-compression branch from e1af093 to d2c7147 Compare December 10, 2025 13:52
@tausbn tausbn marked this pull request as ready for review December 10, 2025 15:32
@tausbn tausbn requested a review from a team as a code owner December 10, 2025 15:32
Copilot AI review requested due to automatic review settings December 10, 2025 15:32
Copy link
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 adds modeling support for Python 3.14's new compression.zstd library to detect potential decompression bomb vulnerabilities. The implementation follows the established pattern used for other compression libraries like gzip, bz2, and lzma.

  • Extends the decompression bomb detection to include zstd.open() and zstd.ZstdFile() calls when used in read mode
  • Adds test cases to verify the new detection capability
  • Updates auto-generated expected test results

Reviewed changes

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

File Description
python/ql/test/experimental/query-tests/Security/CWE-409/test.py Adds test cases for zstd.open() and zstd.ZstdFile() decompression bomb vulnerabilities
python/ql/test/experimental/query-tests/Security/CWE-409/DecompressionBombs.expected Updates auto-generated expected test results with new test case line numbers
python/ql/src/experimental/semmle/python/security/DecompressionBomb.qll Implements the Zstd module with decompression sink detection logic for Python 3.14+
python/ql/lib/change-notes/2025-12-09-add-modelling-of-zstd-compression.md Documents the addition of compression.zstd library support

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

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants