-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(yaml): Add support for trivy.yaml (#143)
* feat(yaml): Add support for trivy.yaml Signed-off-by: Simar <[email protected]> * chore: fixing test using trivy v 0.30.0 * chore(deps): Update to use Trivy v0.30.2 Signed-off-by: Simar <[email protected]> Co-authored-by: carolina valencia <[email protected]>
- Loading branch information
Showing
12 changed files
with
313 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
name: "build" | ||
on: [push, pull_request] | ||
env: | ||
TRIVY_VERSION: 0.29.2 | ||
TRIVY_VERSION: 0.30.2 | ||
BATS_LIB_PATH: '/usr/lib/' | ||
jobs: | ||
build: | ||
name: build | ||
|
@@ -11,7 +12,7 @@ jobs: | |
- name: Setup BATS | ||
uses: mig4/setup-bats@v1 | ||
with: | ||
bats-version: 1.2.1 | ||
bats-version: 1.7.0 | ||
|
||
- name: Setup Bats libs | ||
uses: brokenpip3/[email protected] | ||
|
@@ -24,10 +25,4 @@ jobs: | |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v${{ env.TRIVY_VERSION }} | ||
- name: Test | ||
run: bats --recursive --timing . | ||
|
||
- name: Debug show artifacts | ||
if: always() | ||
run: | | ||
cat ./config.test | ||
cat ./fs-scheck.test | ||
run: BATS_LIB_PATH=${{ env.BATS_LIB_PATH }} bats --recursive --timing . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"version": "2.1.0", | ||
"$schema": "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", | ||
"runs": [ | ||
{ | ||
"tool": { | ||
"driver": { | ||
"fullName": "Trivy Vulnerability Scanner", | ||
"informationUri": "https://github.com/aquasecurity/trivy", | ||
"name": "Trivy", | ||
"rules": [ | ||
{ | ||
"id": "DS002", | ||
"name": "Misconfiguration", | ||
"shortDescription": { | ||
"text": "DS002" | ||
}, | ||
"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." | ||
}, | ||
"defaultConfiguration": { | ||
"level": "error" | ||
}, | ||
"helpUri": "https://avd.aquasec.com/misconfig/ds002", | ||
"help": { | ||
"text": "Misconfiguration DS002\nType: Dockerfile Security Check\nSeverity: HIGH\nCheck: Image user should not be 'root'\nMessage: Specify at least 1 USER command in Dockerfile with non-root user as argument\nLink: [DS002](https://avd.aquasec.com/misconfig/ds002)\nRunning 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.", | ||
"markdown": "**Misconfiguration DS002**\n| Type | Severity | Check | Message | Link |\n| --- | --- | --- | --- | --- |\n|Dockerfile Security Check|HIGH|Image user should not be 'root'|Specify at least 1 USER command in Dockerfile with non-root user as argument|[DS002](https://avd.aquasec.com/misconfig/ds002)|\n\nRunning 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." | ||
}, | ||
"properties": { | ||
"precision": "very-high", | ||
"security-severity": "8.0", | ||
"tags": [ | ||
"misconfiguration", | ||
"security", | ||
"HIGH" | ||
] | ||
} | ||
} | ||
], | ||
"version": "0.30.2" | ||
} | ||
}, | ||
"results": [ | ||
{ | ||
"ruleId": "DS002", | ||
"ruleIndex": 0, | ||
"level": "error", | ||
"message": { | ||
"text": "Artifact: Dockerfile\nType: dockerfile\nVulnerability DS002\nSeverity: HIGH\nMessage: Specify at least 1 USER command in Dockerfile with non-root user as argument\nLink: [DS002](https://avd.aquasec.com/misconfig/ds002)" | ||
}, | ||
"locations": [ | ||
{ | ||
"physicalLocation": { | ||
"artifactLocation": { | ||
"uri": "Dockerfile", | ||
"uriBaseId": "ROOTPATH" | ||
}, | ||
"region": { | ||
"startLine": 1, | ||
"startColumn": 1, | ||
"endLine": 1, | ||
"endColumn": 1 | ||
} | ||
} | ||
} | ||
] | ||
} | ||
], | ||
"columnKind": "utf16CodeUnits", | ||
"originalUriBaseIds": { | ||
"ROOTPATH": { | ||
"uri": "file:///" | ||
} | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,76 @@ | ||
┌──────────┬──────────────────────────────┬──────────┬─────────┬─────────────────────────┐ | ||
│ Category │ Description │ Severity │ Line No │ Match │ | ||
├──────────┼──────────────────────────────┼──────────┼─────────┼─────────────────────────┤ | ||
│ GitHub │ GitHub Personal Access Token │ CRITICAL │ 5 │ export GITHUB_PAT=***** │ | ||
└──────────┴──────────────────────────────┴──────────┴─────────┴─────────────────────────┘ | ||
{ | ||
"SchemaVersion": 2, | ||
"ArtifactName": "https://github.com/krol3/demo-trivy/", | ||
"ArtifactType": "repository", | ||
"Metadata": { | ||
"ImageConfig": { | ||
"architecture": "", | ||
"created": "0001-01-01T00:00:00Z", | ||
"os": "", | ||
"rootfs": { | ||
"type": "", | ||
"diff_ids": null | ||
}, | ||
"config": {} | ||
} | ||
}, | ||
"Results": [ | ||
{ | ||
"Target": "env", | ||
"Class": "secret", | ||
"Secrets": [ | ||
{ | ||
"RuleID": "github-pat", | ||
"Category": "GitHub", | ||
"Severity": "CRITICAL", | ||
"Title": "GitHub Personal Access Token", | ||
"StartLine": 5, | ||
"EndLine": 5, | ||
"Code": { | ||
"Lines": [ | ||
{ | ||
"Number": 3, | ||
"Content": "export AWS_ACCESS_KEY_ID=1234567", | ||
"IsCause": false, | ||
"Annotation": "", | ||
"Truncated": false, | ||
"Highlighted": "export AWS_ACCESS_KEY_ID=1234567", | ||
"FirstCause": false, | ||
"LastCause": false | ||
}, | ||
{ | ||
"Number": 4, | ||
"Content": "", | ||
"IsCause": false, | ||
"Annotation": "", | ||
"Truncated": false, | ||
"FirstCause": false, | ||
"LastCause": false | ||
}, | ||
{ | ||
"Number": 5, | ||
"Content": "export GITHUB_PAT=****************************************", | ||
"IsCause": true, | ||
"Annotation": "", | ||
"Truncated": false, | ||
"Highlighted": "export GITHUB_PAT=****************************************", | ||
"FirstCause": true, | ||
"LastCause": true | ||
}, | ||
{ | ||
"Number": 6, | ||
"Content": "", | ||
"IsCause": false, | ||
"Annotation": "", | ||
"Truncated": false, | ||
"FirstCause": false, | ||
"LastCause": false | ||
} | ||
] | ||
}, | ||
"Match": "export GITHUB_PAT=****************************************" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
format: json | ||
severity: CRITICAL |
Oops, something went wrong.