mirror of
https://github.com/github/spec-kit.git
synced 2026-07-06 22:32:13 +08:00
Fix safe_extract_tarball: pass safe_members to extractall on Python 3.12+
This commit is contained in:
committed by
GitHub
parent
0825f508a7
commit
a8320d9b61
@@ -227,10 +227,10 @@ def safe_extract_tarball(
|
||||
safe_members.append(member)
|
||||
|
||||
# Extract — use the "data" filter on Python 3.12+ for extra hardening.
|
||||
# On older versions pass only the pre-validated members so that no
|
||||
# On all versions pass only the pre-validated members so that no
|
||||
# unvetted entry (added concurrently or via a race) slips through.
|
||||
if sys.version_info >= (3, 12):
|
||||
tf.extractall(dest_dir, filter="data") # type: ignore[call-arg]
|
||||
tf.extractall(dest_dir, members=safe_members, filter="data") # type: ignore[call-arg]
|
||||
else:
|
||||
tf.extractall(dest_dir, members=safe_members) # noqa: S202 — validated above
|
||||
except error_class:
|
||||
|
||||
Reference in New Issue
Block a user