aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-server-common
diff options
context:
space:
mode:
authorBelen Pruvost <belen.pruvost@sonarsource.com>2022-07-14 10:57:26 +0200
committersonartech <sonartech@sonarsource.com>2022-07-25 20:03:57 +0000
commit34e8dfb83433a7a2d016131c9f1be7373bffb7be (patch)
tree547fe118621e11536f32a7c6d74f68220844b7e5 /server/sonar-server-common
parentd66a7c69cbef6ee9647ac0233d915b2863c06338 (diff)
downloadsonarqube-34e8dfb83433a7a2d016131c9f1be7373bffb7be.tar.gz
sonarqube-34e8dfb83433a7a2d016131c9f1be7373bffb7be.zip
SONAR-16371 - Implement pull_taint endpoint
Diffstat (limited to 'server/sonar-server-common')
-rw-r--r--server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java7
-rw-r--r--server/sonar-server-common/src/test/java/org/sonar/server/issue/TaintCheckerTest.java8
2 files changed, 13 insertions, 2 deletions
diff --git a/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java b/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java
index 0abd66b3756..ed591a9127d 100644
--- a/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java
+++ b/server/sonar-server-common/src/main/java/org/sonar/server/issue/TaintChecker.java
@@ -22,7 +22,6 @@ package org.sonar.server.issue;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
@@ -30,7 +29,7 @@ import org.sonar.db.issue.IssueDto;
public class TaintChecker {
- private static final Set<String> TAINT_REPOSITORIES = Set.of("roslyn.sonaranalyzer.security.cs", "javasecurity", "jssecurity", "tssecurity", "phpsecurity", "pythonsecurity");
+ private static final List<String> TAINT_REPOSITORIES = List.of("roslyn.sonaranalyzer.security.cs", "javasecurity", "jssecurity", "tssecurity", "phpsecurity", "pythonsecurity");
private TaintChecker() {
throw new IllegalStateException("Utility class, cannot be instantiated.");
@@ -65,4 +64,8 @@ public class TaintChecker {
return issueDto -> !TAINT_REPOSITORIES.contains(issueDto.getRuleRepo());
}
+ public static List<String> getTaintRepositories() {
+ return TAINT_REPOSITORIES;
+ }
+
}
diff --git a/server/sonar-server-common/src/test/java/org/sonar/server/issue/TaintCheckerTest.java b/server/sonar-server-common/src/test/java/org/sonar/server/issue/TaintCheckerTest.java
index e98b2ba45ba..7da4d7a26ee 100644
--- a/server/sonar-server-common/src/test/java/org/sonar/server/issue/TaintCheckerTest.java
+++ b/server/sonar-server-common/src/test/java/org/sonar/server/issue/TaintCheckerTest.java
@@ -78,6 +78,14 @@ public class TaintCheckerTest {
assertThat(issuesByTaintStatus.get(false).get(2).getKey()).isEqualTo("standardIssue3");
}
+ @Test
+ public void test_getTaintRepositories() {
+ assertThat(TaintChecker.getTaintRepositories())
+ .hasSize(6)
+ .containsExactlyInAnyOrder("roslyn.sonaranalyzer.security.cs", "javasecurity", "jssecurity",
+ "tssecurity", "phpsecurity", "pythonsecurity");
+ }
+
private List<IssueDto> getIssues() {
List<IssueDto> issues = new ArrayList<>();