Skip to content

Conversation

@tausbn
Copy link
Contributor

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.

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.
@tausbntausbnforce-pushed the tausbn/python-add-models-for-zstd-compression branch from f102f9f to ad68a5eCompareDecember 9, 2025 22:52
@tausbntausbn changed the title Python: Add models for zstd.compressionPython: Add modelling for zstd.compressionDec 9, 2025
@tausbntausbnforce-pushed the tausbn/python-add-models-for-zstd-compression branch from e1af093 to d2c7147CompareDecember 10, 2025 13:52
@tausbntausbn marked this pull request as ready for review December 10, 2025 15:32
@tausbntausbn requested a review from a team as a code ownerDecember 10, 2025 15:32
CopilotAI review requested due to automatic review settings December 10, 2025 15:32
Copy link
Contributor

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

FileDescription
python/ql/test/experimental/query-tests/Security/CWE-409/test.pyAdds test cases for zstd.open() and zstd.ZstdFile() decompression bomb vulnerabilities
python/ql/test/experimental/query-tests/Security/CWE-409/DecompressionBombs.expectedUpdates auto-generated expected test results with new test case line numbers
python/ql/src/experimental/semmle/python/security/DecompressionBomb.qllImplements 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.mdDocuments the addition of compression.zstd library support

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

Sign up for freeto 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

@tausbn