fix: handle all tarfile extract errors #1206
Merged
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.
Summary
Addressing #1202, which occurred due to a
tarfile.SpecialFileError, this case happened as the provided package had uploaded what linux classes as a character file (like a device file). Instead of handling specificallytarfile.ReadError, thedownload_package_sourcecodefunction how handles alltarfileerrors usingtarfile.TarError, the base error class.Description of changes
In addition to those changes mentioned above, also included in this PR is modifying
DetectMaliciousMetadataCheck.analyze_sourceto returnSKIPinstead of raising aHeuristicAnalyzerValueErrorfrom aSourceCodeError. This means that the result of the metadata analysis is still preserved and the analysis result does not result inUNKNOWN.Related issues
Closes #1202.
Checklist
verifiedlabel should appear next to all of your commits on GitHub.