mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-28 12:28:51 -06:00
fix: check zip member paths with core.ziptools
The data directory refresh dropped any name containing .. in silence, wrote a backslash as a filename character and let a drive letter or a backslash traversal through. The pack integrity check flagged Read..me as a traversal. Both now use safe_member_parts, and an unsafe member fails the refresh of its key instead of thinning the tree.
This commit is contained in:
1 parent
79e5eae036
commit
8bc497cf15
5 files changed
+62
-25
No files matched your search
@@ -355,6 +355,18 @@ class APackForAndroidHidesItsMedia(PackCountFixture):
|
||||
errors = packverify._structural_errors(archive, set(archive.namelist()))
|
||||
self.assertEqual(errors, ["zero-byte: empty.bin"])
|
||||
|
||||
def test_the_integrity_check_reads_paths_like_core_ziptools(self):
|
||||
""""Read..me" was reported as a traversal, a backslash one was not."""
|
||||
from packs import integrity as packverify
|
||||
|
||||
buffer = io.BytesIO()
|
||||
with zipfile.ZipFile(buffer, "w") as archive:
|
||||
archive.writestr("Docs/Read..me.txt", b"r")
|
||||
archive.writestr("..\\escape.bin", b"x")
|
||||
with zipfile.ZipFile(buffer) as archive:
|
||||
errors = packverify._structural_errors(archive, set(archive.namelist()))
|
||||
self.assertEqual(errors, ["ZIP traversal detected: ../escape.bin"])
|
||||
|
||||
def test_a_platform_without_android_gets_none(self):
|
||||
self.assertEqual(datatrees.pack_markers("demo", None, str(self.platforms)), ())
|
||||
|
||||
|
||||
Reference in new issue
Block a user