-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[microTVM] Mitigate security vulnerability CVE-2007-4559 #13751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thanks for contributing to TVM! Please refer to the contributing guidelines https://tvm.apache.org/docs/contribute/ for useful information and tips. Please request code reviews from Reviewers by @-ing them in a comment. Generated by tvm-bot |
gromero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YuchenJin Hi. Thanks a lot for the patch! I've left some comments inline, but otherwise LGTM.
The CI errors are trivial to fix, just remove the period after the PR title and commit title when sending the PR again.
|
@YuchenJin I've tweaked a bit the PR description to tell give more context on how this CVE could affect the microTVM specifically. |
|
cc @guberti since it also touches Arduino and also because tvm-bot didn't tag him :-) |
|
@YuchenJin Friendly ping :-) |
guberti
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with @gromero's comments - other than that, LGTM.
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/4055383350 Detailswith response |
|
@driazati Hi. Do you know why I can't retrigger the CI in this PR? (see error above). |
|
Not sure exactly what went wrong with Jenkins but it seems like there are a few legit CI errors still remaining |
|
The lint error (https://ci.tlcpack.ai/blue/organizations/jenkins/tvm-lint/detail/PR-13751/3/pipeline) is definitely real so this will at least need a fix for that, a rebase probably wouldn't hurt either |
@driazati ah, fair enough! I was looking at a different log: https://ci.tlcpack.ai/blue/rest/organizations/jenkins/pipelines/tvm-arm/branches/PR-13751/runs/3/nodes/104/steps/142/log/?start=0 |
gromero
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YuchenJin Thanks a lot for addressing the comments. Please see my new comments inline.
Also, since the exception message got longer, it's necessary to break the line accordingly to satisfy the linter (see David's comment above). Also, could you please rebase (not merge) your code onto HEAD? Thanks!
| def _safe_extract(tar, path=".", members=None, *, numeric_owner=False): | ||
| def is_within_directory(directory, member): | ||
|
|
||
| target = os.path.join(path, member.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
path here is being taken from the outer scope, i.e. from path="." arg in _safe_extract. path is also passed to _is_within_directory() as directory arg, so could it be changed to actually:
target = os.path.join(directory, member.name)
?
nit: If you wish, this line could be put immediately before the line where target is used, i.e. before line 185 (abs_target = ...).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @gromero for your suggestions! I rebased and updated, let's see if the ci complains this time. :)
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/4078496473 Detailswith response |
|
@tvm-bot rerun |
|
Hi, just a random heads up that this fix for path traversal in |
Borrowed from tlc-pack/relax#335. The original author is @TrellixVulnTeam from the Advanced Research Center at Trellix.
This PR patches the security vulnerability CVE-2007-4559 in the Arduino and Zephyr Project API servers. CVE-2007-4559 is a 15 year old bug in the Python tarfile package. By using extract() or extractall() on a tarfile object without sanitizing input, a maliciously crafted .tar Model Library Format file could perform a directory path traversal attack, silently overwriting files outside the target project target dir when creating new projects, for instance. The patch essentially checks to see if all tarfile members will be extracted safely and throws an exception otherwise. Further technical information about the vulnerability can be found in this blog.
Co-authored-by: TrellixVulnTeam kasimir.schulz@trellix.com