Skip to content

fix: cleanup PyPI package temp directory and prevent leaks#1404

Open
behnazh-w wants to merge 1 commit into
mainfrom
behnazh/fix-bug-pypi-downloads
Open

fix: cleanup PyPI package temp directory and prevent leaks#1404
behnazh-w wants to merge 1 commit into
mainfrom
behnazh/fix-bug-pypi-downloads

Conversation

@behnazh-w
Copy link
Copy Markdown
Member

@behnazh-w behnazh-w commented May 7, 2026

Summary

Fix PyPI package temp directory cleanup leaks during malware/source analysis.

Description of changes

  • Strip the single top-level sdist archive directory during extraction, so package contents are extracted directly into the mkdtemp root.
  • Ensure source and wheel context managers clean up temp directories even when analysis raises.
  • Use the sourcecode context manager in TypeStubFileAnalyzer instead of calling download_sourcecode() directly.
  • Add relevant unit tests for cleanup after extraction.

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label May 7, 2026
@behnazh-w behnazh-w force-pushed the behnazh/fix-bug-pypi-downloads branch 3 times, most recently from 35738ae to 6910a2d Compare May 11, 2026 08:23
Signed-off-by: behnazh-w <behnaz.hassanshahi@oracle.com>
@behnazh-w behnazh-w force-pushed the behnazh/fix-bug-pypi-downloads branch from 6910a2d to 90aa33f Compare May 11, 2026 11:28
@behnazh-w behnazh-w requested a review from art1f1c3R May 11, 2026 11:29
@behnazh-w behnazh-w marked this pull request as ready for review May 11, 2026 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant