Commit 18c4f71 1 parent c2e4fe0 commit 18c4f71 Copy full SHA for 18c4f71
File tree 1 file changed +5
-3
lines changed
maven-plugin/plugin-core/src/main/java/org/jvnet/jaxb/maven/util
1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change 16
16
public class JarScanner extends AbstractScanner {
17
17
private static final String [] EMPTY_STRING_ARRAY = new String [0 ];
18
18
19
+ private File destinationDir = new File ("/tmp" );
20
+
19
21
/**
20
22
* The jar artifact to be scanned.
21
23
*/
@@ -52,9 +54,9 @@ public void scan() {
52
54
while (jarFileEntries .hasMoreElements ()) {
53
55
JarEntry entry = jarFileEntries .nextElement ();
54
56
String name = entry .getName ();
55
- if ( name . startsWith ( ".." ) || name . startsWith ( "/" )) {
56
- // ignore "zip slip" file pattern attack
57
- continue ;
57
+ File file = new File ( destinationDir , entry . getName ());
58
+ if (! file . toPath (). normalize (). startsWith ( destinationDir . toPath ())) {
59
+ throw new IOException ( "Bad zip entry for " + entry . getName ()) ;
58
60
}
59
61
char [][] tokenizedName = tokenizePathToCharArray (name , File .separator );
60
62
if (name .endsWith ("/" )) {
You can’t perform that action at this time.
0 commit comments