Validate Awkward ZIP upload keys to prevent path traversal#1376
Open
stuartcampbell wants to merge 5 commits into
Open
Validate Awkward ZIP upload keys to prevent path traversal#1376stuartcampbell wants to merge 5 commits into
stuartcampbell wants to merge 5 commits into
Conversation
|
Great job! No new security vulnerabilities introduced in this pull requestCommunicate with Checkmarx by submitting a PR comment with @Checkmarx followed by one of the supported commands. Learn about the supported commands here. |
Member
|
Thanks! Seems good once CI passes. |
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.

This was initially generated by Codex Security.
Motivation
/awkward/fullupload flow accepted ZIP entry names verbatim and forwarded them into storage, enabling path traversal (zip-slip) and arbitrary file writes outside the dataset directory.../outside.txtto be written to disk.Description
expected_form_keys = set(awkward.forms.from_dict(form).expected_from_buffers())and rejecting any ZIP entry not in that set with aValueErrorintiled/serialization/awkward.py.zip.namelist()and raise a clear error for unexpected keys before reading buffer contents, preventing unsafe names from being returned toentry.write.test_reject_unexpected_zip_form_keytotests/test_awkward.pythat crafts a ZIP containing valid buffers plus../outside.txtand asserts that deserialization is rejected.ioandzipfileimports to the test file to support the new regression test.Testing
python -m compileall tiled/serialization/awkward.py tests/test_awkward.py, which succeeded.pytest -q tests/test_awkward.py -k 'reject_unexpected_zip_form_key or slicing', but the test run could not complete in this environment due to missing test dependencies (asyncpg) fromtests/conftest.pyand optional packages; the test harness is therefore not fully executed here.awkwardpackage was not available, so the behavior was validated by static checks and the added unit test which will run in CI where dependencies are present.Codex Task