Disables jar signing for train docs
This commit is contained in:
@@ -20,6 +20,8 @@
|
||||
<handlebars.version>4.3.0</handlebars.version>
|
||||
<asciidoctorj.version>2.5.3</asciidoctorj.version>
|
||||
<commons-io.version>2.11.0</commons-io.version>
|
||||
|
||||
<maven-gpg-plugin.phase>none</maven-gpg-plugin.phase>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
@@ -115,10 +117,9 @@
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<goals>
|
||||
<goal>deploy-file</goal>
|
||||
</goals>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
@@ -68,13 +68,13 @@ final class ZipCategory {
|
||||
if (!entry.isDirectory()) {
|
||||
final File destinationFile = new File(destination, entry.getName());
|
||||
/*
|
||||
* If we see the relative traversal string of ".." we need to make sure
|
||||
* that the outputdir + name doesn't leave the outputdir.
|
||||
* If we see the relative traversal string of ".." we need to make
|
||||
* sure that the outputdir + name doesn't leave the outputdir.
|
||||
*/
|
||||
String zipEntryName = entry.getName();
|
||||
if (!destinationFile.toPath().normalize().startsWith(destination.toPath())) {
|
||||
throw new ZipException("The file " + zipEntryName +
|
||||
" is trying to leave the target output directory of " + destination);
|
||||
throw new ZipException("The file " + zipEntryName
|
||||
+ " is trying to leave the target output directory of " + destination);
|
||||
}
|
||||
if (destinationFile.getParentFile() != null) {
|
||||
destinationFile.getParentFile().mkdirs();
|
||||
|
||||
@@ -34,25 +34,26 @@ class ZipCategoryTests {
|
||||
// when:
|
||||
ZipCategory.unzipTo(zipFile, tempDir);
|
||||
// then:
|
||||
BDDAssertions.then(tempDir.listFiles())
|
||||
.hasOnlyOneElementSatisfying(file -> {
|
||||
BDDAssertions.then(file).hasName("file.txt")
|
||||
.hasContent("test");
|
||||
});
|
||||
BDDAssertions.then(tempDir.listFiles()).hasOnlyOneElementSatisfying(file -> {
|
||||
BDDAssertions.then(file).hasName("file.txt").hasContent("test");
|
||||
});
|
||||
}
|
||||
|
||||
@Test
|
||||
void should_not_allow_malicious_traversal() throws Exception {
|
||||
// given:
|
||||
File zipFile = new File(ZipCategoryTests.class.getClassLoader().getResource("zip/zip-malicious-traversal.zip").toURI());
|
||||
File zipFile = new File(
|
||||
ZipCategoryTests.class.getClassLoader().getResource("zip/zip-malicious-traversal.zip").toURI());
|
||||
File tempDir = Files.createTempDirectory("foo").toFile();
|
||||
tempDir.deleteOnExit();
|
||||
// when:
|
||||
try {
|
||||
ZipCategory.unzipTo(zipFile, tempDir);
|
||||
Assertions.fail("Should throw exception");
|
||||
} catch (Exception e) {
|
||||
BDDAssertions.then(e.getCause()).hasMessageContaining("is trying to leave the target output directory");
|
||||
}
|
||||
catch (Exception e) {
|
||||
BDDAssertions.then(e.getCause()).hasMessageContaining("is trying to leave the target output directory");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user