Skip to content

Commit

Permalink
check For Threshold Error (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
swatipersistent authored Jul 23, 2024
1 parent d52ba76 commit 086842f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/com/cx/restclient/configuration/CxScanConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ public void setprojectCustomFields(String projectCustomFields) {
private Boolean osaRunInstall = false;
private Boolean osaThresholdsEnabled = false;
private Boolean osaFailOnError = false;
private Integer osaHighThreshold;
private Integer osaCriticalThreshold;
private Integer osaHighThreshold;
private Integer osaMediumThreshold;
private Integer osaLowThreshold;
private Properties osaFsaConfig; //for MAVEN
Expand Down Expand Up @@ -638,6 +639,14 @@ public Boolean isOsaFailOnError() {
public void setOsaFailOnError(Boolean osaFailOnError) {
this.osaFailOnError = osaFailOnError;
}

public Integer getOsaCriticalThreshold() {
return osaCriticalThreshold;
}

public void setOsaCriticalThreshold(Integer osaCriticalThreshold) {
this.osaCriticalThreshold = osaCriticalThreshold;
}

public Integer getOsaHighThreshold() {
return osaHighThreshold;
Expand Down Expand Up @@ -684,7 +693,7 @@ public boolean isSASTThresholdEffectivelyEnabled() {
public boolean isOSAThresholdEffectivelyEnabled() {
return (isOsaEnabled() || isAstScaEnabled()) &&
getOsaThresholdsEnabled() &&
(getOsaHighThreshold() != null || getOsaMediumThreshold() != null || getOsaLowThreshold() != null);
(getOsaCriticalThreshold() != null || getOsaHighThreshold() != null || getOsaMediumThreshold() != null || getOsaLowThreshold() != null);
}

public void setOsaDependenciesJson(String osaDependenciesJson) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ private void addDependencyScanThresholdErrors(CxScanConfig config, OSAResults os
}

if (hasSummary) {
if (scaResults != null) {
checkForThresholdError(totalCritical, config.getOsaCriticalThreshold(), errorSource, Severity.CRITICAL);
}
checkForThresholdError(totalHigh, config.getOsaHighThreshold(), errorSource, Severity.HIGH);
checkForThresholdError(totalMedium, config.getOsaMediumThreshold(), errorSource, Severity.MEDIUM);
checkForThresholdError(totalLow, config.getOsaLowThreshold(), errorSource, Severity.LOW);
Expand Down

0 comments on commit 086842f

Please sign in to comment.