Skip to content

Commit 0d93078

Browse files
SONARJAVA-5665 Improve S4036 message for users (#5229)
1 parent a3ef175 commit 0d93078

File tree

3 files changed

+148
-148
lines changed

3 files changed

+148
-148
lines changed

java-checks-test-sources/default/src/main/files/non-compiling/checks/OSCommandsPath.java

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ private void noInitializer() {
2626
}
2727

2828
private void processBuilderListJava9() {
29-
new ProcessBuilder(List.of("make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
30-
new ProcessBuilder(List.of("m../ake")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
31-
new ProcessBuilder(List.of("mak./e")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
32-
new ProcessBuilder(List.of("bin~/make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
33-
new ProcessBuilder(List.of("7:\\\\make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
34-
new ProcessBuilder(List.of("m..\\ake")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
35-
new ProcessBuilder(List.of("ma.\\ke")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
36-
new ProcessBuilder(List.of("SERVER\\make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
29+
new ProcessBuilder(List.of("make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
30+
new ProcessBuilder(List.of("m../ake")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
31+
new ProcessBuilder(List.of("mak./e")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
32+
new ProcessBuilder(List.of("bin~/make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
33+
new ProcessBuilder(List.of("7:\\\\make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
34+
new ProcessBuilder(List.of("m..\\ake")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
35+
new ProcessBuilder(List.of("ma.\\ke")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
36+
new ProcessBuilder(List.of("SERVER\\make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
3737
new ProcessBuilder(List.of("/usr/bin/make"));
3838
new ProcessBuilder(List.of("../make"));
3939
new ProcessBuilder(List.of("./make"));
@@ -47,14 +47,14 @@ private void processBuilderListJava9() {
4747
private void commandJava9() {
4848
ProcessBuilder builder = new ProcessBuilder();
4949

50-
builder.command(List.of("make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
51-
builder.command(List.of("m../ake")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
52-
builder.command(List.of("mak./e")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
53-
builder.command(List.of("bin~/make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
54-
builder.command(List.of("7:\\\\make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
55-
builder.command(List.of("m..\\ake")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
56-
builder.command(List.of("ma.\\ke")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
57-
builder.command(List.of("SERVER\\make")); // Noncompliant {{Make sure the "PATH" used to find this command includes only what you intend.}}
50+
builder.command(List.of("make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
51+
builder.command(List.of("m../ake")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
52+
builder.command(List.of("mak./e")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
53+
builder.command(List.of("bin~/make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
54+
builder.command(List.of("7:\\\\make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
55+
builder.command(List.of("m..\\ake")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
56+
builder.command(List.of("ma.\\ke")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
57+
builder.command(List.of("SERVER\\make")); // Noncompliant {{Make sure the "PATH" variable only contains fixed, unwriteable directories.}}
5858
builder.command(List.of("/usr/bin/make"));
5959
builder.command(List.of("../make"));
6060
builder.command(List.of("./make"));

0 commit comments

Comments
 (0)