Skip to content

Commit 49883f1

Browse files
committed
🌱 add support for KICS SAST
Signed-off-by: Adam Korczynski <[email protected]>
1 parent 6a4529c commit 49883f1

File tree

4 files changed

+63
-0
lines changed

4 files changed

+63
-0
lines changed

checker/raw_result.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ const (
286286
PysaWorkflow SASTWorkflowType = "Pysa"
287287
// QodanaWorkflow represents a workflow that runs Qodana.
288288
QodanaWorkflow SASTWorkflowType = "Qodana"
289+
// KicsWorkflow represents a workflow that runs KICS.
290+
KicsWorkflow SASTWorkflowType = "KICS"
289291
)
290292

291293
// SASTWorkflow represents a SAST workflow.

checks/raw/sast.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ func SAST(c *checker.CheckRequest) (checker.SASTData, error) {
8787
}
8888
data.Workflows = append(data.Workflows, qodanaWorkflows...)
8989

90+
kicsWorkflows, err := getSastUsesWorkflows(c, "^Checkmarx/kics-github-action", checker.KicsWorkflow)
91+
if err != nil {
92+
return data, err
93+
}
94+
data.Workflows = append(data.Workflows, kicsWorkflows...)
95+
9096
return data, nil
9197
}
9298

checks/raw/sast_test.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,29 @@ func TestSAST(t *testing.T) {
195195
},
196196
},
197197
},
198+
{
199+
name: "Has KICS",
200+
files: []string{".github/workflows/github-kics-workflow.yaml"},
201+
commits: []clients.Commit{
202+
{
203+
AssociatedMergeRequest: clients.PullRequest{
204+
Number: 1,
205+
},
206+
},
207+
},
208+
expected: checker.SASTData{
209+
Workflows: []checker.SASTWorkflow{
210+
{
211+
Type: checker.KicsWorkflow,
212+
File: checker.File{
213+
Path: ".github/workflows/github-kics-workflow.yaml",
214+
Offset: checker.OffsetDefault,
215+
Type: finding.FileTypeSource,
216+
},
217+
},
218+
},
219+
},
220+
},
198221
}
199222
for _, tt := range tests {
200223
t.Run(tt.name, func(t *testing.T) {
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: "Security Scans"
2+
on:
3+
schedule:
4+
- cron: '0 3 * * 1' # run tests at 1 AM (UTC), every monday (1)
5+
workflow_dispatch:
6+
inputs:
7+
branch:
8+
description: 'Take CI build artifacts from branch (e.g., master, release-x.y.z)'
9+
required: true
10+
default: 'main'
11+
12+
# Declare default permissions as read only.
13+
permissions: read-all
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
env:
20+
GO_VERSION: "~1.23"
21+
22+
jobs:
23+
security-scans:
24+
steps:
25+
- name: KICS Scan
26+
if: matrix.tool == 'kics'
27+
uses: Checkmarx/kics-github-action@94469746ec2c43de89a42fb9d2a80070f5d25b16 # v2.1.3
28+
with:
29+
path: scans
30+
config_path: .github/kics-config.yml
31+
fail_on: high,medium
32+
output_formats: json,sarif

0 commit comments

Comments
 (0)