From 70db1ff5f79dfc7e0c70eb96f93c1ee6af5205b5 Mon Sep 17 00:00:00 2001 From: Ashley Scopes <73482956+ascopes@users.noreply.github.com> Date: Mon, 8 May 2023 11:54:23 +0100 Subject: [PATCH 1/2] Request that Sonatype Lift ignore false positives --- .lift.toml | 4 ++++ .../github/ascopes/jct/workspaces/impl/FileBuilderImpl.java | 1 - .../github/ascopes/jct/workspaces/impl/TempDirectoryImpl.java | 1 - 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.lift.toml b/.lift.toml index 1ccbfa5c4..1534f7b57 100644 --- a/.lift.toml +++ b/.lift.toml @@ -19,3 +19,7 @@ ignoreFiles = "acceptance-tests/**" # Use JDK 11 to help Sonatype Lift start the default plugins correctly. jdkVersion = "11" summaryComments = true +ignoreRules = [ + "PATH_TRAVERSAL_IN", + "URLCONNECTION_SSRF_FD", +] diff --git a/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/FileBuilderImpl.java b/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/FileBuilderImpl.java index 08ce458f1..a15d2a1c0 100644 --- a/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/FileBuilderImpl.java +++ b/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/FileBuilderImpl.java @@ -117,7 +117,6 @@ public ManagedDirectory copiedFromFile(Path file) { } @Override - @SuppressWarnings("findsecbugs:URLCONNECTION_SSRF_FD") public ManagedDirectory copiedFromUrl(URL url) { return uncheckedIo(() -> createFile(url.openStream())); } diff --git a/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/TempDirectoryImpl.java b/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/TempDirectoryImpl.java index 98780d077..06e5a12cb 100644 --- a/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/TempDirectoryImpl.java +++ b/java-compiler-testing/src/main/java/io/github/ascopes/jct/workspaces/impl/TempDirectoryImpl.java @@ -89,7 +89,6 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx * environment you are using. * @return the temporary directory. */ - @SuppressWarnings("findsecbugs:PATH_TRAVERSAL_IN") public static TempDirectoryImpl newTempDirectory(String name) { // TODO(ascopes): are MS-DOS file name length limits a potential issue here? assertValidRootName(name); From c2a325594b89a4e0f82d1c6caed69b7cbc8ed178 Mon Sep 17 00:00:00 2001 From: Ashley Scopes <73482956+ascopes@users.noreply.github.com> Date: Mon, 8 May 2023 12:01:13 +0100 Subject: [PATCH 2/2] Ignore JDK-specific warnings in dogfood tests --- .../acceptancetests/dogfood/JctCompilationConfigurer.java | 3 --- .../jct/acceptancetests/dogfood/JctDogfoodTest.java | 7 ------- 2 files changed, 10 deletions(-) diff --git a/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctCompilationConfigurer.java b/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctCompilationConfigurer.java index e5d602e31..206ed747d 100644 --- a/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctCompilationConfigurer.java +++ b/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctCompilationConfigurer.java @@ -31,9 +31,6 @@ public class JctCompilationConfigurer implements JctCompilerConfigurer compiler) { compiler .failOnWarnings(false) - .inheritClassPath(true) - .inheritModulePath(true) - .addCompilerOptions("-implicit:class") .showWarnings(false) // ignore spam about the testing module being hidden .locale(Locale.ENGLISH); } diff --git a/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctDogfoodTest.java b/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctDogfoodTest.java index f2fad20f9..c494a42bc 100644 --- a/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctDogfoodTest.java +++ b/acceptance-tests/acceptance-tests-dogfood/src/test/java/io/github/ascopes/jct/acceptancetests/dogfood/JctDogfoodTest.java @@ -129,13 +129,6 @@ void jctCanCompileItselfAndUnitTestsAsMultiModule(JctCompiler compiler) th assertThat(compilation) .isSuccessful(); - assertThat(compilation) - .diagnostics() - .warnings() - .filteredOn(diag -> !diag.getCode().equals("compiler.warn.module.not.found")) - .withFailMessage("Expected no warnings (other than module.not.found)") - .isEmpty(); - assertThat(compilation) .classOutputModules() .satisfies(