|
| 1 | +{ |
| 2 | + "$schema": "https://schemastore.azurewebsites.net/schemas/json/sarif-2.1.0-rtm.5.json", |
| 3 | + "version": "2.1.0", |
| 4 | + "runs": [ |
| 5 | + {{- $run_first := true }} |
| 6 | + {{- range $report_index, $report := . }} |
| 7 | + {{- if and $report.Valid (not (eq $report.Message "This resource kind is not supported by kubesec")) -}} |
| 8 | + {{- if $run_first -}} |
| 9 | + {{- $run_first = false -}} |
| 10 | + {{ else -}} |
| 11 | + , |
| 12 | + {{- end }} |
| 13 | + { |
| 14 | + "tool": { |
| 15 | + "driver": { |
| 16 | + "name": "Kubesec", |
| 17 | + "fullName": "Kubesec Kubernetes Resource Security Policy Validator", |
| 18 | + "rules": [ |
| 19 | + {{- $rule_first := true }} |
| 20 | + {{- range .Rules }} |
| 21 | + {{- if $rule_first -}} |
| 22 | + {{- $rule_first = false -}} |
| 23 | + {{ else -}} |
| 24 | + , |
| 25 | + {{- end }} |
| 26 | + { |
| 27 | + "id": "{{ .ID }}", |
| 28 | + "shortDescription": { |
| 29 | + "text": "{{ .Reason }}" |
| 30 | + }, |
| 31 | + "helpUri": "https://github.com/controlplaneio/kubesec", |
| 32 | + "help": { |
| 33 | + "text": "- Reason: {{ .Reason }}\n- Selector: {{ escapeString .Selector }}\n- Score: {{ .Points }}" |
| 34 | + }, |
| 35 | + "messageStrings": { |
| 36 | + "selector": { |
| 37 | + "text": {{ escapeString .Selector | printf "%q" }} |
| 38 | + } |
| 39 | + }, |
| 40 | + "properties": { |
| 41 | + "points": "{{ .Points }}", |
| 42 | + {{- if lt .Points 0 -}} |
| 43 | + "security-severity": "9.0" |
| 44 | + {{ else -}} |
| 45 | + "security-severity": "5.0" |
| 46 | + {{- end }} |
| 47 | + } |
| 48 | + } |
| 49 | + {{- end -}} |
| 50 | + ] |
| 51 | + } |
| 52 | + }, |
| 53 | + "results": [ |
| 54 | + {{- $result_first := true }} |
| 55 | + {{- range $result_index, $res := joinSlices .Scoring.Advise .Scoring.Critical -}} |
| 56 | + {{- if $result_first -}} |
| 57 | + {{- $result_first = false -}} |
| 58 | + {{ else -}} |
| 59 | + , |
| 60 | + {{- end }} |
| 61 | + { |
| 62 | + "ruleId": "{{ $res.ID }}", |
| 63 | + {{- if lt $res.Points 0 -}} |
| 64 | + "level": "error", |
| 65 | + {{ else -}} |
| 66 | + "level": "warning", |
| 67 | + {{- end }} |
| 68 | + "message": { |
| 69 | + "text": {{ endWithPeriod $res.Reason | printf "%q" }}, |
| 70 | + "properties": { |
| 71 | + "score": "{{ $res.Points }}", |
| 72 | + "selector": {{ escapeString $res.Selector | printf "%q" }} |
| 73 | + } |
| 74 | + }, |
| 75 | + "locations": [ |
| 76 | + { |
| 77 | + "physicalLocation": { |
| 78 | + "artifactLocation": { |
| 79 | + "uri": "{{ $report.FileName }}" |
| 80 | + }, |
| 81 | + "region": { |
| 82 | + "startLine": 1, |
| 83 | + "endLine": 1 |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | + ], |
| 88 | + "partialFingerprints": { |
| 89 | + "primaryLocationLineHash": "hash-{{ $report.FileName }}" |
| 90 | + } |
| 91 | + } |
| 92 | + {{- end -}} |
| 93 | + ], |
| 94 | + "columnKind": "utf16CodeUnits" |
| 95 | + } |
| 96 | + {{- end -}} |
| 97 | + {{- end }} |
| 98 | + ] |
| 99 | +} |
0 commit comments