5
5
push :
6
6
branches :
7
7
- " main"
8
+ pull_request :
9
+ types : [opened, synchronize, reopened]
10
+ branches-ignore :
11
+ - " main"
8
12
pull_request_target :
9
- types : [opened, synchronize]
13
+ types : [opened, synchronize, reopened ]
10
14
branches :
11
15
- " main"
12
16
13
- # TODO: see https://bitwarden.atlassian.net/l/cp/SLtTZJ90 for configuration tips
17
+ permissions : {}
18
+
14
19
jobs :
15
20
check-run :
16
21
name : Check PR run
@@ -19,99 +24,28 @@ jobs:
19
24
contents : read
20
25
21
26
sast :
22
- name : SAST scan
23
- runs-on : ubuntu-22.04
27
+ name : Checkmarx
28
+ uses : bitwarden/gh-actions/.github/workflows/_checkmarx.yml@main
24
29
needs : check-run
30
+ secrets :
31
+ AZURE_SUBSCRIPTION_ID : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
32
+ AZURE_TENANT_ID : ${{ secrets.AZURE_TENANT_ID }}
33
+ AZURE_CLIENT_ID : ${{ secrets.AZURE_CLIENT_ID }}
25
34
permissions :
26
35
contents : read
27
36
pull-requests : write
28
37
security-events : write
29
38
id-token : write
30
39
31
- steps :
32
- - name : Check out repo
33
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34
- with :
35
- ref : ${{ github.event.pull_request.head.sha }}
36
-
37
- - name : Log in to Azure
38
- uses : bitwarden/gh-actions/azure-login@main
39
- with :
40
- subscription_id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
41
- tenant_id : ${{ secrets.AZURE_TENANT_ID }}
42
- client_id : ${{ secrets.AZURE_CLIENT_ID }}
43
-
44
- - name : Get Azure Key Vault secrets
45
- id : get-kv-secrets
46
- uses : bitwarden/gh-actions/get-keyvault-secrets@main
47
- with :
48
- keyvault : gh-org-bitwarden
49
- secrets : " CHECKMARX-TENANT,CHECKMARX-CLIENT-ID,CHECKMARX-SECRET"
50
-
51
- - name : Log out from Azure
52
- uses : bitwarden/gh-actions/azure-logout@main
53
-
54
- - name : Scan with Checkmarx
55
- uses : checkmarx/ast-github-action@9fda4ab4c1b67c35de380552a972a82997d97731 # 2.0.42
56
- env :
57
- INCREMENTAL : " ${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
58
- with :
59
- project_name : ${{ github.repository }}
60
- cx_tenant : ${{ steps.get-kv-secrets.outputs.CHECKMARX-TENANT }}
61
- base_uri : https://ast.checkmarx.net/
62
- cx_client_id : ${{ steps.get-kv-secrets.outputs.CHECKMARX-CLIENT-ID }}
63
- cx_client_secret : ${{ steps.get-kv-secrets.outputs.CHECKMARX-SECRET }}
64
- additional_params : |
65
- --report-format sarif \
66
- --filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \
67
- --output-path . ${{ env.INCREMENTAL }}
68
-
69
- - name : Upload Checkmarx results to GitHub
70
- uses : github/codeql-action/upload-sarif@17a820bf2e43b47be2c72b39cc905417bc1ab6d0 # v3.28.6
71
- with :
72
- sarif_file : cx_result.sarif
73
- sha : ${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.sha }}
74
- ref : ${{ contains(github.event_name, 'pull_request') && format('refs/pull/{0}/head', github.event.pull_request.number) || github.ref }}
75
-
76
40
quality :
77
- name : Quality scan
78
- runs-on : ubuntu-22.04
41
+ name : Sonar
42
+ uses : bitwarden/gh-actions/.github/workflows/_sonar.yml@main
79
43
needs : check-run
44
+ secrets :
45
+ AZURE_SUBSCRIPTION_ID : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
46
+ AZURE_TENANT_ID : ${{ secrets.AZURE_TENANT_ID }}
47
+ AZURE_CLIENT_ID : ${{ secrets.AZURE_CLIENT_ID }}
80
48
permissions :
81
49
contents : read
82
50
pull-requests : write
83
51
id-token : write
84
-
85
- steps :
86
- - name : Check out repo
87
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
88
- with :
89
- fetch-depth : 0
90
- ref : ${{ github.event.pull_request.head.sha }}
91
-
92
- - name : Log in to Azure
93
- uses : bitwarden/gh-actions/azure-login@main
94
- with :
95
- subscription_id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
96
- tenant_id : ${{ secrets.AZURE_TENANT_ID }}
97
- client_id : ${{ secrets.AZURE_CLIENT_ID }}
98
-
99
- - name : Get Azure Key Vault secrets
100
- id : get-kv-secrets
101
- uses : bitwarden/gh-actions/get-keyvault-secrets@main
102
- with :
103
- keyvault : gh-org-bitwarden
104
- secrets : " SONAR-TOKEN"
105
-
106
- - name : Log out from Azure
107
- uses : bitwarden/gh-actions/azure-logout@main
108
-
109
- - name : Scan with SonarCloud
110
- uses : sonarsource/sonarqube-scan-action@aa494459d7c39c106cc77b166de8b4250a32bb97 # v5.1.0
111
- env :
112
- SONAR_TOKEN : ${{ steps.get-kv-secrets.outputs.SONAR-TOKEN }}
113
- with :
114
- args : >
115
- -Dsonar.organization=${{ github.repository_owner }}
116
- -Dsonar.projectKey=${{ github.repository_owner }}_${{ github.event.repository.name }}
117
- -Dsonar.pullrequest.key=${{ github.event.pull_request.number }}
0 commit comments