Skip to content
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

fix(vuln): GitLab report template #2578

Merged
merged 2 commits into from
Jul 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions contrib/gitlab.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{{- /* Template based on https://docs.gitlab.com/ee/user/application_security/container_scanning/#reports-json-format */ -}}
{
"version": "2.3",
"version": "14.0.6",
"vulnerabilities": [
{{- $t_first := true }}
{{- range . }}
{{- $target := .Target }}
{{- $image := $target | regexFind "[^\\s]+" }}
{{- range .Vulnerabilities -}}
{{- if $t_first -}}
{{- $t_first = false -}}
Expand All @@ -31,8 +32,6 @@
{{- else -}}
"{{ .Severity }}"
{{- end }},
{{- /* TODO: Define confidence */}}
"confidence": "Unknown",
"solution": {{ if .FixedVersion -}}
"Upgrade {{ .PkgName }} to {{ .FixedVersion }}"
{{- else -}}
Expand All @@ -51,7 +50,7 @@
},
{{- /* TODO: No mapping available - https://github.com/aquasecurity/trivy/issues/332 */}}
"operating_system": "Unknown",
"image": "{{ $target }}"
"image": "{{ $image }}"
},
"identifiers": [
{
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/integrations/gitlab-ci.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ include:

If you're a GitLab 14.x Ultimate customer, you can use the same configuration above.

Alternatively, you can always use the example configurations below. Note that the examples use [`contrib/gitlab.tpl`](https://github.com/aquasecurity/trivy/blob/main/contrib/gitlab.tpl), which does not work with GitLab 15.0 and above (for details, see [issue 1598](https://github.com/aquasecurity/trivy/issues/1598)).
Alternatively, you can always use the example configurations below.

```yaml
stages:
Expand Down
14 changes: 5 additions & 9 deletions integration/testdata/alpine-310.gitlab.golden
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "2.3",
"version": "14.0.6",
"vulnerabilities": [
{
"id": "CVE-2019-1549",
Expand All @@ -8,7 +8,6 @@
"description": "OpenSSL 1.1.1 introduced a rewritten random number generator (RNG). This was intended to include protection in the event of a fork() system call in order to ensure that the parent and child processes did not share the same RNG state. However this protection was not being used in the default case. A partial mitigation for this issue is that the output from a high precision timer is mixed into the RNG state so the likelihood of a parent and child process sharing state is significantly reduced. If an application already calls OPENSSL_init_crypto() explicitly using OPENSSL_INIT_ATFORK then this problem does not occur at all. Fixed in OpenSSL 1.1.1d (Affected 1.1.1-1.1.1c).",
"cve": "CVE-2019-1549",
"severity": "Medium",
"confidence": "Unknown",
"solution": "Upgrade libcrypto1.1 to 1.1.1d-r0",
"scanner": {
"id": "trivy",
Expand All @@ -22,7 +21,7 @@
"version": "1.1.1c-r0"
},
"operating_system": "Unknown",
"image": "testdata/fixtures/images/alpine-310.tar.gz (alpine 3.10.2)"
"image": "testdata/fixtures/images/alpine-310.tar.gz"
},
"identifiers": [
{
Expand Down Expand Up @@ -82,7 +81,6 @@
"description": "There is an overflow bug in the x64_64 Montgomery squaring procedure used in exponentiation with 512-bit moduli. No EC algorithms are affected. Analysis suggests that attacks against 2-prime RSA1024, 3-prime RSA1536, and DSA1024 as a result of this defect would be very difficult to perform and are not believed likely. Attacks against DH512 are considered just feasible. However, for an attack the target would have to re-use the DH512 private key, which is not recommended anyway. Also applications directly using the low level API BN_mod_exp may be affected if they use BN_FLG_CONSTTIME. Fixed in OpenSSL 1.1.1e (Affected 1.1.1-1.1.1d). Fixed in OpenSSL 1.0.2u (Affected 1.0.2-1.0.2t).",
"cve": "CVE-2019-1551",
"severity": "Medium",
"confidence": "Unknown",
"solution": "Upgrade libcrypto1.1 to 1.1.1d-r2",
"scanner": {
"id": "trivy",
Expand All @@ -96,7 +94,7 @@
"version": "1.1.1c-r0"
},
"operating_system": "Unknown",
"image": "testdata/fixtures/images/alpine-310.tar.gz (alpine 3.10.2)"
"image": "testdata/fixtures/images/alpine-310.tar.gz"
},
"identifiers": [
{
Expand Down Expand Up @@ -176,7 +174,6 @@
"description": "OpenSSL 1.1.1 introduced a rewritten random number generator (RNG). This was intended to include protection in the event of a fork() system call in order to ensure that the parent and child processes did not share the same RNG state. However this protection was not being used in the default case. A partial mitigation for this issue is that the output from a high precision timer is mixed into the RNG state so the likelihood of a parent and child process sharing state is significantly reduced. If an application already calls OPENSSL_init_crypto() explicitly using OPENSSL_INIT_ATFORK then this problem does not occur at all. Fixed in OpenSSL 1.1.1d (Affected 1.1.1-1.1.1c).",
"cve": "CVE-2019-1549",
"severity": "Medium",
"confidence": "Unknown",
"solution": "Upgrade libssl1.1 to 1.1.1d-r0",
"scanner": {
"id": "trivy",
Expand All @@ -190,7 +187,7 @@
"version": "1.1.1c-r0"
},
"operating_system": "Unknown",
"image": "testdata/fixtures/images/alpine-310.tar.gz (alpine 3.10.2)"
"image": "testdata/fixtures/images/alpine-310.tar.gz"
},
"identifiers": [
{
Expand Down Expand Up @@ -250,7 +247,6 @@
"description": "There is an overflow bug in the x64_64 Montgomery squaring procedure used in exponentiation with 512-bit moduli. No EC algorithms are affected. Analysis suggests that attacks against 2-prime RSA1024, 3-prime RSA1536, and DSA1024 as a result of this defect would be very difficult to perform and are not believed likely. Attacks against DH512 are considered just feasible. However, for an attack the target would have to re-use the DH512 private key, which is not recommended anyway. Also applications directly using the low level API BN_mod_exp may be affected if they use BN_FLG_CONSTTIME. Fixed in OpenSSL 1.1.1e (Affected 1.1.1-1.1.1d). Fixed in OpenSSL 1.0.2u (Affected 1.0.2-1.0.2t).",
"cve": "CVE-2019-1551",
"severity": "Medium",
"confidence": "Unknown",
"solution": "Upgrade libssl1.1 to 1.1.1d-r2",
"scanner": {
"id": "trivy",
Expand All @@ -264,7 +260,7 @@
"version": "1.1.1c-r0"
},
"operating_system": "Unknown",
"image": "testdata/fixtures/images/alpine-310.tar.gz (alpine 3.10.2)"
"image": "testdata/fixtures/images/alpine-310.tar.gz"
},
"identifiers": [
{
Expand Down