11name : " AccuKnox SQ-SAST Scanner"
22description : " Run SonarQube-based SAST scan and upload results to AccuKnox Panel."
33
4- branding :
5- icon : " shield"
4+ branding :
5+ icon : " shield"
66 color : " purple"
77
88inputs :
99 skip_sonar_scan :
10- description : ' Whether to skip the SonarQube scan.'
10+ description : " Whether to skip the SonarQube scan."
1111 required : false
12- default : ' false'
12+ default : " false"
1313 sonar_project_key :
14- description : ' SonarQube project key'
14+ description : " SonarQube project key"
1515 required : true
1616 sonar_org_id :
17- description : ' SonarQube organisation ID (cloud only)'
17+ description : " SonarQube organisation ID (cloud only)"
1818 required : false
1919 sonar_token :
20- description : ' SonarQube authentication token'
20+ description : " SonarQube authentication token"
2121 required : true
2222 sonar_host_url :
23- description : ' SonarQube host URL'
23+ description : " SonarQube host URL"
2424 required : true
2525 soft_fail :
26- description : ' Do not fail the pipeline if scan finds issues'
26+ description : " Do not fail the pipeline if scan finds issues"
2727 required : false
28- default : ' false'
28+ default : " false"
2929 accuknox_endpoint :
30- description : ' AccuKnox CSPM panel endpoint URL'
30+ description : " AccuKnox CSPM panel endpoint URL"
3131 required : true
3232 accuknox_token :
33- description : ' AccuKnox authentication token'
33+ description : " AccuKnox authentication token"
3434 required : true
3535 accuknox_label :
36- description : ' Label for associating scan results in AccuKnox'
36+ description : " Label for associating scan results in AccuKnox"
3737 required : true
3838
3939runs :
5151 ACCUKNOX_ENDPOINT : ${{ inputs.accuknox_endpoint }}
5252 ACCUKNOX_TOKEN : ${{ inputs.accuknox_token }}
5353 ACCUKNOX_LABEL : ${{ inputs.accuknox_label }}
54+
5455 run : |
56+ echo "🔹 Starting AccuKnox SQ-SAST Scan..."
57+
58+ # Normalise soft fail flag
5559 SOFT_FAIL="${SOFT_FAIL//[$'\t\r\n ']}"
5660 SOFT_FAIL_ARG=""
5761 if [ "$SOFT_FAIL" = "true" ]; then
@@ -62,18 +66,27 @@ runs:
6266 curl -L https://github.com/accuknox/aspm-scanner-cli/releases/download/v0.13.4/accuknox-aspm-scanner -o accuknox-aspm-scanner
6367 chmod +x accuknox-aspm-scanner
6468
65- # Build SonarQube command string
69+ # Build SonarQube properties (no skip flag here)
6670 CMD_ARGS="-Dsonar.projectKey=$SONAR_PROJECT_KEY \
6771 -Dsonar.token=$SONAR_TOKEN \
6872 -Dsonar.host.url=$SONAR_HOST_URL \
6973 -Dsonar.qualitygate.wait=true"
7074
75+ # Add optional org id
7176 [ -n "$SONAR_ORG_ID" ] && CMD_ARGS="$CMD_ARGS -Dsonar.organization=$SONAR_ORG_ID"
72- [ "$SKIP_SONAR_SCAN" = "true" ] && CMD_ARGS="--skip-sonar-scan $CMD_ARGS"
7377
74- # Run the scanner (AccuKnox env variables now used instead of CLI args)
75- echo "./accuknox-aspm-scanner scan $SOFT_FAIL_ARG sq-sast --command \"$CMD_ARGS\" --repo-url \"$GITHUB_REPOSITORY\" --branch \"${GITHUB_REF#refs/heads/}\" --commit-sha \"$GITHUB_SHA\" --pipeline-url \"$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID\" --container-mode"
76- ./accuknox-aspm-scanner scan $SOFT_FAIL_ARG sq-sast --command "$CMD_ARGS" \
78+ # Add optional --skip-sonar-scan flag OUTSIDE the command string
79+ SKIP_FLAG=""
80+ if [ "$SKIP_SONAR_SCAN" = "true" ]; then
81+ SKIP_FLAG="--skip-sonar-scan"
82+ fi
83+
84+ echo "Executing scan with parameters:"
85+ echo "SOFT_FAIL_ARG: $SOFT_FAIL_ARG"
86+ echo "CMD_ARGS: $CMD_ARGS"
87+
88+ ./accuknox-aspm-scanner scan $SOFT_FAIL_ARG sq-sast $SKIP_FLAG \
89+ --command "$CMD_ARGS" \
7790 --repo-url "$GITHUB_REPOSITORY" \
7891 --branch "${GITHUB_REF#refs/heads/}" \
7992 --commit-sha "$GITHUB_SHA" \
0 commit comments