You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2018/05/05 15:30:27 UTC
[2/3] ant git commit: change stripAbsolutePathSpec's default,
credit Snyk
change stripAbsolutePathSpec's default, credit Snyk
Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/857095da
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/857095da
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/857095da
Branch: refs/heads/master
Commit: 857095da5153fd18504b46f276d84f1e76a66970
Parents: 46f7593
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sat May 5 17:28:12 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sat May 5 17:28:12 2018 +0200
----------------------------------------------------------------------
WHATSNEW | 4 +++-
manual/Tasks/unzip.html | 3 ++-
src/main/org/apache/tools/ant/taskdefs/Expand.java | 2 +-
src/tests/antunit/taskdefs/unzip-test.xml | 10 +++++-----
4 files changed, 11 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant/blob/857095da/WHATSNEW
----------------------------------------------------------------------
diff --git a/WHATSNEW b/WHATSNEW
index a87bd81..8834fad 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:
-----------
http://git-wip-us.apache.org/repos/asf/ant/blob/857095da/manual/Tasks/unzip.html
----------------------------------------------------------------------
diff --git a/manual/Tasks/unzip.html b/manual/Tasks/unzip.html
index 95b3afd..dbf4a16 100644
--- a/manual/Tasks/unzip.html
+++ b/manual/Tasks/unzip.html
@@ -126,7 +126,8 @@ archive.</p>
Note that this changes the entry's name before applying
include/exclude patterns and before using the nested mappers (if
any). <em>since Ant 1.8.0</em></td>
- <td valign="top" align="center">No, defaults to false</td>
+ <td valign="top" align="center">No, defaults to true since 1.9.12
+ (used to defaukt to false prior to that)</td>
</tr>
<tr>
<td valign="top">scanForUnicodeExtraFields</td>
http://git-wip-us.apache.org/repos/asf/ant/blob/857095da/src/main/org/apache/tools/ant/taskdefs/Expand.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/tools/ant/taskdefs/Expand.java b/src/main/org/apache/tools/ant/taskdefs/Expand.java
index a3a2745..3f83b65 100644
--- a/src/main/org/apache/tools/ant/taskdefs/Expand.java
+++ b/src/main/org/apache/tools/ant/taskdefs/Expand.java
@@ -67,7 +67,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;
http://git-wip-us.apache.org/repos/asf/ant/blob/857095da/src/tests/antunit/taskdefs/unzip-test.xml
----------------------------------------------------------------------
diff --git a/src/tests/antunit/taskdefs/unzip-test.xml b/src/tests/antunit/taskdefs/unzip-test.xml
index a220bc1..bdf5f61 100644
--- a/src/tests/antunit/taskdefs/unzip-test.xml
+++ b/src/tests/antunit/taskdefs/unzip-test.xml
@@ -101,16 +101,16 @@ public class A {
<available property="can-write-to-tmp!" file="/tmp/testdir/"/>
</target>
- <target name="testEntriesCanEscapeDestViaAbsolutePathByDefault"
+ <target name="testEntriesCanEscapeDestViaAbsolutePathIfPermitted"
depends="-can-write-to-tmp?" if="can-write-to-tmp!">
- <unzip src="zip/direscape-absolute.zip" dest="${output}"/>
+ <unzip src="zip/direscape-absolute.zip" dest="${output}"
+ stripAbsolutePathSpec="false"/>
<au:assertFileExists file="/tmp/testdir/a"/>
</target>
- <target name="testEntriesDontEscapeDestViaAbsolutePathIfProhibited"
+ <target name="testEntriesDontEscapeDestViaAbsolutePathByDefault"
depends="-can-write-to-tmp?" if="can-write-to-tmp!">
- <unzip src="zip/direscape-absolute.zip" dest="${output}"
- allowFilesToEscapeDest="false"/>
+ <unzip src="zip/direscape-absolute.zip" dest="${output}"/>
<au:assertFileDoesntExist file="/tmp/testdir/a"/>
</target>
</project>