Skip to content

Commit

Permalink
fix bash script (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecosta09 authored Oct 9, 2023
1 parent b589903 commit 4fab15b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pull-scan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ cat "$SCAN_RESULT_ARTIFACT"

# Evaluates the result
MESSAGE=""
TOTAL_VULNERABILITIES="$(jq '.totalVulnCount' "$SCAN_RESULT_ARTIFACT")"
TOTAL_VULNERABILITIES="$(jq '.vulnerability.totalVulnCount' "$SCAN_RESULT_ARTIFACT")"
if [ "$TOTAL_VULNERABILITIES" -gt "$MAX_TOTAL" ]; then MESSAGE+="Your total vulnerabilities is $TOTAL_VULNERABILITIES, which is higher than $MAX_TOTAL"; fi
TOTAL_CRITICAL="$(jq '.criticalCount' "$SCAN_RESULT_ARTIFACT")"
TOTAL_CRITICAL="$(jq '.vulnerability.criticalCount' "$SCAN_RESULT_ARTIFACT")"
if [ "$TOTAL_CRITICAL" -gt "$MAX_CRITICAL" ]; then MESSAGE+="Your total of Critical vulnerabilities is $TOTAL_CRITICAL, which is higher than $MAX_CRITICAL"; fi
TOTAL_HIGH="$(jq '.highCount' "$SCAN_RESULT_ARTIFACT")"
TOTAL_HIGH="$(jq '.vulnerability.highCount' "$SCAN_RESULT_ARTIFACT")"
if [ "$TOTAL_HIGH" -gt "$MAX_HIGH" ]; then MESSAGE+="Your total of High vulnerabilities is $TOTAL_HIGH, which is higher than $MAX_HIGH"; fi
TOTAL_MEDIUM="$(jq '.mediumCount' "$SCAN_RESULT_ARTIFACT")"
TOTAL_MEDIUM="$(jq '.vulnerability.mediumCount' "$SCAN_RESULT_ARTIFACT")"
if [ "$TOTAL_MEDIUM" -gt "$MAX_MEDIUM" ]; then MESSAGE+="Your total of Medium vulnerabilities is $TOTAL_MEDIUM, which is higher than $MAX_MEDIUM"; fi
TOTAL_LOW="$(jq '.lowCount' "$SCAN_RESULT_ARTIFACT")"
TOTAL_LOW="$(jq '.vulnerability.lowCount' "$SCAN_RESULT_ARTIFACT")"
if [ "$TOTAL_LOW" -gt "$MAX_LOW" ]; then MESSAGE+="Your total of Low vulnerabilities is $TOTAL_LOW, which is higher than $MAX_LOW"; fi
TOTAL_NEGLIGIBLE="$(jq '.negligibleCount' "$SCAN_RESULT_ARTIFACT")"
TOTAL_NEGLIGIBLE="$(jq '.vulnerability.negligibleCount' "$SCAN_RESULT_ARTIFACT")"
if [ "$TOTAL_NEGLIGIBLE" -gt "$MAX_NEGLIGIBLE" ]; then MESSAGE+="Your total of Negligible vulnerabilities is $TOTAL_NEGLIGIBLE, which is higher than $MAX_NEGLIGIBLE"; fi
TOTAL_UNKNOWN="$(jq '.unknownCount' "$SCAN_RESULT_ARTIFACT")"
TOTAL_UNKNOWN="$(jq '.vulnerability.unknownCount' "$SCAN_RESULT_ARTIFACT")"
if [ "$TOTAL_UNKNOWN" -gt "$MAX_UNKNOWN" ]; then MESSAGE+="Your total of Unknown vulnerabilities is $TOTAL_UNKNOWN, which is higher than $MAX_UNKNOWN"; fi

# Issue found
Expand Down

0 comments on commit 4fab15b

Please sign in to comment.