Commit 0bafc5a
[SPARK-38631][CORE] Uses Java-based implementation for un-tarring at Utils.unpack (Kyligence#643)
### What changes were proposed in this pull request?
This PR proposes to use `FileUtil.unTarUsingJava` that is a Java implementation for un-tar `.tar` files. `unTarUsingJava` is not public but it exists in all Hadoop versions from 2.1+, see HADOOP-9264.
The security issue reproduction requires a non-Windows platform, and a non-gzipped TAR archive file name (contents don't matter).
### Why are the changes needed?
There is a risk for arbitrary shell command injection via `Utils.unpack` when the filename is controlled by a malicious user. This is due to an issue in Hadoop's `unTar`, that is not properly escaping the filename before passing to a shell command:https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileUtil.java#L904
### Does this PR introduce _any_ user-facing change?
Yes, it prevents a security issue that, previously, allowed users to execute arbitrary shall command.
### How was this patch tested?
Manually tested in local, and existing test cases should cover.
Closes apache#35946 from HyukjinKwon/SPARK-38631.
Authored-by: Hyukjin Kwon <gurwls223@apache.org>
(cherry picked from commit 057c051)
Signed-off-by: Hyukjin Kwon <gurwls223@apache.org>
Co-authored-by: Hyukjin Kwon <gurwls223@apache.org>1 parent 289884d commit 0bafc5a
1 file changed
Lines changed: 28 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
596 | 596 | | |
597 | 597 | | |
598 | 598 | | |
| 599 | + | |
599 | 600 | | |
600 | | - | |
601 | | - | |
| 601 | + | |
602 | 602 | | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
603 | 606 | | |
604 | 607 | | |
605 | 608 | | |
606 | 609 | | |
607 | 610 | | |
608 | 611 | | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
609 | 635 | | |
610 | 636 | | |
611 | 637 | | |
| |||
0 commit comments