]> source.dussan.org Git - jgit.git/commit
Validate paths during DirCheckout 17/4617/16
authorRobin Rosenberg <robin.rosenberg@dewire.com>
Mon, 23 Apr 2012 20:37:50 +0000 (22:37 +0200)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 23 Apr 2012 20:37:50 +0000 (22:37 +0200)
commit42d7565ba9b97effdee3f737e32541b26b7341ab
tree397809a3509520df69cb068791585cf1a77637d9
parent9c5b31703f278c510bec64fa7a822713feaca6f2
Validate paths during DirCheckout

DirCacheCheckout and CanonicalTreeParser cooperate. CanonicalTreeParser
can detect malformed, potentially malicious tree entries and sets a
flag, while DirCacheCheckout refuses to work with such paths.

Malicious tree entries are ".", "..", ".git" (case insensitive), any
name containing '/' and (on Windows '\') and also (on Windows)
any paths ending in a combination of '.' or space or containing a ':'.
We also forbid all special names like "con" etc on Windows.

Some of the test can execute on any platform by enabling partial
platform emulation.

A new runtime exception, InvalidPathException, is introduced. For
backwards compatibility it extends InvalidArgumentException.

Change-Id: I86199105814b63d4340e5de0e471d0da6b579ead
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit.junit/src/org/eclipse/jgit/junit/MockSystemReader.java
org.eclipse.jgit.test/META-INF/MANIFEST.MF
org.eclipse.jgit.test/pom.xml
org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/DirCacheCheckoutMaliciousPathTest.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheCheckout.java
org.eclipse.jgit/src/org/eclipse/jgit/dircache/DirCacheEntry.java
org.eclipse.jgit/src/org/eclipse/jgit/dircache/InvalidPathException.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/AbstractTreeIterator.java
org.eclipse.jgit/src/org/eclipse/jgit/treewalk/CanonicalTreeParser.java