Repository navigation
Python: Fix argument positions and parameter names in py/tarslip sinks - #23119
Open
sam-robson wants to merge 1 commit into
Open
sam-robson wants to merge 1 commit into
sam-robson wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The change alters production py/tarslip sink semantics, but the review lacks DCA results for the final version to assess changed alerts and unexpected regressions.
1 open issue
What changed in this PR
This pull request corrects py/tarslip sink modeling for TarFile.extract and TarFile.extractall, ensuring positional and keyword arguments map to the proper parameters and adding regression coverage.
Changes:
- Updates sink definitions to recognize
extract(member=...)and use the correct zero-basedextractallmember position. - Adds regression tests for keyword and positional argument handling.
- Updates generated query expectations and adds a minor analysis change note.
| File | Description |
|---|---|
| python/ql/test/query-tests/Security/CWE-022-TarSlip/tarslip.py | Adds regression cases covering keyword extract arguments and positional extractall member arguments. |
| python/ql/test/query-tests/Security/CWE-022-TarSlip/TarSlip.expected | Records the expected query results for the added TarSlip regression cases. |
| python/ql/lib/semmle/python/security/dataflow/TarSlipCustomizations.qll | Corrects sink parameter names and positions for extract and extractall calls. |
| python/ql/lib/change-notes/2026-11-12-tarslip-sink-arguments.md | Documents the TarSlip sink-modeling analysis correction. |
Review effort: Lite (auto)
| call = | ||
| API::moduleImport("tarfile").getMember("open").getReturn().getMember("extract").getACall() and | ||
| this = call.getArg(0) and | ||
| this = call.getParameter(0, "member").asSink() and |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #23114
API::CallNode.getParameter(i)indexes arguments from0without countingself, so thepy/tarslipsinks were off againstTarFile:ExtractSinknow matchesmember=keyword calls, andExtractAllSinkandExtractMembersSinkcheckmembersat index1instead of2and0.