diff --git a/WHATSNEW b/WHATSNEW index 7d98d7bc2..e5baae1fa 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -9,10 +9,12 @@ Changes that could break older environments: destination directory anymore by default. A new attribute allowFilesToEscapeDest can be used to override the behavior. Another special case is when stripAbsolutePathSpec is false (which - still is the default) and the entry's name starts with a + no longer is the default) and the entry's name starts with a (back)slash and allowFilesToEscapeDest hasn't been specified explicitly, in this case the file may be created outside of the dest directory as well. + In addition stripAbsolutePathSpec is now true by default. + Based on a recommendation by the Snyk Security Research Team. Fixed bugs: ----------- diff --git a/manual/Tasks/unzip.html b/manual/Tasks/unzip.html index 8b67f3b6c..7076e5a3a 100644 --- a/manual/Tasks/unzip.html +++ b/manual/Tasks/unzip.html @@ -108,7 +108,8 @@ extract an Ant generated ZIP archive.

name before extracting it. Note that this changes the entry name before applying include/exclude patterns and before using the nested mappers (if any). since Ant 1.8.0 - No; defaults to false + No; defaults to true since 1.10.4 + (used to defaukt to false prior to that) scanForUnicodeExtraFields diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java index 51f4043ff..de50311ed 100644 --- a/src/main/org/apache/tools/ant/taskdefs/Expand.java +++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java @@ -75,7 +75,7 @@ public class Expand extends Task { private Union resources = new Union(); private boolean resourcesSpecified = false; private boolean failOnEmptyArchive = false; - private boolean stripAbsolutePathSpec = false; + private boolean stripAbsolutePathSpec = true; private boolean scanForUnicodeExtraFields = true; private Boolean allowFilesToEscapeDest = null; diff --git a/src/tests/antunit/taskdefs/unzip-test.xml b/src/tests/antunit/taskdefs/unzip-test.xml index a220bc186..bdf5f61e1 100644 --- a/src/tests/antunit/taskdefs/unzip-test.xml +++ b/src/tests/antunit/taskdefs/unzip-test.xml @@ -101,16 +101,16 @@ public class A { - - + - - +