209209 required : false
210210 default : true
211211 type : boolean
212+ polaris-fail-on-high :
213+ description : ' Fail the pipeline if Polaris SAST scan finds HIGH vulnerabilities'
214+ required : false
215+ type : boolean
216+ default : false
217+ polaris-fail-on-critical :
218+ description : ' Fail the pipeline if Polaris SAST scan finds CRITICAL vulnerabilities'
219+ required : false
220+ type : boolean
221+ default : false
212222
213223 perform-sonarqube-scan :
214224 description : ' Perform basic SonarQube scan'
379389 required : false
380390 type : string
381391 default : ' '
392+ blackduck-fail-on-blocker :
393+ description : ' Fail the pipeline if BlackDuck SCA scan finds BLOCKER vulnerabilities'
394+ required : false
395+ type : boolean
396+ default : false
397+ blackduck-fail-on-critical :
398+ description : ' Fail the pipeline if BlackDuck SCA scan finds CRITICAL vulnerabilities'
399+ required : false
400+ type : boolean
401+ default : false
402+ blackduck-fail-on-major :
403+ description : ' Fail the pipeline if BlackDuck SCA scan finds MAJOR vulnerabilities'
404+ required : false
405+ type : boolean
406+ default : false
382407
383408 udf1 :
384409 description : ' User defined flag 1'
@@ -715,13 +740,13 @@ jobs:
715740 run-trufflehog :
716741 name : ' Trufflehog scan'
717742 if : ${{ inputs.perform-trufflehog-scan }}
718- uses : chef/common-github-actions/.github/workflows/trufflehog.yml@main
743+ uses : chef/common-github-actions/.github/workflows/trufflehog.yml@sandhi/fix-blackduc-sca
719744 needs : checkout
720745
721746 run-trivy :
722747 name : ' Trivy scan'
723748 if : ${{ inputs.perform-trivy-scan }}
724- uses : chef/common-github-actions/.github/workflows/trivy.yml@main
749+ uses : chef/common-github-actions/.github/workflows/trivy.yml@sandhi/fix-blackduc-sca
725750 needs : checkout
726751 with :
727752 version : ${{ inputs.version }}
@@ -1093,6 +1118,7 @@ jobs:
10931118 fi
10941119
10951120 - name : BlackDuck Polaris scan
1121+ id : polaris-scan
10961122 uses : blackduck-inc/black-duck-security-scan@v2
10971123 # copied from uses: prgs-community/githubactions-securityscans/polaris@v0.5 in https://github.com/prgs-community/githubactions-securityscans/blob/main/polaris/README.md
10981124 # uses: blackduck-inc/black-duck-security-scan@805cbd09e806b01907bbea0f990723c2bb85abe9 # 2.0.0 - Jan's version
@@ -1135,6 +1161,45 @@ jobs:
11351161 # Mark build status if policy violating issues are found
11361162 # mark_build_status: 'success'
11371163 continue-on-error : false
1164+
1165+ - name : Check Polaris scan results and fail on HIGH or CRITICAL vulnerabilities
1166+ if : ${{ inputs.polaris-fail-on-high == true || inputs.polaris-fail-on-critical == true }}
1167+ run : |
1168+ echo "Checking Polaris SAST scan results..."
1169+ echo "Enforcement policy: HIGH=${{ inputs.polaris-fail-on-high }}, CRITICAL=${{ inputs.polaris-fail-on-critical }}"
1170+
1171+ # Parse bridge.log for vulnerability counts
1172+ BRIDGE_LOG=".bridge/bridge.log"
1173+
1174+ if [ ! -f "$BRIDGE_LOG" ]; then
1175+ echo "⚠️ Bridge log not found - failing as precaution"
1176+ exit 1
1177+ fi
1178+
1179+ # Extract vulnerability counts from log
1180+ HIGH_COUNT=$(grep -oP '"high":\s*\K\d+' "$BRIDGE_LOG" | tail -1 || echo 0)
1181+ CRITICAL_COUNT=$(grep -oP '"critical":\s*\K\d+' "$BRIDGE_LOG" | tail -1 || echo 0)
1182+
1183+ echo "Found HIGH: $HIGH_COUNT, CRITICAL: $CRITICAL_COUNT"
1184+
1185+ # Check for policy violations
1186+ SHOULD_FAIL=false
1187+
1188+ if [ "${{ inputs.polaris-fail-on-critical }}" == "true" ] && [ "$CRITICAL_COUNT" -gt 0 ]; then
1189+ echo "❌ Found $CRITICAL_COUNT CRITICAL vulnerabilities (policy violation)"
1190+ SHOULD_FAIL=true
1191+ fi
1192+
1193+ if [ "${{ inputs.polaris-fail-on-high }}" == "true" ] && [ "$HIGH_COUNT" -gt 0 ]; then
1194+ echo "❌ Found $HIGH_COUNT HIGH vulnerabilities (policy violation)"
1195+ SHOULD_FAIL=true
1196+ fi
1197+
1198+ if [ "$SHOULD_FAIL" == "true" ]; then
1199+ exit 1
1200+ else
1201+ echo "✅ No policy-violating vulnerabilities found"
1202+ fi
11381203
11391204 package-binary :
11401205 name : ' Creating packaged binaries'
@@ -1381,7 +1446,7 @@ jobs:
13811446 name : ' Generating SBOM'
13821447 # Create software bill-of-materials (SBOM) using SPDX format
13831448 if : ${{ inputs.generate-sbom == true }}
1384- uses : chef/common-github-actions/.github/workflows/sbom.yml@main
1449+ uses : chef/common-github-actions/.github/workflows/sbom.yml@sandhi/fix-blackduc-sca
13851450 needs : checkout # TODO: fix set-application-version
13861451 secrets : inherit
13871452 with :
@@ -1398,6 +1463,9 @@ jobs:
13981463 run-bundle-install : ${{ inputs.run-bundle-install }} # Passed to sbom.yml to generate Gemfile.lock at runtime
13991464 language : ${{ inputs.language }}
14001465 ruby-app-directory : ${{ inputs.ruby-app-directory }}
1466+ blackduck-fail-on-blocker : ${{ inputs.blackduck-fail-on-blocker }}
1467+ blackduck-fail-on-critical : ${{ inputs.blackduck-fail-on-critical }}
1468+ blackduck-fail-on-major : ${{ inputs.blackduck-fail-on-major }}
14011469
14021470 quality-dashboard :
14031471 name : ' Reporting to quality dashboard'
0 commit comments