Skip to content

Commit c674f13

Browse files
authored
ci(secu): deploy checkmarx (#5588)
1 parent e201c00 commit c674f13

File tree

3 files changed

+128
-18
lines changed

3 files changed

+128
-18
lines changed

.github/CODEOWNERS

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,27 @@
1-
* @centreon/owners-connectors
1+
* @centreon/owners-connectors
22

3-
*.md @centreon/owners-doc
4-
*.mdx @centreon/owners-doc
3+
*.md @centreon/owners-doc
4+
*.mdx @centreon/owners-doc
55

6-
*.cmake @centreon/owners-cpp
7-
CMakeLists.txt @centreon/owners-cpp
8-
Makefile @centreon/owners-cpp
6+
*.cmake @centreon/owners-cpp
7+
CMakeLists.txt @centreon/owners-cpp
8+
Makefile @centreon/owners-cpp
99

10-
*.pm @centreon/owners-perl
11-
*.pl @centreon/owners-perl
12-
*.t @centreon/owners-perl
10+
*.pm @centreon/owners-perl
11+
*.pl @centreon/owners-perl
12+
*.t @centreon/owners-perl
1313

14-
*.py @centreon/owners-python
14+
*.py @centreon/owners-python
1515

16-
*.sh @centreon/owners-bash
16+
*.sh @centreon/owners-bash
1717

18-
tests/** @centreon/owners-robot-e2e
18+
tests/** @centreon/owners-robot-e2e
1919

20-
.github/** @centreon/owners-pipelines
21-
packaging/** @centreon/owners-perl
22-
selinux/** @centreon/owners-pipelines
23-
.github/scripts/pod_spell_check.t @centreon/owners-perl
20+
.github/** @centreon/owners-pipelines
21+
packaging/** @centreon/owners-perl
22+
selinux/** @centreon/owners-pipelines
23+
.github/scripts/pod_spell_check.t @centreon/owners-perl
2424

25-
.gitleaks.toml @centreon/owners-security
26-
.gitleaksignore @centreon/owners-security
25+
.gitleaks.toml @centreon/owners-security
26+
.gitleaksignore @centreon/owners-security
27+
**/checkmarx-analysis.yml @centreon/owners-security
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Checkmarx scans
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
module_name:
7+
required: true
8+
type: string
9+
module_directory:
10+
required: false
11+
type: string
12+
13+
secrets:
14+
base_uri:
15+
required: true
16+
cx_tenant:
17+
required: true
18+
cx_client_id:
19+
required: true
20+
cx_client_secret:
21+
required: true
22+
23+
jobs:
24+
build:
25+
name: Binary preparation
26+
runs-on: ubuntu-24.04
27+
outputs:
28+
enable_analysis: ${{ steps.routing.outputs.enable_analysis }}
29+
30+
steps:
31+
- name: routing
32+
id: routing
33+
run: |
34+
# Quality gate settings
35+
ENABLE_QG="true"
36+
if [[ "${{ vars.CHECKMARX_QUALITY_GATE }}" != "true" ]]; then
37+
# disabling all QG in case of incident with the service
38+
ENABLE_QG="false"
39+
echo "Skipping analysis. Caused by QG override"
40+
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.user.id }}" == "49699333" ]]; then
41+
# disabling the QG in case of pull request opened by dependabot bot
42+
# As dependabot will ne be able to access GH secrets
43+
ENABLE_QG="false"
44+
echo "Skipping analysis. Caused by dependabot PR"
45+
fi
46+
echo "enable_analysis=$ENABLE_QG" >> $GITHUB_OUTPUT
47+
cat $GITHUB_OUTPUT
48+
49+
pipeline-scan:
50+
needs: [build]
51+
name: Run a pipeline scan
52+
runs-on: ubuntu-24.04
53+
if: needs.build.outputs.enable_analysis == 'true'
54+
55+
steps:
56+
- name: Checkout
57+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
58+
59+
- name: Checkmarx One CLI Action
60+
uses: checkmarx/ast-github-action@ef93013c95adc60160bc22060875e90800d3ecfc # v.2.3.19
61+
with:
62+
project_name: ${{ inputs.module_name }}
63+
base_uri: ${{ secrets.base_uri }}
64+
cx_tenant: ${{ secrets.cx_tenant }}
65+
cx_client_id: ${{ secrets.cx_client_id }}
66+
cx_client_secret: ${{ secrets.cx_client_secret }}
67+
source_dir: "./"
68+
additional_params: --file-filter "!**/.githooks/**" --scan-types "sast,sca,api-security"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: plugins-analysis
2+
3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
5+
cancel-in-progress: true
6+
7+
on:
8+
workflow_dispatch:
9+
schedule:
10+
- cron: '30 0 * * 1-5'
11+
pull_request:
12+
branches:
13+
- develop
14+
- master
15+
push:
16+
branches:
17+
- develop
18+
- master
19+
20+
jobs:
21+
get-environment:
22+
uses: ./.github/workflows/get-environment.yml
23+
24+
checkmarx-analysis:
25+
needs: [get-environment]
26+
if: |
27+
needs.get-environment.outputs.skip_workflow == 'false' &&
28+
github.event.pull_request.draft != 'true'
29+
uses: ./.github/workflows/checkmarx-analysis.yml
30+
with:
31+
module_name: centreon-plugins
32+
secrets:
33+
base_uri: ${{ secrets.AST_RND_SCANS_BASE_URI }}
34+
cx_tenant: ${{ secrets.AST_RND_SCANS_TENANT }}
35+
cx_client_id: ${{ secrets.AST_RND_SCANS_CLIENT_ID }}
36+
cx_client_secret: ${{ secrets.AST_RND_SCANS_CLIENT_SECRET }}
37+
38+
set-skip-label:
39+
needs: [get-environment, checkmarx-analysis]
40+
if: needs.get-environment.outputs.skip_workflow == 'false'
41+
uses: ./.github/workflows/set-pull-request-skip-label.yml

0 commit comments

Comments
 (0)