forked from AErmie/DevSecOps
-
Notifications
You must be signed in to change notification settings - Fork 4
/
kics-pipeline.yml
70 lines (58 loc) · 2.55 KB
/
kics-pipeline.yml
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
69
70
trigger: none
pr: none
pool:
vmImage: 'ubuntu-latest'
stages:
- stage: QualityCheckStage
displayName: Quality Check Stage
jobs:
- job: KICSJob
displayName: Run KICS Scan
steps:
# - script: |
# get_latest_kics_release() {
# curl --silent "https://api.github.com/repos/Checkmarx/kics/releases/latest" |
# grep '"tag_name":' |
# sed -E 's/.*"([^"]+)".*/\1/'
# }
# OS=$(uname -s)
# LATEST_TAG=$(get_latest_kics_release)
# LATEST_VERSION=${LATEST_TAG#v}
# PACKAGE_NAME=kics_${LATEST_VERSION}_${OS}_x64.tar.gz
# TARGET_DIR=/home/vsts/kics
# mkdir -p ${TARGET_DIR}
# wget -q -c https://github.com/Checkmarx/kics/releases/download/${LATEST_TAG}/${PACKAGE_NAME} -O - | tar -xz -C ${TARGET_DIR}
# echo '--- START SCANNING ---'
# ${TARGET_DIR}/kics --no-progress -q ${TARGET_DIR}/assets/queries -p ${PWD} -o ${PWD}/kics-results.json
# TOTAL_SEVERITY_COUNTER=`grep '"total_counter"':' ' kics-results.json | awk {'print $2'}`
# export SEVERITY_COUNTER_HIGH=`grep '"HIGH"':' ' kics-results.json | awk {'print $2'} | sed 's/.$//'`
# SEVERITY_COUNTER_MEDIUM=`grep '"INFO"':' ' kics-results.json | awk {'print $2'} | sed 's/.$//'`
# SEVERITY_COUNTER_LOW=`grep '"LOW"':' ' kics-results.json | awk {'print $2'} | sed 's/.$//'`
# SEVERITY_COUNTER_INFO=`grep '"MEDIUM"':' ' kics-results.json | awk {'print $2'} | sed 's/.$//'`
# echo "TOTAL SEVERITY COUNTER $TOTAL_SEVERITY_COUNTER"
# if [ "$SEVERITY_COUNTER_HIGH" -ge "1" ]; then
# echo "Please fix all $SEVERITY_COUNTER_HIGH HIGH SEVERITY COUNTERS" && exit 1;
# fi
# displayName: Run Checkmarx KICKS (CmdLine)
- script: |
# mkdir KicsReports
docker pull checkmarx/kics:latest
docker run \
--rm \
--volume $(System.DefaultWorkingDirectory)/Infrastructure-Source-Code/terraform:/path \
checkmarx/kics:latest \
scan \
--path "/path" \
--report-formats "sarif"
displayName: Run Checkmarx KICKS (Container)
- script: |
ls -la
displayName: List DIR
condition: always()
- task: PublishPipelineArtifact@1
displayName: Publish Artifact
condition: always()
inputs:
targetPath: '$(System.DefaultWorkingDirectory)/'
artifact: 'CheckmarxKICS'
publishLocation: 'pipeline'