diff --git a/contrib/gitlab.tpl b/contrib/gitlab.tpl index 2d2958984fe5..f60d368d7540 100644 --- a/contrib/gitlab.tpl +++ b/contrib/gitlab.tpl @@ -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 -}} @@ -31,8 +32,6 @@ {{- else -}} "{{ .Severity }}" {{- end }}, - {{- /* TODO: Define confidence */}} - "confidence": "Unknown", "solution": {{ if .FixedVersion -}} "Upgrade {{ .PkgName }} to {{ .FixedVersion }}" {{- else -}} @@ -51,7 +50,7 @@ }, {{- /* TODO: No mapping available - https://github.com/aquasecurity/trivy/issues/332 */}} "operating_system": "Unknown", - "image": "{{ $target }}" + "image": "{{ $image }}" }, "identifiers": [ { diff --git a/docs/docs/integrations/gitlab-ci.md b/docs/docs/integrations/gitlab-ci.md index c3107aac0c4e..74682761bc2d 100644 --- a/docs/docs/integrations/gitlab-ci.md +++ b/docs/docs/integrations/gitlab-ci.md @@ -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: diff --git a/integration/testdata/alpine-310.gitlab.golden b/integration/testdata/alpine-310.gitlab.golden index 0e25ab417aab..e006c9a34db3 100644 --- a/integration/testdata/alpine-310.gitlab.golden +++ b/integration/testdata/alpine-310.gitlab.golden @@ -1,5 +1,5 @@ { - "version": "2.3", + "version": "14.0.6", "vulnerabilities": [ { "id": "CVE-2019-1549", @@ -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", @@ -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": [ { @@ -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", @@ -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": [ { @@ -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", @@ -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": [ { @@ -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", @@ -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": [ {