|
| 1 | +name: Scan |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - "main" |
| 8 | + pull_request_target: |
| 9 | + types: [opened, synchronize] |
| 10 | + |
| 11 | +# TODO: see https://bitwarden.atlassian.net/l/cp/SLtTZJ90 for configuration tips |
| 12 | +jobs: |
| 13 | + check-run: |
| 14 | + name: Check PR run |
| 15 | + uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main |
| 16 | + |
| 17 | + sast: |
| 18 | + name: SAST scan |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + needs: check-run |
| 21 | + permissions: |
| 22 | + contents: read |
| 23 | + pull-requests: write |
| 24 | + security-events: write |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Check out repo |
| 28 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 29 | + with: |
| 30 | + ref: ${{ github.event.pull_request.head.sha }} |
| 31 | + |
| 32 | + - name: Scan with Checkmarx |
| 33 | + uses: checkmarx/ast-github-action@9fda4ab4c1b67c35de380552a972a82997d97731 # 2.0.42 |
| 34 | + env: |
| 35 | + INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}" |
| 36 | + with: |
| 37 | + project_name: ${{ github.repository }} |
| 38 | + cx_tenant: ${{ secrets.CHECKMARX_TENANT }} |
| 39 | + base_uri: https://ast.checkmarx.net/ |
| 40 | + cx_client_id: ${{ secrets.CHECKMARX_CLIENT_ID }} |
| 41 | + cx_client_secret: ${{ secrets.CHECKMARX_SECRET }} |
| 42 | + additional_params: | |
| 43 | + --report-format sarif \ |
| 44 | + --filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \ |
| 45 | + --output-path . ${{ env.INCREMENTAL }} |
| 46 | +
|
| 47 | + - name: Upload Checkmarx results to GitHub |
| 48 | + uses: github/codeql-action/upload-sarif@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6 |
| 49 | + with: |
| 50 | + sarif_file: cx_result.sarif |
| 51 | + |
| 52 | + quality: |
| 53 | + name: Quality scan |
| 54 | + runs-on: ubuntu-22.04 |
| 55 | + needs: check-run |
| 56 | + permissions: |
| 57 | + contents: read |
| 58 | + pull-requests: write |
| 59 | + |
| 60 | + steps: |
| 61 | + - name: Check out repo |
| 62 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 63 | + with: |
| 64 | + fetch-depth: 0 |
| 65 | + ref: ${{ github.event.pull_request.head.sha }} |
| 66 | + |
| 67 | + - name: Scan with SonarCloud |
| 68 | + uses: sonarsource/sonarqube-scan-action@bfd4e558cda28cda6b5defafb9232d191be8c203 # v4.2.1 |
| 69 | + env: |
| 70 | + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
| 71 | + with: |
| 72 | + args: > |
| 73 | + -Dsonar.organization=${{ github.repository_owner }} |
| 74 | + -Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }} |
| 75 | + -Dsonar.pullrequest.key=${{ github.event.pull_request.number }} |
0 commit comments