Skip to content

Commit

Permalink
fix(vuln): GitLab report template (#2578)
Browse files Browse the repository at this point in the history
* fix(vuln): GitLab report template

- Upgrade to schema 14.0.6 (https://gitlab.com/gitlab-org/security-products/security-report-schemas/-/blob/v14.0.6/dist/container-scanning-report-format.json).
- Drop unsupported `confidence` property. Currently optional and will be removed by GitLab in schema 15-0-0.

* docs(vuln): remove note about broken GitLab integration
  • Loading branch information
thiago-gitlab authored Jul 26, 2022
1 parent fa8a8ba commit 5a65548
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
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

0 comments on commit 5a65548

Please sign in to comment.