mirror of
https://github.com/aquasecurity/trivy.git
synced 2025-12-13 08:00:53 -08:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eaf2da20a6 | ||
|
|
083c157b05 | ||
|
|
e26e39a7f8 | ||
|
|
04e7ccabea | ||
|
|
415e1d8ea3 | ||
|
|
3bb8852ef7 | ||
|
|
c0fddd9467 |
11
.github/workflows/mkdocs-latest.yaml
vendored
11
.github/workflows/mkdocs-latest.yaml
vendored
@@ -1,5 +1,10 @@
|
|||||||
name: Deploy the latest documentation
|
name: Deploy the latest documentation
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
version:
|
||||||
|
description: Version to be deployed
|
||||||
|
required: true
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
@@ -27,7 +32,11 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config user.name "knqyf263"
|
git config user.name "knqyf263"
|
||||||
git config user.email "knqyf263@gmail.com"
|
git config user.email "knqyf263@gmail.com"
|
||||||
- name: Deploy the latest documents
|
- name: Deploy the latest documents from new tag push
|
||||||
|
if: ${{ github.event.inputs.version == '' }}
|
||||||
run: |
|
run: |
|
||||||
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
|
VERSION=$(echo ${{ github.ref }} | sed -e "s#refs/tags/##g")
|
||||||
mike deploy --push --update-aliases $VERSION latest
|
mike deploy --push --update-aliases $VERSION latest
|
||||||
|
- name: Deploy the latest documents from manual trigger
|
||||||
|
if: ${{ github.event.inputs.version != '' }}
|
||||||
|
run: mike deploy --push --update-aliases ${{ github.event.inputs.version }} latest
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
FROM alpine:3.12
|
FROM alpine:3.13
|
||||||
RUN apk --no-cache add ca-certificates git
|
RUN apk --no-cache add ca-certificates git
|
||||||
COPY trivy /usr/local/bin/trivy
|
COPY trivy /usr/local/bin/trivy
|
||||||
COPY contrib/*.tpl contrib/
|
COPY contrib/*.tpl contrib/
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"version": "0.15.0",
|
"version": "0.15.0",
|
||||||
"rules": [
|
"rules": [
|
||||||
{{- $t_first := true }}
|
{{- $t_first := true }}
|
||||||
{{- range . }}
|
{{- range $result := . }}
|
||||||
{{- $vulnerabilityType := .Type }}
|
{{- $vulnerabilityType := .Type }}
|
||||||
{{- range .Vulnerabilities -}}
|
{{- range .Vulnerabilities -}}
|
||||||
{{- if $t_first -}}
|
{{- if $t_first -}}
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
,
|
,
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{
|
{
|
||||||
"id": "{{ .VulnerabilityID }}/{{ .PkgName }}",
|
"id": {{ printf "%s: %s-%s %s" $result.Target .PkgName .InstalledVersion .VulnerabilityID | toJson }},
|
||||||
"name": "{{ toSarifRuleName $vulnerabilityType }}",
|
"name": "{{ toSarifRuleName $vulnerabilityType }}",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": {{ printf "%v Package: %v" .VulnerabilityID .PkgName | printf "%q" }}
|
"text": {{ printf "%v Package: %v" .VulnerabilityID .PkgName | printf "%q" }}
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
},
|
},
|
||||||
"results": [
|
"results": [
|
||||||
{{- $t_first := true }}
|
{{- $t_first := true }}
|
||||||
{{- range . }}
|
{{- range $result := . }}
|
||||||
{{- $filePath := .Target }}
|
{{- $filePath := .Target }}
|
||||||
{{- range $index, $vulnerability := .Vulnerabilities -}}
|
{{- range $index, $vulnerability := .Vulnerabilities -}}
|
||||||
{{- if $t_first -}}
|
{{- if $t_first -}}
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
,
|
,
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{
|
{
|
||||||
"ruleId": "{{ $vulnerability.VulnerabilityID }}/{{ $vulnerability.PkgName }}",
|
"ruleId": {{ printf "%s: %s-%s %s" $result.Target .PkgName .InstalledVersion .VulnerabilityID | toJson }},
|
||||||
"ruleIndex": {{ $index }},
|
"ruleIndex": {{ $index }},
|
||||||
"level": "{{ toSarifErrorLevel $vulnerability.Vulnerability.Severity }}",
|
"level": "{{ toSarifErrorLevel $vulnerability.Vulnerability.Severity }}",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -92,4 +92,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -19,7 +19,8 @@
|
|||||||
- Java
|
- Java
|
||||||
- JAR/WAR/EAR files (*.jar, *.war, and *.ear)
|
- JAR/WAR/EAR files (*.jar, *.war, and *.ear)
|
||||||
- Go
|
- Go
|
||||||
- Binaries built by Go
|
- Binaries built by Go (UPX-compressed binaries don't work)
|
||||||
|
- go.sum
|
||||||
|
|
||||||
The path of these files does not matter.
|
The path of these files does not matter.
|
||||||
|
|
||||||
|
|||||||
2
go.mod
2
go.mod
@@ -6,7 +6,7 @@ require (
|
|||||||
github.com/Masterminds/goutils v1.1.0 // indirect
|
github.com/Masterminds/goutils v1.1.0 // indirect
|
||||||
github.com/Masterminds/sprig v2.22.0+incompatible
|
github.com/Masterminds/sprig v2.22.0+incompatible
|
||||||
github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986
|
github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986
|
||||||
github.com/aquasecurity/fanal v0.0.0-20210430044351-34b55f31bc70
|
github.com/aquasecurity/fanal v0.0.0-20210501235003-c816628070c1
|
||||||
github.com/aquasecurity/go-dep-parser v0.0.0-20210427143403-3c97ccc53976
|
github.com/aquasecurity/go-dep-parser v0.0.0-20210427143403-3c97ccc53976
|
||||||
github.com/aquasecurity/go-gem-version v0.0.0-20201115065557-8eed6fe000ce
|
github.com/aquasecurity/go-gem-version v0.0.0-20201115065557-8eed6fe000ce
|
||||||
github.com/aquasecurity/go-npm-version v0.0.0-20201110091526-0b796d180798
|
github.com/aquasecurity/go-npm-version v0.0.0-20201110091526-0b796d180798
|
||||||
|
|||||||
4
go.sum
4
go.sum
@@ -172,6 +172,10 @@ github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986 h1:2a30
|
|||||||
github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986/go.mod h1:NT+jyeCzXk6vXR5MTkdn4z64TgGfE5HMLC8qfj5unl8=
|
github.com/aquasecurity/bolt-fixtures v0.0.0-20200903104109-d34e7f983986/go.mod h1:NT+jyeCzXk6vXR5MTkdn4z64TgGfE5HMLC8qfj5unl8=
|
||||||
github.com/aquasecurity/fanal v0.0.0-20210430044351-34b55f31bc70 h1:0v2pf+hIElPvGKLyDye08UtPH8AjujTVLUOWOgoM5O4=
|
github.com/aquasecurity/fanal v0.0.0-20210430044351-34b55f31bc70 h1:0v2pf+hIElPvGKLyDye08UtPH8AjujTVLUOWOgoM5O4=
|
||||||
github.com/aquasecurity/fanal v0.0.0-20210430044351-34b55f31bc70/go.mod h1:cPTOJcf8bdP24oXhBsPVVczcjkICcApAwAOsn6CpHTI=
|
github.com/aquasecurity/fanal v0.0.0-20210430044351-34b55f31bc70/go.mod h1:cPTOJcf8bdP24oXhBsPVVczcjkICcApAwAOsn6CpHTI=
|
||||||
|
github.com/aquasecurity/fanal v0.0.0-20210501093021-8aaac3e8dea7 h1:bY5D5GVthqQCvnNllG2NVXYpOQJJRi7KFhLdVrskaDg=
|
||||||
|
github.com/aquasecurity/fanal v0.0.0-20210501093021-8aaac3e8dea7/go.mod h1:cPTOJcf8bdP24oXhBsPVVczcjkICcApAwAOsn6CpHTI=
|
||||||
|
github.com/aquasecurity/fanal v0.0.0-20210501235003-c816628070c1 h1:xgdjcsA4Go/9k9XDXYimVF+BgyMlt7YoeWTMs2DpR8Y=
|
||||||
|
github.com/aquasecurity/fanal v0.0.0-20210501235003-c816628070c1/go.mod h1:cPTOJcf8bdP24oXhBsPVVczcjkICcApAwAOsn6CpHTI=
|
||||||
github.com/aquasecurity/go-dep-parser v0.0.0-20210427143403-3c97ccc53976 h1:ypl/IDxujzEymmwtzGJqQyboI2oZr1se+OoYaGqgBzQ=
|
github.com/aquasecurity/go-dep-parser v0.0.0-20210427143403-3c97ccc53976 h1:ypl/IDxujzEymmwtzGJqQyboI2oZr1se+OoYaGqgBzQ=
|
||||||
github.com/aquasecurity/go-dep-parser v0.0.0-20210427143403-3c97ccc53976/go.mod h1:Cv/FOCXy6gwvDbz/KX48+y//SmbnKroFwW5hquXn5G4=
|
github.com/aquasecurity/go-dep-parser v0.0.0-20210427143403-3c97ccc53976/go.mod h1:Cv/FOCXy6gwvDbz/KX48+y//SmbnKroFwW5hquXn5G4=
|
||||||
github.com/aquasecurity/go-gem-version v0.0.0-20201115065557-8eed6fe000ce h1:QgBRgJvtEOBtUXilDb1MLi1p1MWoyFDXAu5DEUl5nwM=
|
github.com/aquasecurity/go-gem-version v0.0.0-20201115065557-8eed6fe000ce h1:QgBRgJvtEOBtUXilDb1MLi1p1MWoyFDXAu5DEUl5nwM=
|
||||||
|
|||||||
@@ -1,18 +1,17 @@
|
|||||||
-----BEGIN CERTIFICATE-----
|
-----BEGIN CERTIFICATE-----
|
||||||
MIIC+jCCAeKgAwIBAgIRAJLJ5vw48YZwoHlC8i6VdHswDQYJKoZIhvcNAQELBQAw
|
MIICwTCCAamgAwIBAgIJAP09YW8ChPlwMA0GCSqGSIb3DQEBCwUAMBIxEDAOBgNV
|
||||||
EjEQMA4GA1UEChMHQWNtZSBDbzAeFw0yMDA1MDMxMTU2MzhaFw0yMTA1MDMxMTU2
|
BAoMB0FjbWUgQ28wIBcNMjEwNTEyMDQ0NzA1WhgPMjEwMDA0MTQwNDQ3MDVaMBIx
|
||||||
MzhaMBIxEDAOBgNVBAoTB0FjbWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
|
EDAOBgNVBAoMB0FjbWUgQ28wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK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5RswQRtipdUCmMZVOAoQfos8j9LFmIKwcsboEQe/
|
||||||
T6v/b6KUOAZ0iWXeGWO7LwnRaulkyauGav9xJUpfEw7Z/57qwTVIGZD6mZF6tt77
|
Fvqq2+W/5TRhsKn/1OxvCZAEurazSygtm6hyiMGwKjJLfyzwjZx+Oopn3lqRUP36
|
||||||
FsXXiQJA88LrQnt1BRTeNK8sRp4S3N1hrtY3akTit/dyQcfh3NSDttzkYsoUu0qT
|
gLQQ57szoNZFKyPN2z2unXAuDG5wpG2InX8WJvlrhaiCHGUoxO8r0rVawm58bahM
|
||||||
DUkXD0b4eDmaD47+0Z6eIVp3aEcPMzpiy6qWc5fMjMeHjtYF4lBSF0JTWzmxNUGl
|
uGPlVPCNdxl1h7K8aecKpm+7Wh8n06Nl/kOWBDFAXeI8IwrnIy1rAZLngvnjqL//
|
||||||
fiGhMJStQK/n73t58O7h5Adva5wRV+Km6pa+6SfOxPNUjsxXjG0LzWA9dJg/q2rs
|
umjXKCBWya48ed9HMoOR2aruzseXc8k6cGXuBxYFtHissPvPPQ==
|
||||||
k/ouIE05BfB3z538ncQVBTwfPMClbIiJhAs3b6ej22+j/O+vbFBmdfkpVpFRtg==
|
|
||||||
-----END CERTIFICATE-----
|
-----END CERTIFICATE-----
|
||||||
|
|||||||
@@ -1,28 +1,27 @@
|
|||||||
-----BEGIN PRIVATE KEY-----
|
-----BEGIN RSA PRIVATE KEY-----
|
||||||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDhnepAL1Atd1xV
|
MIIEpQIBAAKCAQEAzZiqQzs1PBiuV29xn3qlNZCkNIAXoxraiucnR/LZUaMtjShr
|
||||||
h/TOZpTK7yHwtOrtGWNEqNkFbcyD7x9CNgUkxjO8nc4ynEo4ARpLj+2VDLIwi93w
|
4yfeZ4SMVFzCnnt+OSRZc5Anp+RJL7e9C09Dtud89BXnH6WhYpa3iIruSdmFljbZ
|
||||||
eCFj6mcz2tdHi7n0eiPR7+PS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
|
|||||||
34
integration/testdata/alpine-310.sarif.golden
vendored
34
integration/testdata/alpine-310.sarif.golden
vendored
@@ -11,7 +11,7 @@
|
|||||||
"version": "0.15.0",
|
"version": "0.15.0",
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1549/libcrypto1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1549",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1549 Package: libcrypto1.1"
|
"text": "CVE-2019-1549 Package: libcrypto1.1"
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1551/libcrypto1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1551",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1551 Package: libcrypto1.1"
|
"text": "CVE-2019-1551 Package: libcrypto1.1"
|
||||||
@@ -63,7 +63,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1563/libcrypto1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1563",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1563 Package: libcrypto1.1"
|
"text": "CVE-2019-1563 Package: libcrypto1.1"
|
||||||
@@ -89,7 +89,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1547/libcrypto1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1547",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1547 Package: libcrypto1.1"
|
"text": "CVE-2019-1547 Package: libcrypto1.1"
|
||||||
@@ -115,7 +115,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1549/libssl1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1549",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1549 Package: libssl1.1"
|
"text": "CVE-2019-1549 Package: libssl1.1"
|
||||||
@@ -141,7 +141,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1551/libssl1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1551",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1551 Package: libssl1.1"
|
"text": "CVE-2019-1551 Package: libssl1.1"
|
||||||
@@ -167,7 +167,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1563/libssl1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1563",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1563 Package: libssl1.1"
|
"text": "CVE-2019-1563 Package: libssl1.1"
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "CVE-2019-1547/libssl1.1",
|
"id": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1547",
|
||||||
"name": "OS Package Vulnerability (Alpine)",
|
"name": "OS Package Vulnerability (Alpine)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-2019-1547 Package: libssl1.1"
|
"text": "CVE-2019-1547 Package: libssl1.1"
|
||||||
@@ -222,7 +222,7 @@
|
|||||||
},
|
},
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1549/libcrypto1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1549",
|
||||||
"ruleIndex": 0,
|
"ruleIndex": 0,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1551/libcrypto1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1551",
|
||||||
"ruleIndex": 1,
|
"ruleIndex": 1,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -254,7 +254,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1563/libcrypto1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1563",
|
||||||
"ruleIndex": 2,
|
"ruleIndex": 2,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -270,7 +270,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1547/libcrypto1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libcrypto1.1-1.1.1c-r0 CVE-2019-1547",
|
||||||
"ruleIndex": 3,
|
"ruleIndex": 3,
|
||||||
"level": "note",
|
"level": "note",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -286,7 +286,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1549/libssl1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1549",
|
||||||
"ruleIndex": 4,
|
"ruleIndex": 4,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -302,7 +302,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1551/libssl1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1551",
|
||||||
"ruleIndex": 5,
|
"ruleIndex": 5,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -318,7 +318,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1563/libssl1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1563",
|
||||||
"ruleIndex": 6,
|
"ruleIndex": 6,
|
||||||
"level": "warning",
|
"level": "warning",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -334,7 +334,7 @@
|
|||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-2019-1547/libssl1.1",
|
"ruleId": "testdata/fixtures/alpine-310.tar.gz (alpine 3.10.2): libssl1.1-1.1.1c-r0 CVE-2019-1547",
|
||||||
"ruleIndex": 7,
|
"ruleIndex": 7,
|
||||||
"level": "note",
|
"level": "note",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -357,4 +357,4 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -39,7 +39,7 @@ func NewDriver(libType string) (Driver, error) {
|
|||||||
driver = newNugetDriver()
|
driver = newNugetDriver()
|
||||||
case library.Jar:
|
case library.Jar:
|
||||||
driver = newMavenDriver()
|
driver = newMavenDriver()
|
||||||
case library.GoBinary:
|
case library.GoBinary, library.GoMod:
|
||||||
driver = Driver{
|
driver = Driver{
|
||||||
ecosystem: vulnerability.Go,
|
ecosystem: vulnerability.Go,
|
||||||
advisories: []advisory{NewAdvisory(vulnerability.Go, comparer.GenericComparer{})},
|
advisories: []advisory{NewAdvisory(vulnerability.Go, comparer.GenericComparer{})},
|
||||||
|
|||||||
@@ -409,7 +409,7 @@ func TestReportWriter_Template_SARIF(t *testing.T) {
|
|||||||
"version": "0.15.0",
|
"version": "0.15.0",
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "CVE-1234-5678/foopackage",
|
"id": "foo/target/alpine-310.tar.gz (alpine 3.10.2): foopackage-1.2.3 CVE-1234-5678",
|
||||||
"name": "Other Vulnerability (Footype)",
|
"name": "Other Vulnerability (Footype)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-1234-5678 Package: foopackage"
|
"text": "CVE-1234-5678 Package: foopackage"
|
||||||
@@ -437,7 +437,7 @@ func TestReportWriter_Template_SARIF(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-1234-5678/foopackage",
|
"ruleId": "foo/target/alpine-310.tar.gz (alpine 3.10.2): foopackage-1.2.3 CVE-1234-5678",
|
||||||
"ruleIndex": 0,
|
"ruleIndex": 0,
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"message": {
|
"message": {
|
||||||
@@ -493,7 +493,7 @@ func TestReportWriter_Template_SARIF(t *testing.T) {
|
|||||||
"version": "0.15.0",
|
"version": "0.15.0",
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"id": "CVE-1234-5678/foopackage",
|
"id": "rust-app\\Cargo.lock: foopackage-1.2.3 CVE-1234-5678",
|
||||||
"name": "Other Vulnerability (Footype)",
|
"name": "Other Vulnerability (Footype)",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "CVE-1234-5678 Package: foopackage"
|
"text": "CVE-1234-5678 Package: foopackage"
|
||||||
@@ -522,7 +522,7 @@ func TestReportWriter_Template_SARIF(t *testing.T) {
|
|||||||
},
|
},
|
||||||
"results": [
|
"results": [
|
||||||
{
|
{
|
||||||
"ruleId": "CVE-1234-5678/foopackage",
|
"ruleId": "rust-app\\Cargo.lock: foopackage-1.2.3 CVE-1234-5678",
|
||||||
"ruleIndex": 0,
|
"ruleIndex": 0,
|
||||||
"level": "error",
|
"level": "error",
|
||||||
"message": {
|
"message": {
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import (
|
|||||||
_ "github.com/aquasecurity/fanal/analyzer/library/cargo"
|
_ "github.com/aquasecurity/fanal/analyzer/library/cargo"
|
||||||
_ "github.com/aquasecurity/fanal/analyzer/library/composer"
|
_ "github.com/aquasecurity/fanal/analyzer/library/composer"
|
||||||
_ "github.com/aquasecurity/fanal/analyzer/library/gobinary"
|
_ "github.com/aquasecurity/fanal/analyzer/library/gobinary"
|
||||||
|
_ "github.com/aquasecurity/fanal/analyzer/library/gomod"
|
||||||
_ "github.com/aquasecurity/fanal/analyzer/library/jar"
|
_ "github.com/aquasecurity/fanal/analyzer/library/jar"
|
||||||
_ "github.com/aquasecurity/fanal/analyzer/library/npm"
|
_ "github.com/aquasecurity/fanal/analyzer/library/npm"
|
||||||
_ "github.com/aquasecurity/fanal/analyzer/library/nuget"
|
_ "github.com/aquasecurity/fanal/analyzer/library/nuget"
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ func (v BySeverity) Len() int { return len(v) }
|
|||||||
func (v BySeverity) Less(i, j int) bool {
|
func (v BySeverity) Less(i, j int) bool {
|
||||||
if v[i].PkgName != v[j].PkgName {
|
if v[i].PkgName != v[j].PkgName {
|
||||||
return v[i].PkgName < v[j].PkgName
|
return v[i].PkgName < v[j].PkgName
|
||||||
|
} else if v[i].InstalledVersion != v[j].InstalledVersion {
|
||||||
|
return v[i].InstalledVersion < v[j].InstalledVersion
|
||||||
}
|
}
|
||||||
ret := types.CompareSeverityString(
|
ret := types.CompareSeverityString(
|
||||||
v[j].Severity, v[i].Severity,
|
v[j].Severity, v[i].Severity,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package vulnerability
|
|||||||
import (
|
import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"context"
|
"context"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
@@ -148,25 +149,8 @@ func (c Client) getPrimaryURL(vulnID string, refs []string, source string) strin
|
|||||||
func (c Client) Filter(ctx context.Context, vulns []types.DetectedVulnerability, severities []dbTypes.Severity,
|
func (c Client) Filter(ctx context.Context, vulns []types.DetectedVulnerability, severities []dbTypes.Severity,
|
||||||
ignoreUnfixed bool, ignoreFile string, policyFile string) ([]types.DetectedVulnerability, error) {
|
ignoreUnfixed bool, ignoreFile string, policyFile string) ([]types.DetectedVulnerability, error) {
|
||||||
ignoredIDs := getIgnoredIDs(ignoreFile)
|
ignoredIDs := getIgnoredIDs(ignoreFile)
|
||||||
var vulnerabilities []types.DetectedVulnerability
|
|
||||||
for _, vuln := range vulns {
|
vulnerabilities := filterVulnerabilities(vulns, severities, ignoredIDs, ignoreUnfixed)
|
||||||
if vuln.Severity == "" {
|
|
||||||
vuln.Severity = dbTypes.SeverityUnknown.String()
|
|
||||||
}
|
|
||||||
// Filter vulnerabilities by severity
|
|
||||||
for _, s := range severities {
|
|
||||||
if s.String() == vuln.Severity {
|
|
||||||
// Ignore unfixed vulnerabilities
|
|
||||||
if ignoreUnfixed && vuln.FixedVersion == "" {
|
|
||||||
continue
|
|
||||||
} else if utils.StringInSlice(vuln.VulnerabilityID, ignoredIDs) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
vulnerabilities = append(vulnerabilities, vuln)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if policyFile != "" {
|
if policyFile != "" {
|
||||||
var err error
|
var err error
|
||||||
@@ -179,6 +163,49 @@ func (c Client) Filter(ctx context.Context, vulns []types.DetectedVulnerability,
|
|||||||
return vulnerabilities, nil
|
return vulnerabilities, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func filterVulnerabilities(vulns []types.DetectedVulnerability, severities []dbTypes.Severity, ignoredIDs []string,
|
||||||
|
ignoreUnfixed bool) []types.DetectedVulnerability {
|
||||||
|
uniqVulns := make(map[string]types.DetectedVulnerability)
|
||||||
|
for _, vuln := range vulns {
|
||||||
|
if vuln.Severity == "" {
|
||||||
|
vuln.Severity = dbTypes.SeverityUnknown.String()
|
||||||
|
}
|
||||||
|
// Filter vulnerabilities by severity
|
||||||
|
for _, s := range severities {
|
||||||
|
if s.String() != vuln.Severity {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ignore unfixed vulnerabilities
|
||||||
|
if ignoreUnfixed && vuln.FixedVersion == "" {
|
||||||
|
continue
|
||||||
|
} else if utils.StringInSlice(vuln.VulnerabilityID, ignoredIDs) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if there is a duplicate vulnerability
|
||||||
|
key := fmt.Sprintf("%s/%s/%s", vuln.VulnerabilityID, vuln.PkgName, vuln.InstalledVersion)
|
||||||
|
if old, ok := uniqVulns[key]; ok && !shouldOverwrite(old, vuln) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
uniqVulns[key] = vuln
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return toSlice(uniqVulns)
|
||||||
|
}
|
||||||
|
|
||||||
|
func toSlice(uniqVulns map[string]types.DetectedVulnerability) []types.DetectedVulnerability {
|
||||||
|
// Convert map to slice
|
||||||
|
var vulnerabilities []types.DetectedVulnerability
|
||||||
|
for _, vuln := range uniqVulns {
|
||||||
|
vulnerabilities = append(vulnerabilities, vuln)
|
||||||
|
}
|
||||||
|
|
||||||
|
return vulnerabilities
|
||||||
|
}
|
||||||
|
|
||||||
func applyPolicy(ctx context.Context, vulns []types.DetectedVulnerability, policyFile string) ([]types.DetectedVulnerability, error) {
|
func applyPolicy(ctx context.Context, vulns []types.DetectedVulnerability, policyFile string) ([]types.DetectedVulnerability, error) {
|
||||||
policy, err := ioutil.ReadFile(policyFile)
|
policy, err := ioutil.ReadFile(policyFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -236,3 +263,8 @@ func getIgnoredIDs(ignoreFile string) []string {
|
|||||||
}
|
}
|
||||||
return ignoredIDs
|
return ignoredIDs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func shouldOverwrite(old, new types.DetectedVulnerability) bool {
|
||||||
|
// The same vulnerability must be picked always.
|
||||||
|
return old.FixedVersion < new.FixedVersion
|
||||||
|
}
|
||||||
|
|||||||
@@ -675,6 +675,134 @@ func TestClient_Filter(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "happy path with duplicates, one with empty fixed version",
|
||||||
|
args: args{
|
||||||
|
vulns: []types.DetectedVulnerability{
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2019-0001",
|
||||||
|
PkgName: "foo",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityLow.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2019-0001",
|
||||||
|
PkgName: "foo",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "1.2.4",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityLow.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2019-0002",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "1.2.4",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityCritical.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2019-0002",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "1.2.5",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityCritical.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0001",
|
||||||
|
PkgName: "baz",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityHigh.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0001",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityCritical.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0002",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0002",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "2.0.0",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: "",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
severities: []dbTypes.Severity{dbTypes.SeverityCritical, dbTypes.SeverityHigh, dbTypes.SeverityUnknown},
|
||||||
|
ignoreUnfixed: false,
|
||||||
|
},
|
||||||
|
want: []types.DetectedVulnerability{
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0001",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityCritical.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2019-0002",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "1.2.5",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityCritical.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0002",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityUnknown.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0002",
|
||||||
|
PkgName: "bar",
|
||||||
|
InstalledVersion: "2.0.0",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityUnknown.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
VulnerabilityID: "CVE-2018-0001",
|
||||||
|
PkgName: "baz",
|
||||||
|
InstalledVersion: "1.2.3",
|
||||||
|
FixedVersion: "",
|
||||||
|
Vulnerability: dbTypes.Vulnerability{
|
||||||
|
Severity: dbTypes.SeverityHigh.String(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
t.Run(tt.name, func(t *testing.T) {
|
||||||
|
|||||||
Reference in New Issue
Block a user