Repository navigation
fix(amazonq): block zip slip in the legacy .NET transform artifact download - #3044
Open
tomar-gunjan wants to merge 3 commits into
Open
tomar-gunjan wants to merge 3 commits into
tomar-gunjan wants to merge 3 commits into
Conversation
…wnload TransformHandler.extractAllEntriesTo, used by aws/qNetTransform/downloadArtifacts, wrote each zip entry to path.join(target, entryName) with no containment check, so ../ entries were written outside the extraction folder. Delegate to the guarded Utils.extractAllEntriesTo, which the ATX download path already uses: it skips and logs any entry that resolves outside the folder. Adds a zip-slip test. Updates two tests that asserted the old behavior: the ENOENT log line, and a traversal entry expected to reach mkdir.
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
BigDataStructure
approved these changes
Nov 17, 2026
Applying a step's checkpoint joined each path in metadata.json to the solution folder without checking it. An entry with .. segments, an absolute or drive path, or a Windows stream name could write, overwrite or delete a file outside the solution folder. The job and step IDs also name the folder a checkpoint is extracted to, so an ID like . or .. could extract it over the job's data, such as source-files.json. - Skip and log added, updated, removed and moved entries that resolve outside the solution folder or inside artifactWorkspace. - Skip and log completed steps and diff artifacts whose job or step ID is not a plain folder name. A skipped diff artifact is reported as DiffApplyFailed. - Name the HITL artifact file hitl-artifact-unknown when its tag is not a plain file name. The paths are checked as text, so a link inside the solution folder is still followed, as before. Addresses LS40 and LS103 from the language servers security review (P561843575).
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.
Problem
TransformHandler.extractAllEntriesTo, used by aws/qNetTransform/downloadArtifacts, wrote each zip entry to path.join(target, entryName) with no containment check, so ../ entries were written outside the extraction folder. Delegate to the guarded Utils.extractAllEntriesTo, which the ATX download path already uses: it skips and logs any entry that resolves outside the folder.
Solution
Added checks
Adds a zip-slip test. Updates two tests that asserted the old behavior: the ENOENT log line, and a traversal entry expected to reach mkdir.
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.