Skip to content

Commit d3d7976

Browse files
Update scan workflow to use centralized reusable component (#364)
1 parent cab466d commit d3d7976

File tree

1 file changed

+14
-84
lines changed

1 file changed

+14
-84
lines changed

.github/workflows/scan.yml

Lines changed: 14 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -26,100 +26,30 @@ jobs:
2626
contents: read
2727

2828
sast:
29-
name: SAST scan
30-
runs-on: ubuntu-24.04
29+
name: Checkmarx
30+
uses: bitwarden/gh-actions/.github/workflows/_checkmarx.yml@main
3131
needs: check-run
32+
secrets:
33+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
34+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
35+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
3236
permissions:
3337
contents: read
3438
pull-requests: write
3539
security-events: write
3640
id-token: write
3741

38-
steps:
39-
- name: Check out repo
40-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
41-
with:
42-
ref: ${{ github.event.pull_request.head.sha }}
43-
44-
- name: Log in to Azure
45-
uses: bitwarden/gh-actions/azure-login@main
46-
with:
47-
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
48-
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
49-
client_id: ${{ secrets.AZURE_CLIENT_ID }}
50-
51-
- name: Get Azure Key Vault secrets
52-
id: get-kv-secrets
53-
uses: bitwarden/gh-actions/get-keyvault-secrets@main
54-
with:
55-
keyvault: gh-org-bitwarden
56-
secrets: "CHECKMARX-TENANT,CHECKMARX-CLIENT-ID,CHECKMARX-SECRET"
57-
58-
- name: Log out from Azure
59-
uses: bitwarden/gh-actions/azure-logout@main
60-
61-
- name: Scan with Checkmarx
62-
uses: checkmarx/ast-github-action@9fda4ab4c1b67c35de380552a972a82997d97731 # 2.0.42
63-
env:
64-
INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
65-
with:
66-
project_name: ${{ github.repository }}
67-
cx_tenant: ${{ steps.get-kv-secrets.outputs.CHECKMARX-TENANT }}
68-
base_uri: https://ast.checkmarx.net/
69-
cx_client_id: ${{ steps.get-kv-secrets.outputs.CHECKMARX-CLIENT-ID }}
70-
cx_client_secret: ${{ steps.get-kv-secrets.outputs.CHECKMARX-SECRET }}
71-
additional_params: |
72-
--report-format sarif \
73-
--filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \
74-
--output-path . ${{ env.INCREMENTAL }}
75-
76-
- name: Upload Checkmarx results to GitHub
77-
uses: github/codeql-action/upload-sarif@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8
78-
with:
79-
sarif_file: cx_result.sarif
80-
sha: ${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.sha }}
81-
ref: ${{ contains(github.event_name, 'pull_request') && format('refs/pull/{0}/head', github.event.pull_request.number) || github.ref }}
82-
8342
quality:
84-
name: Quality scan
85-
runs-on: ubuntu-24.04
43+
name: Sonar
44+
uses: bitwarden/gh-actions/.github/workflows/_sonar.yml@main
8645
needs: check-run
46+
secrets:
47+
AZURE_SUBSCRIPTION_ID: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
48+
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
49+
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
8750
permissions:
8851
contents: read
8952
pull-requests: write
9053
id-token: write
91-
92-
steps:
93-
- name: Check out repo
94-
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
95-
with:
96-
fetch-depth: 0
97-
ref: ${{ github.event.pull_request.head.sha }}
98-
99-
- name: Log in to Azure
100-
uses: bitwarden/gh-actions/azure-login@main
101-
with:
102-
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
103-
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
104-
client_id: ${{ secrets.AZURE_CLIENT_ID }}
105-
106-
- name: Get Azure Key Vault secrets
107-
id: get-kv-secrets
108-
uses: bitwarden/gh-actions/get-keyvault-secrets@main
109-
with:
110-
keyvault: gh-org-bitwarden
111-
secrets: "SONAR-TOKEN"
112-
113-
- name: Log out from Azure
114-
uses: bitwarden/gh-actions/azure-logout@main
115-
116-
- name: Scan with SonarCloud
117-
uses: sonarsource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5.2.0
118-
env:
119-
SONAR_TOKEN: ${{ steps.get-kv-secrets.outputs.SONAR-TOKEN }}
120-
with:
121-
args: >
122-
-Dsonar.organization=${{ github.repository_owner }}
123-
-Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }}
124-
-Dsonar.exclusions=crates/bitwarden-uniffi/kotlin/**,crates/bitwarden-uniffi/swift/**
125-
-Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
54+
with:
55+
sonar-exclusions: "crates/bitwarden-uniffi/kotlin/**,crates/bitwarden-uniffi/swift/**"

0 commit comments

Comments
 (0)