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
This action is meant for generating differntial secirity reports based on [trivy](https://github.com/aquasecurity/trivy) to be published as a comment of a pull request.
3
+
This action is meant for generating differential security reports based on [Trivy](https://github.com/aquasecurity/trivy) to be published as a comment of a pull request.
4
4
5
-
From a base image used as reference, it underlies the new security failures and the one that have been removed after changes in your source code.
5
+
From a base image used as reference, it underlies the new security vulnerabilities and the one that have been removed after changes in your source code.
6
6
7
7
8
8
## Example of usage
9
9
10
-
Before calling the action make sure to get the images (the base and the new one) in the pipeline either by pulling or building them.
10
+
>### Prerequesites
11
+
12
+
Before calling the action or the orbs, you need to make sure, in the job or in the workflow that:
13
+
* An environment variable is set in your GitHub secrets or in your CircleCI context valued with
14
+
a valid Github PAT with rights on repositories. The scripts expect to get an environment variable named
15
+
`GITHUB_PAT`.
16
+
17
+
* The images (the base and the new one) exist in the pipeline either by pulling or building them.
| Name | Type | Default | Required | Description |
46
94
|--- |:-: |:-: |:-: |:-: |
47
95
image | `string` | | `true` | The image on which differential reports must be performed |a
48
96
base-tag | `string` | `latest` | `true` | The tag of the base image used as reference |a
49
97
new-tag | `string` | `security-test` | `true` | The tag of the new image used to seek out new and removed vulnerabilities |a
98
+
repo | `string` | `dreamquark-ai` | `true` | Your GitHub organization name |a
50
99
repo | `string` | | `true` | Repository on which the action is triggered |a
51
100
pr-nb | `string` | | `true` | PR number on which to comment with the security report |a
52
101
topic | `string` | `image` | `true` | The title of the report: used to identify the security report |a
53
102
54
103
104
+
## Code Description
105
+
106
+
As you may notice in the GitHub action and orb's command definition, the last step consists in executing a `main.sh` script. This script calls three others:
107
+
108
+
* A `parse-json.sh` script which will find the differences between the two previously generated Trivy report and will generate two json array files with all the vulnerabilities and their related details in the subfolder report:
109
+
* A `old.json` file that will contain a list of all the vulnerabilities that have been withdrawn (i.e: the one which are in the report of the base image but not in the report of the new image).
110
+
111
+
* A `new.json` file that will contain a list of all the vulnerabilities that have been added (i.e: the one which are not in the report of the base image but are in the report of the new image).
55
112
113
+
* A `md-template.sh` script which will, from the two previously generated json files, generate a markdown summary with two tables containing the new and the removed vulnerabilities.
114
+
* A `comment-pr.sh` script that will comment the specified pull request with the previously generated markdown report. Basically:
115
+
* It looks like if a report already exists by parsing all the comments and checking if one matches with the specified topic.
116
+
* If so, it deletes the previous comment (the previous security report in the pull request).
117
+
* And to finish it adds a comment in the pull request using the markdown report.
0 commit comments