From ecbeb68df64f1dcd9a45cd7dac70e857e2cde8a0 Mon Sep 17 00:00:00 2001 From: Marcin Grzejszczak Date: Tue, 7 Feb 2023 16:26:05 +0100 Subject: [PATCH] Disables jar signing for train docs --- train-docs/pom.xml | 9 +++++---- .../cloud/internal/ZipCategory.java | 8 ++++---- .../cloud/internal/ZipCategoryTests.java | 17 +++++++++-------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/train-docs/pom.xml b/train-docs/pom.xml index f3b6ac9..b07fe74 100644 --- a/train-docs/pom.xml +++ b/train-docs/pom.xml @@ -20,6 +20,8 @@ 4.3.0 2.5.3 2.11.0 + + none @@ -115,10 +117,9 @@ maven-deploy-plugin - - - org.apache.maven.plugins - maven-gpg-plugin + + deploy-file + diff --git a/train-docs/src/main/java/org/springframework/cloud/internal/ZipCategory.java b/train-docs/src/main/java/org/springframework/cloud/internal/ZipCategory.java index dccf60b..7d6444e 100644 --- a/train-docs/src/main/java/org/springframework/cloud/internal/ZipCategory.java +++ b/train-docs/src/main/java/org/springframework/cloud/internal/ZipCategory.java @@ -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(); diff --git a/train-docs/src/test/java/org/springframework/cloud/internal/ZipCategoryTests.java b/train-docs/src/test/java/org/springframework/cloud/internal/ZipCategoryTests.java index 436de29..49c675f 100644 --- a/train-docs/src/test/java/org/springframework/cloud/internal/ZipCategoryTests.java +++ b/train-docs/src/test/java/org/springframework/cloud/internal/ZipCategoryTests.java @@ -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"); } } + }