-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: trivy template for slack #437
Conversation
rego-templates/vuls-trivy-slack.rego
Outdated
res := flat_array([ | ||
headers, | ||
vln_list("CRITICAL"), | ||
# vln_list("HIGH"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AndreyLevchenko I need to comment the vln_list, this is a [TODO]
Can you ask @AndreyLevchenko or his team to review this before we merge? Looks like some of these rules are duplicated and can be simplified. |
Any update on this @krol3? |
I have a new version, I will test it and update the PR |
76ae586
to
190cc32
Compare
190cc32
to
4b6814f
Compare
severities := ["CRITICAL", "HIGH", "MEDIUM", "low", "negligible"] | ||
|
||
headers := [ | ||
{"type": "section", "text": {"type": "mrkdwn", "text": sprintf("Image name: %s", [input.ArtifactName])}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{"type": "section", "text": {"type": "mrkdwn", "text": sprintf("Image name: %s", [input.ArtifactName])}}, | |
{"type": "section", "text": {"type": "mrkdwn", "text": sprintf("Artifact name: %s", [input.ArtifactName])}}, |
|
||
title = sprintf("Vulnerability scan report", []) # title is | ||
|
||
aggregation_pkg := "postee.vuls.slack.trivy.aggregation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah! It's by default this fields, it's used in the others templates, title := input.image
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, did you forget to check in the aggregate package then? Like this
postee/rego-templates/vuls-slack-aggregation.rego
Lines 1 to 28 in f7fdfa7
package postee.vuls.slack.aggregation | |
import data.postee.flat_array | |
title := "Vulnerability scan report" | |
url := urlsResult { | |
urls := [ scan | | |
item:=input[i].url | |
scan:=[item] | |
] | |
urlsResult:= concat("\n", flat_array(urls)) | |
} | |
result := res { | |
scans := [ scan | | |
item:=input[i].description #collection is expected | |
scan:=array.concat([{"type":"section","text":{"type":"mrkdwn","text": input[i].title}}], item) | |
] | |
res:= flat_array(scans) | |
} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see a postee.vuls.slack.trivy.aggregation
rego package (file).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ping @krol3?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok! make sense! I will added
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested it out and it looks great! just left a couple of nits and we can merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l(great)tm!
a43985c
to
bc84f50
Compare
…y#437) Bumps [k8s.io/client-go](https://github.com/kubernetes/client-go) from 0.24.3 to 0.24.4. - [Release notes](https://github.com/kubernetes/client-go/releases) - [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md) - [Commits](kubernetes/client-go@v0.24.3...v0.24.4) --- updated-dependencies: - dependency-name: k8s.io/client-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
A template for slack to support trivy output.
Here the result
Thanks @AndreyLevchenko