Skip to content

Commit

Permalink
added scan and project tags for SCA (#1345)
Browse files Browse the repository at this point in the history
* Added Scan and Project Tags for SCA

* Updated Documentation
  • Loading branch information
itsKedar authored Apr 30, 2024
1 parent b2c3c93 commit 60620e0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR app
RUN apk update && \
apk upgrade && \
apk upgrade
RUN apk add openjdk17=17.0.10_p7-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
RUN apk add openjdk17=17.0.11_p9-r0 --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community
ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk
RUN apk add libstdc++
RUN apk add glib
Expand Down
2 changes: 1 addition & 1 deletion build-11.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ buildscript {
ext {


CxSBSDK = "0.6.2"
CxSBSDK = "0.6.6"
ConfigProviderVersion = '1.0.14'
//cxVersion = "8.90.5"
springBootVersion = '3.2.4'
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import org.gradle.api.tasks.testing.Test

buildscript {
ext {
CxSBSDK = "0.6.4"
CxSBSDK = "0.6.6"
ConfigProviderVersion = '1.0.14'
//cxVersion = "8.90.5"
springBootVersion = '3.2.4'
Expand Down
8 changes: 7 additions & 1 deletion docs/CxSCA-Integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ sca:
manifests-include-pattern: "!**/*.xml, **/*.yml"
fingerprints-include-pattern: "**/*.yml"
preserve-xml: true
project-tags: "k1:k2,dev"
scan-tags: "s1:s2,p1:p2,prod"
filter-severity:
- High
filter-policy-violation: true
Expand Down Expand Up @@ -70,6 +72,8 @@ sca:
manifests-include-pattern: "!**/*.xml, **/*.yml"
fingerprints-include-pattern: "**/*.yml"
preserve-xml: true
project-tags: "k1:k2,dev"
scan-tags: "s1:s2,p1:p2,prod"
filter-severity:
- High
filter-policy-violation: true
Expand Down Expand Up @@ -269,7 +273,9 @@ CxFlow supports configuration as code for CxSAST and CxSCA scans.
"fingerprintsIncludePattern": "**/*.yml",
"team": "/CxServer/MyTeam/SubTeam",
"projectName" : "SampleProjectName",
"expPathSastProjectName": "SampleProjectName"
"expPathSastProjectName": "SampleProjectName",
"projectTags": "k1:k2,dev"
"scanTags": "s1:s2,prod,p1:p2"
}
}
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@
import org.modelmapper.ModelMapper;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.*;

@Service
@RequiredArgsConstructor
Expand Down Expand Up @@ -137,6 +134,14 @@ public void overrideScanRequestProperties(Sca override, ScanRequest request, Map
scaConfig.setManifestsIncludePattern(manifestsIncludePattern);
overrideReport.put("ManifestsIncludePattern",manifestsIncludePattern);
});
sca.map(Sca :: getProjectTags).ifPresent(projectTags->{
scaConfig.setProjectTags(Arrays.asList(projectTags.split(",")));
overrideReport.put("projectTags", projectTags);
});
sca.map(Sca :: getScanTags).ifPresent(scanTags->{
scaConfig.setScanTags(Arrays.asList(scanTags.split(",")));
overrideReport.put("scanTags", scanTags);
});

overrideSeverityFilters(request, sca, overrideReport);

Expand Down

0 comments on commit 60620e0

Please sign in to comment.