-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheckmarx_test.sh
More file actions
executable file
·70 lines (56 loc) · 2.26 KB
/
Copy pathcheckmarx_test.sh
File metadata and controls
executable file
·70 lines (56 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/sh
export CX_REFRESH_TOKEN="TOKEN in One PAssword - Alex Test API Key"
response=$(curl -X POST \
https://deu.iam.checkmarx.net/auth/realms/kosli-nfr/protocol/openid-connect/token \
--data "grant_type=refresh_token" \
--data "client_id=ast-app" \
--data "refresh_token=${CX_REFRESH_TOKEN}")
accessToken=$(echo $response | jq -r '.access_token')
# curl --request GET \
# https://deu.ast.checkmarx.net/api/projects/ \
# --header 'Accept: application/json; version=1.0' \
# --header "Authorization: Bearer ${accessToken}" \
# --header 'CorrelationId: ' | jq .
# curl --request POST \
# https://deu.ast.checkmarx.net/api/scans/ \
# --header 'Accept: application/json' \
# --header "Authorization: Bearer ${accessToken}" \
# --header 'Content-Type: application/json; version=1.0' \
# --data '{
# "project": {
# "id": "0af76263-3d75-482c-ae9e-171b7d046e7c"
# },
# "type": "git",
# "handler": {
# "repoUrl": "https://github.com/kosli-dev/jenkins-java-example",
# "branch": "develop"
# },
# "config": [
# {
# "type": "sast",
# "value": {
# "incremental": "false",
# "presetName": "All"
# }
# }
# ]
# }'
baseScanId="eaa79f5d-b5c2-4cd8-b399-05fb782c1ff7"
# scanId="8f55d125-a813-4a5f-beb6-23cd3e108547"
sastScanId="791e17cc-ea29-459e-a775-a78fbde1e5ce"
scanId=$sastScanId
# # # Get scan status
# curl --request GET \
# --url https://deu.ast.checkmarx.net/api/scans/${scanId} \
# --header 'Accept: application/json; version=1.0' \
# --header "Authorization: Bearer ${accessToken}" | jq .
# # Get detailed scan results
# curl --request GET \
# --url https://deu.ast.checkmarx.net/api/results?scan-id=${scanId} \
# --header 'Accept: application/json; version=1.0' \
# --header "Authorization: Bearer ${accessToken}" | jq .
# Get detailed SAST scan results and check status
result=$(curl --silent --request GET \
--url "https://deu.ast.checkmarx.net/api/sast-results/compare?scan-id=${scanId}&base-scan-id=${baseScanId}" \
--header 'Accept: application/json; version=1.0' \
--header "Authorization: Bearer ${accessToken}")