@@ -24,111 +24,30 @@ jobs:
24
24
contents : read
25
25
26
26
sast :
27
- name : SAST scan
28
- runs-on : ubuntu-22.04
27
+ name : Checkmarx
28
+ uses : bitwarden/gh-actions/.github/workflows/_checkmarx.yml@main
29
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 }}
30
34
permissions :
31
35
contents : read
32
36
pull-requests : write
33
37
security-events : write
34
38
id-token : write
35
39
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@184bf2f64f55d1c93fd6636d539edf274703e434 # 2.0.41
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@b6a472f63d85b9c78a3ac5e89422239fc15e9b3c # v3.28.1
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
-
81
40
quality :
82
- name : Quality scan
83
- runs-on : ubuntu-22.04
41
+ name : Sonar
42
+ uses : bitwarden/gh-actions/.github/workflows/_sonar.yml@main
84
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 }}
85
48
permissions :
86
49
contents : read
87
50
pull-requests : write
88
51
id-token : write
89
-
90
- steps :
91
- - name : Set up JDK 17
92
- uses : actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
93
- with :
94
- java-version : 17
95
- distribution : " zulu"
96
-
97
- - name : Check out repo
98
- uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
99
- with :
100
- fetch-depth : 0
101
- ref : ${{ github.event.pull_request.head.sha }}
102
-
103
- - name : Set up .NET
104
- uses : actions/setup-dotnet@87b7050bc53ea08284295505d98d2aa94301e852 # v4.2.0
105
-
106
- - name : Install SonarCloud scanner
107
- run : dotnet tool install dotnet-sonarscanner -g
108
-
109
- - name : Log in to Azure
110
- uses : bitwarden/gh-actions/azure-login@main
111
- with :
112
- subscription_id : ${{ secrets.AZURE_SUBSCRIPTION_ID }}
113
- tenant_id : ${{ secrets.AZURE_TENANT_ID }}
114
- client_id : ${{ secrets.AZURE_CLIENT_ID }}
115
-
116
- - name : Get Azure Key Vault secrets
117
- id : get-kv-secrets
118
- uses : bitwarden/gh-actions/get-keyvault-secrets@main
119
- with :
120
- keyvault : gh-org-bitwarden
121
- secrets : " SONAR-TOKEN"
122
-
123
- - name : Log out from Azure
124
- uses : bitwarden/gh-actions/azure-logout@main
125
-
126
- - name : Scan with SonarCloud
127
- env :
128
- SONAR_TOKEN : ${{ steps.get-kv-secrets.outputs.SONAR-TOKEN }}
129
- run : |
130
- dotnet-sonarscanner begin /k:"${{ github.repository_owner }}_${{ github.event.repository.name }}" \
131
- /o:"${{ github.repository_owner }}" /d:sonar.token="${{ steps.get-kv-secrets.outputs.SONAR-TOKEN }}" \
132
- /d:sonar.host.url="https://sonarcloud.io" ${{ contains(github.event_name, 'pull_request') && format('/d:sonar.pullrequest.key={0}', github.event.pull_request.number) || '' }}
133
- dotnet build
134
- dotnet-sonarscanner end /d:sonar.token="${{ steps.get-kv-secrets.outputs.SONAR-TOKEN }}"
52
+ with :
53
+ sonar-config : " dotnet"
0 commit comments