@@ -41,6 +41,16 @@ name: CI flow containing PR checks for main & release, v2
4141on :
4242 workflow_call :
4343 inputs :
44+ github-event-name :
45+ description : ' GitHub event name (pass github.event_name from calling workflow for PR comment detection)'
46+ required : false
47+ type : string
48+ default : ' '
49+ github-branch-name :
50+ description : ' GitHub branch name (pass github.ref_name from calling workflow for branch-specific logic)'
51+ required : false
52+ type : string
53+ default : ' '
4454 application :
4555 # NEW IN 1.0.7
4656 description : ' Application set in repository custom properties, typically primaryApplication'
146156 required : false
147157 type : boolean
148158 default : false
159+ grype-image-skip-aws :
160+ description : ' Skip Grype image scan on AWS ECR images to avoid rate limits (assumes these images are scanned with Amazon ECR scan or Trivy)'
161+ required : false
162+ type : boolean
163+ default : false
149164 build :
150165 description : ' CI Build (language-specific)'
151166 required : false
@@ -509,7 +524,7 @@ jobs:
509524 echo "GA_BUILD_PROFILE=$GABuildProfile" >> $GITHUB_ENV
510525 continue-on-error : true
511526 env :
512- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
527+ GITHUB_TOKEN : ${{ secrets.GH_TOKEN || secrets. GITHUB_TOKEN }}
513528
514529 - name : generate-filename-slug
515530 # description: Generate a simple slug based on repo and date for use in any output artifacts
@@ -713,7 +728,7 @@ jobs:
713728 if : inputs.language == 'go'
714729 env :
715730 GOPRIVATE : ${{ inputs.go-private-modules }}
716- run : git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/".insteadOf "https://github.com/"
731+ run : git config --global url."https://${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
717732 - name : Go linting and security checks
718733 if : inputs.language == 'go'
719734 run : echo "Running Go linting and security checks"
@@ -782,6 +797,8 @@ jobs:
782797 uses : chef/common-github-actions/.github/workflows/trufflehog.yml@main
783798 needs : checkout
784799 with :
800+ github-event-name : ${{ inputs.github-event-name }}
801+ github-branch-name : ${{ inputs.github-branch-name }}
785802 fail-trufflehog-on-secrets-found : ${{ inputs.fail-trufflehog-on-secrets-found }}
786803
787804 # temporarily commenting out trivy scan due to https://www.stepsecurity.io/blog/hackerbot-claw-github-actions-exploitation
@@ -891,6 +908,7 @@ jobs:
891908 with :
892909 fail-grype-on-high : ${{ inputs.grype-image-fail-on-high }}
893910 fail-grype-on-critical : ${{ inputs.grype-image-fail-on-critical }}
911+ grype-image-skip-aws : ${{ inputs.grype-image-skip-aws }}
894912
895913 # run-srcclr:
896914 # if: ${{ inputs.perform-srcclr-scan == true }}
@@ -923,7 +941,7 @@ jobs:
923941 if : inputs.language == 'go'
924942 env :
925943 GOPRIVATE : ${{ inputs.go-private-modules }}
926- run : git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/".insteadOf "https://github.com/"
944+ run : git config --global url."https://${{ secrets.GH_TOKEN || secrets.GITHUB_TOKEN }}@github.com/".insteadOf "https://github.com/"
927945 - name : ' Go build'
928946 if : ${{ inputs.language == 'go' && env.GA_BUILD_PROFILE == 'cli' }}
929947 continue-on-error : true
@@ -1173,176 +1191,29 @@ jobs:
11731191 # udf3: ${{ inputs.udf3 }}
11741192
11751193 BlackDuck-Polaris-SAST :
1176- # branding: applied at action.yml level, not workflow, see https://docs.github.com/en/actions/reference/workflows-and-actions/metadata-syntax#branding
1177- # icon: 'shield'
1178- # color: 'red'
1179- # TODO: add new flags to BLACKDUCK ${{ polaris-blackduck-executable }} && ${{ polaris-executable-detect-path }}
1180- # NOW THE LATEST COMMUNITY - https://github.com/prgs-community/githubactions-securityscans/blob/main/polaris/action.yml
1181- # # updated to https://documentation.blackduck.com/bundle/bridge/page/documentation/c_download.html#polaris-download
1182- # # https://github.com/marketplace/actions/black-duck-security-scan
1183- # NOT USED - from https://documentation.blackduck.com/bundle/bridge/page/documentation/t_github-polaris-quickstart.html
1184- # parameters @ https://documentation.blackduck.com/bundle/bridge/page/documentation/c_github-polaris.html
1185- # internal confluence https://progresssoftware.atlassian.net/wiki/spaces/TCE/pages/1010336076/Polaris#Examples
1186- # and https://progresssoftware.atlassian.net/wiki/spaces/TCE/pages/1010303415/Polaris+-+Github+Actions+Templates
1187- # chef-vault at https://polaris.blackduck.com/portfolio/portfolios/8b7ad6f7-6dcb-49ec-bded-bfc4f190d4f8/portfolio-items/fe369baf-11d2-4989-bcb7-045577856dcc/projects/2460eabd-d033-48a1-a378-6cadd49be6d1/tests/sast?branchId=a6d2c02a-05f8-4557-bfa1-c40e9337ee5d
1188- if : ${{ inputs.perform-blackduck-polaris == true }}
1189- runs-on : ubuntu-latest
1190- needs : checkout # TODO: fix set-application-version
1191- steps :
1192- - name : Checkout repository
1193- uses : actions/checkout@v6
1194- with :
1195- fetch-depth : 0
1196-
1197- - name : Configure git for private
1198- run : git config --global url."https://${{ secrets.GH_TOKEN }}@github.com/".insteadOf "https://github.com/"
1199-
1200- - name : Install build tools for Erlang
1201- if : inputs.language == 'erlang'
1202- run : |
1203- sudo apt-get update
1204- sudo apt-get install -y build-essential
1205-
1206- - name : Set up Erlang/OTP and rebar3
1207- if : inputs.language == 'erlang'
1208- uses : erlef/setup-beam@v1
1209- with :
1210- otp-version : ' 25.3.2.16'
1211- rebar3-version : ' 3.22.0'
1212-
1213- - name : Set up Ruby
1214- if : inputs.language == 'ruby'
1215- uses : ruby/setup-ruby@v1
1216- with :
1217- ruby-version : ' 3.4'
1218- bundler-cache : false
1219-
1220- - name : Create bundle stub for Erlang SAST scan
1221- if : inputs.language == 'erlang'
1222- working-directory : ${{ github.workspace }}
1223- run : |
1224- # Polaris scans Erlang source code for SAST - Ruby gems not needed
1225- # System ruby-dev from apt provides Ruby runtime (already installed)
1226- # Create bundle stub to skip gem installation during Polaris scan
1227- echo "Creating bundle stub to bypass Ruby gem installation"
1228-
1229- # Create no-op bundle script
1230- mkdir -p "$HOME/.polaris-stubs"
1231- cat > "$HOME/.polaris-stubs/bundle" << 'EOF'
1232- #!/bin/bash
1233- # Stub: skips gem installation during SAST scan
1234- echo "[STUB] Skipping bundle $@ - not needed for Erlang SAST"
1235- exit 0
1236- EOF
1237- chmod +x "$HOME/.polaris-stubs/bundle"
1238-
1239- # Prepend to PATH so stub is found before any system bundler
1240- echo "$HOME/.polaris-stubs" >> $GITHUB_PATH
1241-
1242- echo "Bundle stub created and added to PATH"
1243-
1244- - name : Starting Black Duck Polaris scan
1245- run : |
1246- echo "Starting Polaris SAST scan"
1247- echo "Below variable should be https://polaris.blackduck.com"
1248- echo "POLARIS_SERVER_URL: ${{ secrets.POLARIS_SERVER_URL }}"
1249- echo "Polaris application name: ${{ inputs.polaris-application-name }}"
1250- echo "Polaris project name: ${{ inputs.polaris-project-name }}"
1251- echo "POLARIS_ACCESS_TOKEN: ${{ secrets.POLARIS_ACCESS_TOKEN }}"
1252- continue-on-error : true
1253- # other polaris/coverity flags (unused): working-directory, config-path, coverity-config-path, coverity-build-command, coverity-clean-command, coverity-args,
1254- # detect-search-depth, detect-args, assessment-mode, source-archive, source-excludes, preserve-symlinks, wait-for-scan, mark-build-status:, pr-comment-severities, diagnostic
1255-
1256- - name : Check input variables
1257- run : |
1258- if [[ -z "${{ inputs.polaris-application-name }}" ]] || [[ -z "${{ inputs.polaris-project-name }}" ]]; then
1259- echo "Polaris application name and project name must be set"
1260- exit 1
1261- fi
1262-
1263- - name : BlackDuck Polaris scan
1264- id : polaris-scan
1265- uses : blackduck-inc/black-duck-security-scan@v2
1266- # copied from uses: prgs-community/githubactions-securityscans/polaris@v0.5 in https://github.com/prgs-community/githubactions-securityscans/blob/main/polaris/README.md
1267- # uses: blackduck-inc/black-duck-security-scan@805cbd09e806b01907bbea0f990723c2bb85abe9 # 2.0.0 - Jan's version
1268- with :
1269- # ## SCANNING: Required fields
1270- polaris_server_url : ${{ secrets.POLARIS_SERVER_URL }} # https://polaris.blackduck.com
1271- polaris_access_token : ${{ secrets.POLARIS_ACCESS_TOKEN }}
1272- polaris_application_name : " ${{ inputs.polaris-application-name }}"
1273- # project name schema: <Solution>-<Product>-<Module If Applicable>-<Optional Numeric Suffix If Needed>
1274- polaris_project_name : ${{ inputs.polaris-project-name }} # typically GitHub repo name
1275- polaris_assessment_types : " SAST" # or "CI" or "SOURCE_UPLOAD", a license type
1276- # new in 1.0.7, OPTIONAL FIELDS
1277- project_directory : ${{ inputs.polaris-working-directory }}
1278- detect_config_path : ${{ inputs.polaris-config-path != '' && inputs.polaris-config-path || null}}
1279- coverity_config_path : ${{ inputs.polaris-coverity-config-path != '' && inputs.polaris-coverity-config-path || null }}
1280- coverity_build_command : ${{ inputs.polaris-coverity-build-command != '' && inputs.polaris-coverity-build-command || null }}
1281- coverity_clean_command : ${{ inputs.polaris-coverity-clean-command != '' && inputs.polaris-coverity-clean-command || null }}
1282- coverity_args : ${{ inputs.polaris-coverity-args != '' && inputs.polaris-coverity-args || null }}
1283- detect_search_depth : ${{ inputs.polaris-detect-search-depth != '' && inputs.polaris-detect-search-depth || null }}
1284- detect_args : ${{ inputs.polaris-detect-args != '' && inputs.polaris-detect-args || null }}
1285- polaris_assessment_mode : ${{ inputs.polaris-assessment-mode }}
1286- # TODO: warning in GA - polaris_assessment_mode is deprecated. Use polaris_test_sast_location=remote and/or polaris_test_sca_location=remote for source upload scans instead.
1287- polaris_waitForScan : ' true' # ${{ inputs.polaris-wait-for-scan }} # defaults to true - is this a boolean or string?
1288- # not yet enabled from https://github.com/prgs-community/githubactions-securityscans/blob/main/polaris/README.md
1289- # project_source_archive: ${{ inputs.polaris-source-archive != '' && inputs.polaris-source-archive || null }}
1290- # project_source_excludes: ${{ inputs.polaris-source-excludes != '' && inputs.polaris-source-excludes || null }}
1291- # project_source_preserveSymLinks: ${{ inputs.polaris-preserve-symlinks }}
1292- # include_diagnostics: ${{ inputs.polaris-diagnostic }}
1293- # mark_build_status: ${{ inputs.polaris-mark-build-status != '' && inputs.polaris-mark-build-status || null }}
1294- # pr-comment-severities: "CRITICAL,HIGH"
1295- github_token : ${{ secrets.GITHUB_TOKEN }}
1296-
1297- # options from Jan's (FlowMon. GitLab)
1298- # polaris_prComment_enabled: ${{ github.event_name == 'pull_request' && 'true' || 'false' }}
1299- # polaris_prComment_severities: "CRITICAL,HIGH"
1300- # from Blackduck page at https://polaris.blackduck.com/portfolio/portfolios/8b7ad6f7-6dcb-49ec-bded-bfc4f190d4f8/portfolio-items/fe369baf-11d2-4989-bcb7-045577856dcc/projects
1301- # SARIF report parameters
1302- # polaris_reports_sarif_create: true
1303- # polaris_upload_sarif_report: true
1304- # Mark build status if policy violating issues are found
1305- # mark_build_status: 'success'
1306- continue-on-error : false
1307-
1308- - name : Check Polaris scan results and fail on HIGH or CRITICAL vulnerabilities
1309- if : ${{ inputs.polaris-fail-on-high == true || inputs.polaris-fail-on-critical == true }}
1310- run : |
1311- echo "Checking Polaris SAST scan results..."
1312- echo "Enforcement policy: HIGH=${{ inputs.polaris-fail-on-high }}, CRITICAL=${{ inputs.polaris-fail-on-critical }}"
1313-
1314- # Parse bridge.log for vulnerability counts
1315- BRIDGE_LOG=".bridge/bridge.log"
1316-
1317- if [ ! -f "$BRIDGE_LOG" ]; then
1318- echo "⚠️ Bridge log not found - failing as precaution"
1319- exit 1
1320- fi
1321-
1322- # Extract vulnerability counts from log
1323- HIGH_COUNT=$(grep -oP '"high":\s*\K\d+' "$BRIDGE_LOG" | tail -1 || echo 0)
1324- CRITICAL_COUNT=$(grep -oP '"critical":\s*\K\d+' "$BRIDGE_LOG" | tail -1 || echo 0)
1325-
1326- echo "Found HIGH: $HIGH_COUNT, CRITICAL: $CRITICAL_COUNT"
1327-
1328- # Check for policy violations
1329- SHOULD_FAIL=false
1330-
1331- if [ "${{ inputs.polaris-fail-on-critical }}" == "true" ] && [ "$CRITICAL_COUNT" -gt 0 ]; then
1332- echo "❌ Found $CRITICAL_COUNT CRITICAL vulnerabilities (policy violation)"
1333- SHOULD_FAIL=true
1334- fi
1335-
1336- if [ "${{ inputs.polaris-fail-on-high }}" == "true" ] && [ "$HIGH_COUNT" -gt 0 ]; then
1337- echo "❌ Found $HIGH_COUNT HIGH vulnerabilities (policy violation)"
1338- SHOULD_FAIL=true
1339- fi
1340-
1341- if [ "$SHOULD_FAIL" == "true" ]; then
1342- exit 1
1343- else
1344- echo "✅ No policy-violating vulnerabilities found"
1345- fi
1194+ name : ' BlackDuck Polaris SAST scan'
1195+ if : ${{ inputs.perform-blackduck-polaris }}
1196+ uses : chef/common-github-actions/.github/workflows/polaris-sast.yml@main
1197+ needs : checkout
1198+ secrets : inherit
1199+ with :
1200+ github-event-name : ${{ inputs.github-event-name }}
1201+ github-branch-name : ${{ inputs.github-branch-name }}
1202+ language : ${{ inputs.language }}
1203+ polaris-application-name : ${{ inputs.polaris-application-name }}
1204+ polaris-project-name : ${{ inputs.polaris-project-name }}
1205+ polaris-working-directory : ${{ inputs.polaris-working-directory }}
1206+ polaris-config-path : ${{ inputs.polaris-config-path }}
1207+ polaris-coverity-config-path : ${{ inputs.polaris-coverity-config-path }}
1208+ polaris-coverity-clean-command : ${{ inputs.polaris-coverity-clean-command }}
1209+ polaris-coverity-build-command : ${{ inputs.polaris-coverity-build-command }}
1210+ polaris-coverity-args : ${{ inputs.polaris-coverity-args }}
1211+ polaris-detect-search-depth : ${{ inputs.polaris-detect-search-depth }}
1212+ polaris-detect-args : ${{ inputs.polaris-detect-args }}
1213+ polaris-assessment-mode : ${{ inputs.polaris-assessment-mode }}
1214+ wait-for-scan : ${{ inputs.wait-for-scan }}
1215+ polaris-fail-on-high : ${{ inputs.polaris-fail-on-high }}
1216+ polaris-fail-on-critical : ${{ inputs.polaris-fail-on-critical }}
13461217
13471218 package-binary :
13481219 name : ' Creating packaged binaries'
@@ -1593,6 +1464,8 @@ jobs:
15931464 needs : checkout # TODO: fix set-application-version
15941465 secrets : inherit
15951466 with :
1467+ github-event-name : ${{ inputs.github-event-name }}
1468+ github-branch-name : ${{ inputs.github-branch-name }}
15961469 version : ${{ inputs.version }}
15971470 export-github-sbom : ${{ inputs.export-github-sbom }}
15981471 perform-blackduck-sca-scan : ${{ inputs.perform-blackduck-sca-scan }}
0 commit comments