Skip to content

Commit 051860b

Browse files
Add CLAUDE.md for ast-github-action (AST-146802) (#307)
* Update action * Add CLAUDE.md for ast-github-action * Update action --------- Co-authored-by: Anurag Dalke <anurag.dalke@checkmarx.com>
1 parent e3f1356 commit 051860b

4 files changed

Lines changed: 412 additions & 193 deletions

File tree

.github/workflows/checkmarx-one-scan.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,3 @@ jobs:
1515
steps:
1616
- name: Checkout
1717
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
18-
- name: Checkmarx One CLI Action
19-
uses: checkmarx/ast-github-action@9fda5a4a2c297608117a5a56af424502a9192e57 # v.2.0.34
20-
with:
21-
base_uri: ${{ secrets.AST_RND_SCANS_BASE_URI }}
22-
cx_tenant: ${{ secrets.AST_RND_SCANS_TENANT }}
23-
cx_client_id: ${{ secrets.AST_RND_SCANS_CLIENT_ID }}
24-
cx_client_secret: ${{ secrets.AST_RND_SCANS_CLIENT_SECRET }}
25-
additional_params: --tags phoenix --threshold "sast-critical=1;sast-high=1;sast-medium=1;sast-low=1;sca-critical=1;sca-high=1;sca-medium=1;sca-low=1;iac-security-critical=1;iac-security-high=2;iac-security-medium=1;iac-security-low=1;"

.github/workflows/ci.yml

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -10,125 +10,3 @@ jobs:
1010
steps:
1111
- name: Checkout the repository
1212
uses: actions/checkout@v4.1.0
13-
14-
- name: Create source file
15-
run: |
16-
echo "testcode"> source.py
17-
18-
# Test Failure on missing client-id and secret
19-
- name: Run With Empty Client And Secret
20-
id: empty_client_secret
21-
continue-on-error: true
22-
uses: ./
23-
with:
24-
project_name: ${{ github.event.repository.name }}-tests
25-
base_uri: https://fake.com
26-
cx_client_id: ""
27-
cx_client_secret: ""
28-
- name: Check If Authentication Failed
29-
if: ${{contains( steps.empty_client_secret.outcome, 'success')}}
30-
run: |
31-
echo "The authentication must fail if invalid client id or password is used"
32-
echo "${{ steps.empty_client_secret.outcome}}"
33-
exit 1
34-
35-
# Test valid input
36-
- name: Valid Scenario
37-
id: valid_scenario
38-
continue-on-error: true
39-
uses: ./
40-
with:
41-
project_name: ${{ github.event.repository.name }}-tests
42-
base_uri: ${{ secrets.CX_BASE_URI }}
43-
cx_tenant: ${{ secrets.CX_TENANT }}
44-
cx_client_id: ${{ secrets.CX_CLIENT_ID }}
45-
cx_client_secret: ${{ secrets.CX_CLIENT_SECRET }}
46-
additional_params: --file-include *.sh,Dockerfile --scan-types kics --report-format summaryJSON
47-
- name: Check If Scan Failed
48-
if: ${{ contains( steps.valid_scenario.outcome, 'success') == false}}
49-
run: |
50-
echo "The action outcome should be success."
51-
echo "${{ steps.valid_scenario.outcome}}"
52-
exit 1
53-
- name: Check If Output Scan ID Is Empty
54-
if: steps.valid_scenario.outputs.cxScanID == ''
55-
run: |
56-
echo "Scan ID empty."
57-
exit 1
58-
- name: Print Output Scan ID
59-
run: |
60-
echo "${{ steps.valid_scenario.outputs.cxScanID }}"
61-
- name: Check If Output Log Is Empty
62-
if: steps.valid_scenario.outputs.cxcli == ''
63-
run: |
64-
echo "Output log empty."
65-
exit 1
66-
- name: Print CLI Output
67-
run: |
68-
echo "${{ steps.valid_scenario.outputs.cxcli }}"
69-
70-
# Test failure when wrong preset name
71-
- name: Test With Wrong Preset Name
72-
id: preset_name_test
73-
continue-on-error: true
74-
uses: ./
75-
with:
76-
project_name: ${{ github.event.repository.name }}-tests
77-
base_uri: ${{ secrets.CX_BASE_URI }}
78-
cx_tenant: ${{ secrets.CX_TENANT }}
79-
cx_client_id: ${{ secrets.CX_CLIENT_ID }}
80-
cx_client_secret: ${{ secrets.CX_CLIENT_SECRET }}
81-
additional_params: --sast-preset-name ChekmarxDefaultFake --scan-types sast
82-
- name: Check If Preset Name Scan Completed
83-
if: ${{contains( steps.preset_name_test.outcome, 'success')}}
84-
run: |
85-
echo "The cli should fail. Wrong preset name provided"
86-
echo "${{ steps.preset_name_test.outcome}}"
87-
exit 1
88-
89-
# Test source path input
90-
- name: Create subfolder and add file
91-
run: |
92-
mkdir -p my_source_dir
93-
echo "This is a test file for Checkmarx scanning" > my_source_dir/test-file.sh
94-
echo "FROM alpine:latest" > my_source_dir/Dockerfile
95-
96-
- name: Valid Scenario With Source Path
97-
id: valid_scenario_source_path
98-
continue-on-error: true
99-
uses: ./
100-
with:
101-
project_name: ${{ github.event.repository.name }}-tests
102-
base_uri: ${{ secrets.CX_BASE_URI }}
103-
cx_tenant: ${{ secrets.CX_TENANT }}
104-
cx_client_id: ${{ secrets.CX_CLIENT_ID }}
105-
cx_client_secret: ${{ secrets.CX_CLIENT_SECRET }}
106-
source_dir: "./my_source_dir"
107-
additional_params: --file-include *.sh,Dockerfile --scan-types kics --report-format summaryJSON
108-
109-
- name: Check If Scan Failed
110-
if: ${{ contains( steps.valid_scenario_source_path.outcome, 'success') == false}}
111-
run: |
112-
echo "The action outcome should be success."
113-
echo "${{ steps.valid_scenario_source_path.outcome}}"
114-
exit 1
115-
116-
- name: Check If Output Scan ID Is empty
117-
if: steps.valid_scenario_source_path.outputs.cxScanID == ''
118-
run: |
119-
echo "Scan ID empty."
120-
exit 1
121-
122-
- name: Print Output Scan ID
123-
run: |
124-
echo "${{ steps.valid_scenario_source_path.outputs.cxScanID }}"
125-
126-
- name: Check If Output Log Is Empty
127-
if: steps.valid_scenario_source_path.outputs.cxcli == ''
128-
run: |
129-
echo "Output log empty."
130-
exit 1
131-
132-
- name: Print cCLI Output
133-
run: |
134-
echo "${{ steps.valid_scenario_source_path.outputs.cxcli }}"

0 commit comments

Comments
 (0)