Skip to content

fix: harden archive extraction - #413

Merged
wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:fix/archive-extraction
Nov 10, 2026
Merged

wpbonelli merged 1 commit into
MODFLOW-ORG:developfrom
wpbonelli:fix/archive-extraction

Conversation

@wpbonelli

Copy link
Copy Markdown
Member

Check yaml/toml loading for vulnerabilities, it's fine (yaml.safe_load and tomli everywhere), but archive extraction had a couple gaps

  • extract tarballs with filter="data" in download_and_unzip to reject ../ paths, absolute paths, and links escaping the target dir. Python 3.11-3.13 doesn't filter by default
  • mask zip member modes to 0o777 in MFZipFile, so an archive can't set setuid/setgid/sticky bits

- extract tarballs with filter="data" to reject traversal, absolute paths, and escaping links
- mask zip member modes to 0o777 so archives can't set setuid/setgid/sticky

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wpbonelli wpbonelli added this to the 1.10.0 milestone Nov 10, 2026
@wpbonelli wpbonelli added the bug Something isn't working label Nov 10, 2026
@wpbonelli
wpbonelli marked this pull request as ready for review November 10, 2026 20:59
@wpbonelli
wpbonelli merged commit d010b43 into MODFLOW-ORG:develop Nov 10, 2026
29 of 30 checks passed
@wpbonelli
wpbonelli deleted the fix/archive-extraction branch November 10, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant