You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+53-4Lines changed: 53 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ Github Action for running trivy scans
4
4
# Overview
5
5
stordco/actions-trivy is used to run [trivy](https://github.com/aquasecurity/trivy) scans with various scan types. The current scan types supported:
@@ -19,13 +19,62 @@ stordco/actions-trivy is used to run [trivy](https://github.com/aquasecurity/tri
19
19
slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }}
20
20
```
21
21
22
-
## Inputs
23
22
<!-- {x-release-please-end} -->
23
+
## Inputs
24
24
25
25
| name | description | default value |
26
26
| --- | --- | --- |
27
+
| `github-token` | (optional) Should be set to `secrets.GH_PERSONAL_ACCESS_TOKEN` in order to interact with Github API. If not set, then PR comments will not be uploaded with the scan output. | "" |
27
28
| `scan-type` | (required) Specifies the type of scan to be perforemed (e.g., `fs` for filesystem scan). | |
29
+
| `slack-bot-token` | (optional) Should be set to `secrets.SLACK_BOT_TOKEN` to send messages through `Github Actions`. If not set, then slack messages will not be posted. | "" |
30
+
31
+
32
+
## Outputs
33
+
34
+
| name | description | default value |
35
+
| --- | --- | --- |
36
+
| `artifact-url` | Returns link to trivy scan artifact. Main branch artifacts are retained for 90 days while others are retained for 1 day. | |
37
+
38
+
39
+
## General Information
40
+
41
+
For default usage:
42
+
1. When a merge into the `main` branch occurs that contains `CRITICAL` vulnerabilities, a notification will be sent to the `#trivy-alerts` Slack channel containing the number of critical vulnerabilities detected and a link to the full trivy scan report artifact.
43
+
1. When any vulnerabilities `(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL)` are detected on PR builds, a comment will be posted to the PR including the full output of the OS and library vulnerabilities detected based on the `mix.lock` dependencies.
| `github-token` | (optional) Should be set to `secrets.GH_PERSONAL_ACCESS_TOKEN` in order to interact with Github API. If not set, then PR comments will not be uploaded with the scan output. | "" |
75
+
| `image-ref` | (optional) Specifies the Docker image to be scanned | "" |
76
+
| `matrix-id` | (optional) If matrix jobs are being leveraged, add in an unique matrix job identifier to be leveraged for the notifications. | "" |
77
+
| `scan-type` | (required) Specifies the type of scan to be perforemed (e.g., `image` for container image scan). | |
29
78
| `slack-bot-token` | (optional) Should be set to `secrets.SLACK_BOT_TOKEN` to send messages through `Github Actions`. If not set, then slack messages will not be posted. | "" |
30
79
31
80
@@ -39,8 +88,8 @@ stordco/actions-trivy is used to run [trivy](https://github.com/aquasecurity/tri
39
88
## General Information
40
89
41
90
For default usage:
42
-
1. When a merge into the `main` branch occurs that contains `Critical` vulnerabilities, a notification will be sent to the #trivy-alerts Slack channel containing the number of critical vulnerabilities detected and a link to the full trivy scan report artifact.
43
-
1. When any vulnerabilities `(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL)` are detected on PR builds, a comment will be posted to the PR including the full output of the OSvulnerabilities detected based on the `mix.lock` dependencies.
91
+
1. When a merge into the `main` branch occurs that contains `CRITICAL` vulnerabilities, a notification will be sent to the `#trivy-alerts` Slack channel containing the number of critical vulnerabilities detected and a link to the full trivy scan report artifact.
92
+
1. When any vulnerabilities `(UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL)` are detected on PR builds, a comment will be posted to the PR including the full output of the OS, library vulnerabilities and secrets detected found on the container image.
if (vulnerabilities.flatMap(result => result.Vulnerabilities).length === 0) {
146
171
if (botComment) {
147
-
const noErrorsComment = `No vulnerabilities to be reported.\n${commentIdentifier}`;
172
+
const noErrorsComment = `No Trivy ${scanTypeName} vulnerabilities to be reported${process.env.MATRIX_ID ? ` for ${process.env.MATRIX_ID}` : ''}.\n${commentIdentifier}`;
148
173
149
174
await github.rest.issues.updateComment({
150
175
owner,
@@ -172,15 +197,16 @@ runs:
172
197
173
198
if (formattedContent.length > MAX_COMMENT_LENGTH) {
174
199
fullCommentBody = `
175
-
The Trivy scan report is too large to display here. Please view the detailed output from the job:
200
+
The Trivy ${scanTypeName} scan report${process.env.MATRIX_ID ? ` for ${process.env.MATRIX_ID}` : ''} too large to display here. Please view the detailed output from the job:
View the Trivy scan report below. Click on the dropdown to expand the report.
209
+
View the Trivy ${scanTypeName} scan report${process.env.MATRIX_ID ? ` for ${process.env.MATRIX_ID}` : ''} below. Click on the dropdown to expand the report.
0 commit comments