Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
41f05d9ecf | ||
|
|
0cd397afbf | ||
|
|
b43daad0c3 | ||
|
|
dedfa59531 | ||
|
|
f96f79aa22 | ||
|
|
82ec0dd604 | ||
|
|
e5f43133f6 | ||
|
|
1a09192c0e | ||
|
|
1f0aa582c8 | ||
|
|
43849adf01 | ||
|
|
8bd2f9fbda | ||
|
|
cff3e9a7f6 | ||
|
|
ab15891596 | ||
|
|
cacfd7a243 | ||
|
|
1e0bef4613 | ||
|
|
9ab158e859 | ||
|
|
e55de85bee | ||
|
|
d63413b0a4 |
@@ -1,7 +1,7 @@
|
|||||||
name: "build"
|
name: "build"
|
||||||
on: [push, pull_request]
|
on: [push, pull_request]
|
||||||
env:
|
env:
|
||||||
TRIVY_VERSION: 0.31.2
|
TRIVY_VERSION: 0.42.1
|
||||||
BATS_LIB_PATH: '/usr/lib/'
|
BATS_LIB_PATH: '/usr/lib/'
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|||||||
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
FROM ghcr.io/aquasecurity/trivy:0.31.2
|
FROM ghcr.io/aquasecurity/trivy:0.42.1
|
||||||
COPY entrypoint.sh /
|
COPY entrypoint.sh /
|
||||||
RUN apk --no-cache add bash curl
|
RUN apk --no-cache add bash curl npm
|
||||||
RUN chmod +x /entrypoint.sh
|
RUN chmod +x /entrypoint.sh
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ jobs:
|
|||||||
sarif_file: 'trivy-results.sarif'
|
sarif_file: 'trivy-results.sarif'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Trivy to scan Infrastucture as Code
|
### Using Trivy to scan Infrastructure as Code
|
||||||
It's also possible to scan your IaC repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR.
|
It's also possible to scan your IaC repos with Trivy's built-in repo scan. This can be handy if you want to run Trivy as a build time check on each PR that gets opened in your repo. This helps you identify potential vulnerablites that might get introduced with each PR.
|
||||||
|
|
||||||
If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows:
|
If you have [GitHub code scanning](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/about-code-scanning) available you can use Trivy as a scanning tool as follows:
|
||||||
@@ -299,11 +299,12 @@ jobs:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Using Trivy to generate SBOM
|
### Using Trivy to generate SBOM
|
||||||
It's possible for Trivy to generate an SBOM of your dependencies and submit them to a consumer like GitHub Dependency Snapshot.
|
It's possible for Trivy to generate an [SBOM](https://www.aquasec.com/cloud-native-academy/supply-chain-security/sbom/) of your dependencies and submit them to a consumer like [GitHub Dependency Graph](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph).
|
||||||
|
|
||||||
The sending of SBOM to GitHub feature is only available if you currently have [GitHub Dependency Snapshot](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api) available to you in your repo.
|
The [sending of an SBOM to GitHub](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/using-the-dependency-submission-api) feature is only available if you currently have GitHub Dependency Graph [enabled in your repo](https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/configuring-the-dependency-graph#enabling-and-disabling-the-dependency-graph-for-a-private-repository).
|
||||||
|
|
||||||
|
In order to send results to GitHub Dependency Graph, you will need to create a [GitHub PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) or use the [GitHub installation access token](https://docs.github.com/en/actions/security-guides/automatic-token-authentication) (also known as `GITHUB_TOKEN`):
|
||||||
|
|
||||||
In order to send results to the GitHub Dependency Snapshot, you will need to create a [GitHub PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token)
|
|
||||||
```yaml
|
```yaml
|
||||||
---
|
---
|
||||||
name: Pull Request
|
name: Pull Request
|
||||||
@@ -311,7 +312,11 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
pull_request:
|
|
||||||
|
## GITHUB_TOKEN authentication, add only if you're not going to use a PAT
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Checks
|
name: Checks
|
||||||
@@ -320,14 +325,14 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Snapshots
|
- name: Run Trivy in GitHub SBOM mode and submit results to Dependency Graph
|
||||||
uses: aquasecurity/trivy-action@master
|
uses: aquasecurity/trivy-action@master
|
||||||
with:
|
with:
|
||||||
scan-type: 'fs'
|
scan-type: 'fs'
|
||||||
format: 'github'
|
format: 'github'
|
||||||
output: 'dependency-results.sbom.json'
|
output: 'dependency-results.sbom.json'
|
||||||
image-ref: '.'
|
image-ref: '.'
|
||||||
github-pat: '<github_pat_token>'
|
github-pat: ${{ secrets.GITHUB_TOKEN }} # or ${{ secrets.github_pat_name }} if you're using a PAT
|
||||||
```
|
```
|
||||||
|
|
||||||
### Using Trivy to scan your private registry
|
### Using Trivy to scan your private registry
|
||||||
@@ -498,9 +503,11 @@ Following inputs can be used as `step.with` keys:
|
|||||||
| `ignore-policy` | String | | Filter vulnerabilities with OPA rego language |
|
| `ignore-policy` | String | | Filter vulnerabilities with OPA rego language |
|
||||||
| `hide-progress` | String | `true` | Suppress progress bar |
|
| `hide-progress` | String | `true` | Suppress progress bar |
|
||||||
| `list-all-pkgs` | String | | Output all packages regardless of vulnerability |
|
| `list-all-pkgs` | String | | Output all packages regardless of vulnerability |
|
||||||
| `security-checks` | String | `vuln,secret` | comma-separated list of what security issues to detect (`vuln`,`secret`,`config`) |
|
| `scanners` | String | `vuln,secret` | comma-separated list of what security issues to detect (`vuln`,`secret`,`config`) |
|
||||||
| `trivyignores` | String | | comma-separated list of relative paths in repository to one or more `.trivyignore` files |
|
| `trivyignores` | String | | comma-separated list of relative paths in repository to one or more `.trivyignore` files |
|
||||||
| `github-pat` | String | | GitHub Personal Access Token (PAT) for sending SBOM scan results to GitHub Dependency Snapshots |
|
| `trivy-config` | String | | Path to trivy.yaml config |
|
||||||
|
| `github-pat` | String | | Authentication token to enable sending SBOM scan results to GitHub Dependency Graph. Can be either a GitHub Personal Access Token (PAT) or GITHUB_TOKEN |
|
||||||
|
| `limit-severities-for-sarif` | Boolean | false | By default *SARIF* format enforces output of all vulnerabilities regardless of configured severities. To override this behavior set this parameter to **true** |
|
||||||
|
|
||||||
[release]: https://github.com/aquasecurity/trivy-action/releases/latest
|
[release]: https://github.com/aquasecurity/trivy-action/releases/latest
|
||||||
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github
|
[release-img]: https://img.shields.io/github/release/aquasecurity/trivy-action.svg?logo=github
|
||||||
|
|||||||
+6
-2
@@ -71,7 +71,7 @@ inputs:
|
|||||||
description: 'output all packages regardless of vulnerability'
|
description: 'output all packages regardless of vulnerability'
|
||||||
required: false
|
required: false
|
||||||
default: 'false'
|
default: 'false'
|
||||||
security-checks:
|
scanners:
|
||||||
description: 'comma-separated list of what security issues to detect'
|
description: 'comma-separated list of what security issues to detect'
|
||||||
required: false
|
required: false
|
||||||
default: ''
|
default: ''
|
||||||
@@ -88,6 +88,9 @@ inputs:
|
|||||||
trivy-config:
|
trivy-config:
|
||||||
description: 'path to trivy.yaml config'
|
description: 'path to trivy.yaml config'
|
||||||
required: false
|
required: false
|
||||||
|
limit-severities-for-sarif:
|
||||||
|
description: 'limit severities for SARIF format'
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'docker'
|
using: 'docker'
|
||||||
@@ -111,7 +114,8 @@ runs:
|
|||||||
- '-p ${{ inputs.hide-progress }}'
|
- '-p ${{ inputs.hide-progress }}'
|
||||||
- '-q ${{ inputs.skip-files }}'
|
- '-q ${{ inputs.skip-files }}'
|
||||||
- '-r ${{ inputs.list-all-pkgs }}'
|
- '-r ${{ inputs.list-all-pkgs }}'
|
||||||
- '-s ${{ inputs.security-checks }}'
|
- '-s ${{ inputs.scanners }}'
|
||||||
- '-t ${{ inputs.trivyignores }}'
|
- '-t ${{ inputs.trivyignores }}'
|
||||||
- '-u ${{ inputs.github-pat }}'
|
- '-u ${{ inputs.github-pat }}'
|
||||||
- '-v ${{ inputs.trivy-config }}'
|
- '-v ${{ inputs.trivy-config }}'
|
||||||
|
- '-z ${{ inputs.limit-severities-for-sarif }}'
|
||||||
|
|||||||
+22
-15
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:" o; do
|
while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:z:" o; do
|
||||||
case "${o}" in
|
case "${o}" in
|
||||||
a)
|
a)
|
||||||
export scanType=${OPTARG}
|
export scanType=${OPTARG}
|
||||||
@@ -57,7 +57,7 @@ while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:" o; do
|
|||||||
export listAllPkgs=${OPTARG}
|
export listAllPkgs=${OPTARG}
|
||||||
;;
|
;;
|
||||||
s)
|
s)
|
||||||
export securityChecks=${OPTARG}
|
export scanners=${OPTARG}
|
||||||
;;
|
;;
|
||||||
t)
|
t)
|
||||||
export trivyIgnores=${OPTARG}
|
export trivyIgnores=${OPTARG}
|
||||||
@@ -68,6 +68,9 @@ while getopts "a:b:c:d:e:f:g:h:i:j:k:l:m:n:o:p:q:r:s:t:u:v:" o; do
|
|||||||
v)
|
v)
|
||||||
export trivyConfig=${OPTARG}
|
export trivyConfig=${OPTARG}
|
||||||
;;
|
;;
|
||||||
|
z)
|
||||||
|
export limitSeveritiesForSARIF=${OPTARG}
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
@@ -81,8 +84,10 @@ input=$(echo $input | tr -d '\r')
|
|||||||
if [ $input ]; then
|
if [ $input ]; then
|
||||||
artifactRef="--input $input"
|
artifactRef="--input $input"
|
||||||
fi
|
fi
|
||||||
|
#trim leading spaces for boolean params
|
||||||
ignoreUnfixed=$(echo $ignoreUnfixed | tr -d '\r')
|
ignoreUnfixed=$(echo $ignoreUnfixed | tr -d '\r')
|
||||||
hideProgress=$(echo $hideProgress | tr -d '\r')
|
hideProgress=$(echo $hideProgress | tr -d '\r')
|
||||||
|
limitSeveritiesForSARIF=$(echo $limitSeveritiesForSARIF | tr -d '\r')
|
||||||
|
|
||||||
GLOBAL_ARGS=""
|
GLOBAL_ARGS=""
|
||||||
if [ $cacheDir ];then
|
if [ $cacheDir ];then
|
||||||
@@ -100,6 +105,7 @@ if [ $template ] ;then
|
|||||||
fi
|
fi
|
||||||
if [ $exitCode ];then
|
if [ $exitCode ];then
|
||||||
ARGS="$ARGS --exit-code $exitCode"
|
ARGS="$ARGS --exit-code $exitCode"
|
||||||
|
SARIF_ARGS="$SARIF_ARGS --exit-code $exitCode"
|
||||||
fi
|
fi
|
||||||
if [ "$ignoreUnfixed" == "true" ] && [ "$scanType" != "config" ];then
|
if [ "$ignoreUnfixed" == "true" ] && [ "$scanType" != "config" ];then
|
||||||
ARGS="$ARGS --ignore-unfixed"
|
ARGS="$ARGS --ignore-unfixed"
|
||||||
@@ -109,9 +115,9 @@ if [ $vulnType ] && [ "$scanType" != "config" ] && [ "$scanType" != "sbom" ];the
|
|||||||
ARGS="$ARGS --vuln-type $vulnType"
|
ARGS="$ARGS --vuln-type $vulnType"
|
||||||
SARIF_ARGS="$SARIF_ARGS --vuln-type $vulnType"
|
SARIF_ARGS="$SARIF_ARGS --vuln-type $vulnType"
|
||||||
fi
|
fi
|
||||||
if [ $securityChecks ];then
|
if [ $scanners ];then
|
||||||
ARGS="$ARGS --security-checks $securityChecks"
|
ARGS="$ARGS --scanners $scanners"
|
||||||
SARIF_ARGS="$SARIF_ARGS --security-checks $securityChecks"
|
SARIF_ARGS="$SARIF_ARGS --scanners $scanners"
|
||||||
fi
|
fi
|
||||||
if [ $severity ];then
|
if [ $severity ];then
|
||||||
ARGS="$ARGS --severity $severity"
|
ARGS="$ARGS --severity $severity"
|
||||||
@@ -164,7 +170,15 @@ if [ "$skipFiles" ];then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
trivyConfig=$(echo $trivyConfig | tr -d '\r')
|
trivyConfig=$(echo $trivyConfig | tr -d '\r')
|
||||||
if [ $trivyConfig ]; then
|
# To make sure that uploda GitHub Dependency Snapshot succeeds, disable the script that fails first.
|
||||||
|
set +e
|
||||||
|
if [ "${format}" == "sarif" ] && [ "${limitSeveritiesForSARIF}" != "true" ]; then
|
||||||
|
# SARIF is special. We output all vulnerabilities,
|
||||||
|
# regardless of severity level specified in this report.
|
||||||
|
# This is a feature, not a bug :)
|
||||||
|
echo "Building SARIF report with options: ${SARIF_ARGS}" "${artifactRef}"
|
||||||
|
trivy --quiet ${scanType} --format sarif --output ${output} $SARIF_ARGS ${artifactRef}
|
||||||
|
elif [ $trivyConfig ]; then
|
||||||
echo "Running Trivy with trivy.yaml config from: " $trivyConfig
|
echo "Running Trivy with trivy.yaml config from: " $trivyConfig
|
||||||
trivy --config $trivyConfig ${scanType} ${artifactRef}
|
trivy --config $trivyConfig ${scanType} ${artifactRef}
|
||||||
returnCode=$?
|
returnCode=$?
|
||||||
@@ -175,18 +189,11 @@ else
|
|||||||
returnCode=$?
|
returnCode=$?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# SARIF is special. We output all vulnerabilities,
|
set -e
|
||||||
# regardless of severity level specified in this report.
|
|
||||||
# This is a feature, not a bug :)
|
|
||||||
if [[ "${format}" == "sarif" ]]; then
|
|
||||||
echo "Building SARIF report with options: ${SARIF_ARGS}" "${artifactRef}"
|
|
||||||
trivy --quiet ${scanType} --format sarif --output ${output} $SARIF_ARGS ${artifactRef}
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${format}" == "github" ]]; then
|
if [[ "${format}" == "github" ]]; then
|
||||||
if [[ "$(echo $githubPAT | xargs)" != "" ]]; then
|
if [[ "$(echo $githubPAT | xargs)" != "" ]]; then
|
||||||
printf "\n Uploading GitHub Dependency Snapshot"
|
printf "\n Uploading GitHub Dependency Snapshot"
|
||||||
curl -u "${githubPAT}" -H 'Content-Type: application/json' 'https://api.github.com/repos/'$GITHUB_REPOSITORY'/dependency-graph/snapshots' -d @./$(echo $output | xargs)
|
curl -H 'Accept: application/vnd.github+json' -H "Authorization: token $githubPAT" 'https://api.github.com/repos/'$GITHUB_REPOSITORY'/dependency-graph/snapshots' -d @./$(echo $output | xargs)
|
||||||
else
|
else
|
||||||
printf "\n Failing GitHub Dependency Snapshot. Missing github-pat"
|
printf "\n Failing GitHub Dependency Snapshot. Missing github-pat"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json",
|
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
|
||||||
"runs": [
|
"runs": [
|
||||||
{
|
{
|
||||||
"tool": {
|
"tool": {
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
"id": "DS002",
|
"id": "DS002",
|
||||||
"name": "Misconfiguration",
|
"name": "Misconfiguration",
|
||||||
"shortDescription": {
|
"shortDescription": {
|
||||||
"text": "DS002"
|
"text": "Image user should not be \u0026#39;root\u0026#39;"
|
||||||
},
|
},
|
||||||
"fullDescription": {
|
"fullDescription": {
|
||||||
"text": "Running containers with \u0026#39;root\u0026#39; user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a \u0026#39;USER\u0026#39; statement to the Dockerfile."
|
"text": "Running containers with \u0026#39;root\u0026#39; user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a \u0026#39;USER\u0026#39; statement to the Dockerfile."
|
||||||
@@ -35,9 +35,36 @@
|
|||||||
"HIGH"
|
"HIGH"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "DS026",
|
||||||
|
"name": "Misconfiguration",
|
||||||
|
"shortDescription": {
|
||||||
|
"text": "No HEALTHCHECK defined"
|
||||||
|
},
|
||||||
|
"fullDescription": {
|
||||||
|
"text": "You should add HEALTHCHECK instruction in your docker container images to perform the health check on running containers."
|
||||||
|
},
|
||||||
|
"defaultConfiguration": {
|
||||||
|
"level": "note"
|
||||||
|
},
|
||||||
|
"helpUri": "https://avd.aquasec.com/misconfig/ds026",
|
||||||
|
"help": {
|
||||||
|
"text": "Misconfiguration DS026\nType: Dockerfile Security Check\nSeverity: LOW\nCheck: No HEALTHCHECK defined\nMessage: Add HEALTHCHECK instruction in your Dockerfile\nLink: [DS026](https://avd.aquasec.com/misconfig/ds026)\nYou should add HEALTHCHECK instruction in your docker container images to perform the health check on running containers.",
|
||||||
|
"markdown": "**Misconfiguration DS026**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Dockerfile Security Check|LOW|No HEALTHCHECK defined|Add HEALTHCHECK instruction in your Dockerfile|[DS026](https://avd.aquasec.com/misconfig/ds026)|\n\nYou should add HEALTHCHECK instruction in your docker container images to perform the health check on running containers."
|
||||||
|
},
|
||||||
|
"properties": {
|
||||||
|
"precision": "very-high",
|
||||||
|
"security-severity": "2.0",
|
||||||
|
"tags": [
|
||||||
|
"misconfiguration",
|
||||||
|
"security",
|
||||||
|
"LOW"
|
||||||
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": "0.31.2"
|
"version": "0.42.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"results": [
|
"results": [
|
||||||
@@ -61,6 +88,36 @@
|
|||||||
"endLine": 1,
|
"endLine": 1,
|
||||||
"endColumn": 1
|
"endColumn": 1
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"text": "Dockerfile"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"ruleId": "DS026",
|
||||||
|
"ruleIndex": 1,
|
||||||
|
"level": "note",
|
||||||
|
"message": {
|
||||||
|
"text": "Artifact: Dockerfile\nType: dockerfile\nVulnerability DS026\nSeverity: LOW\nMessage: Add HEALTHCHECK instruction in your Dockerfile\nLink: [DS026](https://avd.aquasec.com/misconfig/ds026)"
|
||||||
|
},
|
||||||
|
"locations": [
|
||||||
|
{
|
||||||
|
"physicalLocation": {
|
||||||
|
"artifactLocation": {
|
||||||
|
"uri": "Dockerfile",
|
||||||
|
"uriBaseId": "ROOTPATH"
|
||||||
|
},
|
||||||
|
"region": {
|
||||||
|
"startLine": 1,
|
||||||
|
"startColumn": 1,
|
||||||
|
"endLine": 1,
|
||||||
|
"endColumn": 1
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"text": "Dockerfile"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
+29
-2
@@ -20,14 +20,15 @@
|
|||||||
"Class": "config",
|
"Class": "config",
|
||||||
"Type": "dockerfile",
|
"Type": "dockerfile",
|
||||||
"MisconfSummary": {
|
"MisconfSummary": {
|
||||||
"Successes": 21,
|
"Successes": 24,
|
||||||
"Failures": 1,
|
"Failures": 2,
|
||||||
"Exceptions": 0
|
"Exceptions": 0
|
||||||
},
|
},
|
||||||
"Misconfigurations": [
|
"Misconfigurations": [
|
||||||
{
|
{
|
||||||
"Type": "Dockerfile Security Check",
|
"Type": "Dockerfile Security Check",
|
||||||
"ID": "DS002",
|
"ID": "DS002",
|
||||||
|
"AVDID": "AVD-DS-0002",
|
||||||
"Title": "Image user should not be 'root'",
|
"Title": "Image user should not be 'root'",
|
||||||
"Description": "Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.",
|
"Description": "Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.",
|
||||||
"Message": "Specify at least 1 USER command in Dockerfile with non-root user as argument",
|
"Message": "Specify at least 1 USER command in Dockerfile with non-root user as argument",
|
||||||
@@ -49,6 +50,32 @@
|
|||||||
"Lines": null
|
"Lines": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "Dockerfile Security Check",
|
||||||
|
"ID": "DS026",
|
||||||
|
"AVDID": "AVD-DS-0026",
|
||||||
|
"Title": "No HEALTHCHECK defined",
|
||||||
|
"Description": "You should add HEALTHCHECK instruction in your docker container images to perform the health check on running containers.",
|
||||||
|
"Message": "Add HEALTHCHECK instruction in your Dockerfile",
|
||||||
|
"Namespace": "builtin.dockerfile.DS026",
|
||||||
|
"Query": "data.builtin.dockerfile.DS026.deny",
|
||||||
|
"Resolution": "Add HEALTHCHECK instruction in Dockerfile",
|
||||||
|
"Severity": "LOW",
|
||||||
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/ds026",
|
||||||
|
"References": [
|
||||||
|
"https://blog.aquasec.com/docker-security-best-practices",
|
||||||
|
"https://avd.aquasec.com/misconfig/ds026"
|
||||||
|
],
|
||||||
|
"Status": "FAIL",
|
||||||
|
"Layer": {},
|
||||||
|
"CauseMetadata": {
|
||||||
|
"Provider": "Dockerfile",
|
||||||
|
"Service": "general",
|
||||||
|
"Code": {
|
||||||
|
"Lines": null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,14 +20,15 @@
|
|||||||
"Class": "config",
|
"Class": "config",
|
||||||
"Type": "dockerfile",
|
"Type": "dockerfile",
|
||||||
"MisconfSummary": {
|
"MisconfSummary": {
|
||||||
"Successes": 21,
|
"Successes": 24,
|
||||||
"Failures": 1,
|
"Failures": 2,
|
||||||
"Exceptions": 0
|
"Exceptions": 0
|
||||||
},
|
},
|
||||||
"Misconfigurations": [
|
"Misconfigurations": [
|
||||||
{
|
{
|
||||||
"Type": "Dockerfile Security Check",
|
"Type": "Dockerfile Security Check",
|
||||||
"ID": "DS002",
|
"ID": "DS002",
|
||||||
|
"AVDID": "AVD-DS-0002",
|
||||||
"Title": "Image user should not be 'root'",
|
"Title": "Image user should not be 'root'",
|
||||||
"Description": "Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.",
|
"Description": "Running containers with 'root' user can lead to a container escape situation. It is a best practice to run containers as non-root users, which can be done by adding a 'USER' statement to the Dockerfile.",
|
||||||
"Message": "Specify at least 1 USER command in Dockerfile with non-root user as argument",
|
"Message": "Specify at least 1 USER command in Dockerfile with non-root user as argument",
|
||||||
@@ -49,6 +50,32 @@
|
|||||||
"Lines": null
|
"Lines": null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Type": "Dockerfile Security Check",
|
||||||
|
"ID": "DS026",
|
||||||
|
"AVDID": "AVD-DS-0026",
|
||||||
|
"Title": "No HEALTHCHECK defined",
|
||||||
|
"Description": "You should add HEALTHCHECK instruction in your docker container images to perform the health check on running containers.",
|
||||||
|
"Message": "Add HEALTHCHECK instruction in your Dockerfile",
|
||||||
|
"Namespace": "builtin.dockerfile.DS026",
|
||||||
|
"Query": "data.builtin.dockerfile.DS026.deny",
|
||||||
|
"Resolution": "Add HEALTHCHECK instruction in Dockerfile",
|
||||||
|
"Severity": "LOW",
|
||||||
|
"PrimaryURL": "https://avd.aquasec.com/misconfig/ds026",
|
||||||
|
"References": [
|
||||||
|
"https://blog.aquasec.com/docker-security-best-practices",
|
||||||
|
"https://avd.aquasec.com/misconfig/ds026"
|
||||||
|
],
|
||||||
|
"Status": "FAIL",
|
||||||
|
"Layer": {},
|
||||||
|
"CauseMetadata": {
|
||||||
|
"Provider": "Dockerfile",
|
||||||
|
"Service": "general",
|
||||||
|
"Code": {
|
||||||
|
"Lines": null
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"version": "2.1.0",
|
"version": "2.1.0",
|
||||||
"$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json",
|
"$schema": "https://json.schemastore.org/sarif-2.1.0.json",
|
||||||
"runs": [
|
"runs": [
|
||||||
{
|
{
|
||||||
"tool": {
|
"tool": {
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": "0.31.2"
|
"version": "0.42.1"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"results": [
|
"results": [
|
||||||
|
|||||||
@@ -75,12 +75,15 @@ Total: 19 (CRITICAL: 19)
|
|||||||
|
|
||||||
rust-app/Cargo.lock (cargo)
|
rust-app/Cargo.lock (cargo)
|
||||||
===========================
|
===========================
|
||||||
Total: 1 (CRITICAL: 1)
|
Total: 2 (CRITICAL: 2)
|
||||||
|
|
||||||
┌──────────┬────────────────┬──────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐
|
┌──────────┬────────────────┬──────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐
|
||||||
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
|
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
|
||||||
├──────────┼────────────────┼──────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
├──────────┼────────────────┼──────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
│ smallvec │ CVE-2021-25900 │ CRITICAL │ 0.6.9 │ 0.6.14, 1.6.1 │ An issue was discovered in the smallvec crate before 0.6.14 │
|
│ openssl │ CVE-2018-20997 │ CRITICAL │ 0.8.3 │ 0.10.9 │ Use after free in openssl │
|
||||||
|
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-20997 │
|
||||||
|
├──────────┼────────────────┤ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
|
│ smallvec │ CVE-2021-25900 │ │ 0.6.9 │ 1.6.1, 0.6.14 │ An issue was discovered in the smallvec crate before 0.6.14 │
|
||||||
│ │ │ │ │ │ and 1.x... │
|
│ │ │ │ │ │ and 1.x... │
|
||||||
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-25900 │
|
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-25900 │
|
||||||
└──────────┴────────────────┴──────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘
|
└──────────┴────────────────┴──────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘
|
||||||
|
|||||||
@@ -75,12 +75,15 @@ Total: 19 (CRITICAL: 19)
|
|||||||
|
|
||||||
rust-app/Cargo.lock (cargo)
|
rust-app/Cargo.lock (cargo)
|
||||||
===========================
|
===========================
|
||||||
Total: 4 (CRITICAL: 4)
|
Total: 5 (CRITICAL: 5)
|
||||||
|
|
||||||
┌───────────┬────────────────┬──────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐
|
┌───────────┬────────────────┬──────────┬───────────────────┬───────────────┬─────────────────────────────────────────────────────────────┐
|
||||||
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
|
│ Library │ Vulnerability │ Severity │ Installed Version │ Fixed Version │ Title │
|
||||||
├───────────┼────────────────┼──────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
├───────────┼────────────────┼──────────┼───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
│ rand_core │ CVE-2020-25576 │ CRITICAL │ 0.4.0 │ 0.3.1, 0.4.2 │ An issue was discovered in the rand_core crate before 0.4.2 │
|
│ openssl │ CVE-2018-20997 │ CRITICAL │ 0.8.3 │ 0.10.9 │ Use after free in openssl │
|
||||||
|
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2018-20997 │
|
||||||
|
├───────────┼────────────────┤ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
|
│ rand_core │ CVE-2020-25576 │ │ 0.4.0 │ 0.3.1, 0.4.2 │ An issue was discovered in the rand_core crate before 0.4.2 │
|
||||||
│ │ │ │ │ │ for Rust.... │
|
│ │ │ │ │ │ for Rust.... │
|
||||||
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2020-25576 │
|
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2020-25576 │
|
||||||
├───────────┼────────────────┤ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
├───────────┼────────────────┤ ├───────────────────┼───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
@@ -92,7 +95,7 @@ Total: 4 (CRITICAL: 4)
|
|||||||
│ │ │ │ │ │ for Rust.... │
|
│ │ │ │ │ │ for Rust.... │
|
||||||
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-15554 │
|
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2019-15554 │
|
||||||
│ ├────────────────┤ │ ├───────────────┼─────────────────────────────────────────────────────────────┤
|
│ ├────────────────┤ │ ├───────────────┼─────────────────────────────────────────────────────────────┤
|
||||||
│ │ CVE-2021-25900 │ │ │ 0.6.14, 1.6.1 │ An issue was discovered in the smallvec crate before 0.6.14 │
|
│ │ CVE-2021-25900 │ │ │ 1.6.1, 0.6.14 │ An issue was discovered in the smallvec crate before 0.6.14 │
|
||||||
│ │ │ │ │ │ and 1.x... │
|
│ │ │ │ │ │ and 1.x... │
|
||||||
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-25900 │
|
│ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2021-25900 │
|
||||||
└───────────┴────────────────┴──────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘
|
└───────────┴────────────────┴──────────┴───────────────────┴───────────────┴─────────────────────────────────────────────────────────────┘
|
||||||
|
|||||||
@@ -69,7 +69,6 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Match": "export GITHUB_PAT=****************************************",
|
"Match": "export GITHUB_PAT=****************************************",
|
||||||
"Deleted": false,
|
|
||||||
"Layer": {}
|
"Layer": {}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
"Vulnerabilities": [
|
"Vulnerabilities": [
|
||||||
{
|
{
|
||||||
"VulnerabilityID": "CVE-2021-36159",
|
"VulnerabilityID": "CVE-2021-36159",
|
||||||
|
"PkgID": "apk-tools@2.10.6-r0",
|
||||||
"PkgName": "apk-tools",
|
"PkgName": "apk-tools",
|
||||||
"InstalledVersion": "2.10.6-r0",
|
"InstalledVersion": "2.10.6-r0",
|
||||||
"FixedVersion": "2.10.7-r0",
|
"FixedVersion": "2.10.7-r0",
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ bats_load_library bats-assert
|
|||||||
bats_load_library bats-file
|
bats_load_library bats-file
|
||||||
|
|
||||||
@test "trivy repo with securityCheck secret only" {
|
@test "trivy repo with securityCheck secret only" {
|
||||||
# trivy repo --format json --output repo.test --security-checks=secret https://github.com/krol3/demo-trivy/
|
# trivy repo --format json --output repo.test --scanners=secret https://github.com/krol3/demo-trivy/
|
||||||
run ./entrypoint.sh '-b json' '-h repo.test' '-s secret' '-a repo' '-j https://github.com/krol3/demo-trivy/'
|
run ./entrypoint.sh '-b json' '-h repo.test' '-s secret' '-a repo' '-j https://github.com/krol3/demo-trivy/'
|
||||||
run diff repo.test ./test/data/repo.test
|
run diff repo.test ./test/data/repo.test
|
||||||
echo "$output"
|
echo "$output"
|
||||||
@@ -52,7 +52,7 @@ bats_load_library bats-file
|
|||||||
}
|
}
|
||||||
|
|
||||||
@test "trivy fs with securityChecks option" {
|
@test "trivy fs with securityChecks option" {
|
||||||
# trivy fs --format json --security-checks=vuln,config --output fs-scheck.test .
|
# trivy fs --format json --scanners=vuln,config --output fs-scheck.test .
|
||||||
run ./entrypoint.sh '-a fs' '-b json' '-j .' '-s vuln,config,secret' '-h fs-scheck.test'
|
run ./entrypoint.sh '-a fs' '-b json' '-j .' '-s vuln,config,secret' '-h fs-scheck.test'
|
||||||
run diff fs-scheck.test ./test/data/fs-scheck.test
|
run diff fs-scheck.test ./test/data/fs-scheck.test
|
||||||
echo "$output"
|
echo "$output"
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
name: Build
|
name: Build
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
Reference in New Issue
Block a user