Skip to content

Commit 3913c23

Browse files
Update scan workflow to use centralized reusable component (#1290)
## 🎟️ Tracking https://bitwarden.atlassian.net/browse/VULN-254 ## 📔 Objective Use the new reusable workflow file in the gh-actions repo. This allows modularity as well as easier maintenance, while reducing copied code. ## ⏰ Reminders before review - Contributor guidelines followed - All formatters and local linters executed and passed - Written new unit and / or integration tests where applicable - Protected functional changes with optionality (feature flags) - Used internationalization (i18n) for all UI strings - CI builds passed - Communicated to DevOps any deployment requirements - Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team ## 🦮 Reviewer guidelines <!-- Suggested interactions but feel free to use (or not) as you desire! --> - 👍 (`:+1:`) or similar for great changes - 📝 (`:memo:`) or ℹ️ (`:information_source:`) for notes or general info - ❓ (`:question:`) for questions - 🤔 (`:thinking:`) or 💭 (`:thought_balloon:`) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion - 🎨 (`:art:`) for suggestions / improvements - ❌ (`:x:`) or ⚠️ (`:warning:`) for more significant problems or concerns needing attention - 🌱 (`:seedling:`) or ♻️ (`:recycle:`) for future improvements or indications of technical debt - ⛏ (`:pick:`) for minor or nitpick changes
1 parent 6a2178c commit 3913c23

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
@@ -16,6 +16,8 @@ on:
1616
branches:
1717
- "main"
1818

19+
permissions: {}
20+
1921
jobs:
2022
check-run:
2123
name: Check PR run
@@ -24,100 +26,28 @@ jobs:
2426
contents: read
2527

2628
sast:
27-
name: SAST scan
28-
runs-on: ubuntu-22.04
29+
name: Checkmarx
30+
uses: bitwarden/gh-actions/.github/workflows/_checkmarx.yml@main
2931
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 }}
3036
permissions:
3137
contents: read
3238
pull-requests: write
3339
security-events: write
3440
id-token: write
3541

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

0 commit comments

Comments
 (0)