forked from aquasecurity/trivy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(secret): support enable rules (aquasecurity#2035)
Co-authored-by: VaismanLior <[email protected]>
- Loading branch information
1 parent
708a7a7
commit e2a31ab
Showing
13 changed files
with
223 additions
and
56 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
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 |
---|---|---|
@@ -1,9 +1,10 @@ | ||
FROM squidfunk/mkdocs-material:7.0.6 | ||
FROM squidfunk/mkdocs-material:8.2.10 | ||
|
||
## If you want to see exactly the same version as is published to GitHub pages | ||
## use a private image for insiders, which requires authentication. | ||
|
||
# docker login -u ${GITHUB_USERNAME} -p ${GITHUB_TOKEN} ghcr.io | ||
# FROM ghcr.io/squidfunk/mkdocs-material-insiders | ||
|
||
RUN pip install mike mkdocs-macros-plugin | ||
COPY requirements.txt . | ||
RUN pip install -r requirements.txt |
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,30 @@ | ||
click==8.1.2 | ||
csscompressor==0.9.5 | ||
ghp-import==2.0.2 | ||
htmlmin==0.1.12 | ||
importlib-metadata==4.11.3 | ||
Jinja2==3.1.1 | ||
jsmin==3.0.1 | ||
Markdown==3.3.6 | ||
MarkupSafe==2.1.1 | ||
mergedeep==1.3.4 | ||
mike==1.1.2 | ||
mkdocs==1.3.0 | ||
mkdocs-macros-plugin==0.7.0 | ||
mkdocs-material==8.2.10 | ||
mkdocs-material-extensions==1.0.3 | ||
mkdocs-minify-plugin==0.5.0 | ||
mkdocs-redirects==1.0.4 | ||
packaging==21.3 | ||
Pygments==2.11.2 | ||
pymdown-extensions==9.3 | ||
pyparsing==3.0.8 | ||
python-dateutil==2.8.2 | ||
PyYAML==6.0 | ||
pyyaml-env-tag==0.1 | ||
six==1.16.0 | ||
termcolor==1.1.0 | ||
verspec==0.1.0 | ||
watchdog==2.1.7 | ||
zipp==3.8.0 | ||
|
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,98 @@ | ||
# Examples | ||
Also see [quick start][quick-start]. | ||
|
||
## Skip Directories | ||
Trivy traversals directories and scans all files except those matching the built-in allow rules by default. | ||
If your have a lot of files in your container image or project, the scanning takes time. | ||
To make it faster, you can skip traversal in the specific directory. | ||
Also, it would be helpful if your project contains secrets and certificates for testing. | ||
|
||
``` shell | ||
$ trivy image --skip-dirs /var/lib --skip-dirs /var/log YOUR_IMAGE | ||
``` | ||
|
||
``` shell | ||
$ trivy fs --skip-dirs ./my-test-dir --skip-dirs ./my-testing-cert/ /path/to/your_project | ||
``` | ||
|
||
`--skip-fles` also works similarly. | ||
|
||
## Filter by severity | ||
|
||
Use `--severity` option. | ||
|
||
``` shell | ||
$ trivy fs --severity CRITICAL ./ | ||
|
||
app/secret.sh (secrets) | ||
======================= | ||
Total: 1 (CRITICAL: 1) | ||
|
||
+----------+-------------------+----------+---------+--------------------------------+ | ||
| CATEGORY | DESCRIPTION | SEVERITY | LINE NO | MATCH | | ||
+----------+-------------------+----------+---------+--------------------------------+ | ||
| AWS | AWS Access Key ID | CRITICAL | 10 | export AWS_ACCESS_KEY_ID=***** | | ||
+----------+-------------------+----------+---------+--------------------------------+ | ||
``` | ||
|
||
## Disable secret scanning | ||
If you need vulnerability scanning only, you can disable secret scanning via the `--security-checks` flag. | ||
|
||
``` shell | ||
$ trivy image --security-checks vuln alpine:3.15 | ||
``` | ||
|
||
## With configuration file | ||
`trivy-secret.yaml` in the working directory is loaded by default. | ||
|
||
``` yaml | ||
$ cat trivy-secret.yaml | ||
rules: | ||
- id: rule1 | ||
category: general | ||
title: Generic Rule | ||
severity: HIGH | ||
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"] | ||
allow-rules: | ||
- id: social-security-number | ||
description: skip social security number | ||
regex: 219-09-9999 | ||
- id: log-dir | ||
description: skip log directory | ||
path: ^\/var\/log\/ | ||
disable-rules: | ||
- slack-access-token | ||
- slack-web-hook | ||
disable-allow-rules: | ||
- markdown | ||
|
||
# The following command automatically loads the above configuration. | ||
$ trivy image YOUR_IMAGE | ||
``` | ||
|
||
Also, you can customize the config file path via `--secret-config`. | ||
|
||
``` yaml | ||
$ cat ./secret-config/trivy.yaml | ||
rules: | ||
- id: rule1 | ||
category: general | ||
title: Generic Rule | ||
severity: HIGH | ||
regex: (?i)(?P<key>(secret))(=|:).{0,5}['"](?P<secret>[0-9a-zA-Z\-_=]{8,64})['"] | ||
allow-rules: | ||
- id: skip-text | ||
description: skip text files | ||
path: .*\.txt | ||
enable-builtin-rules: | ||
- aws-access-key-id | ||
- aws-account-id | ||
- aws-secret-access-key | ||
disable-allow-rules: | ||
- usr-dirs | ||
|
||
# Pass the above config with `--secret-config`. | ||
$ trivy fs --secret-config ./secret-config/trivy.yaml /path/to/your_project | ||
``` | ||
|
||
[quick-start]: ./scanning.md#quick-start |
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
Oops, something went wrong.