Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(vex): VEX Repository support #7206

Merged
merged 56 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
547363a
feat: add vex subcommand
knqyf263 Jul 3, 2024
6ab7fc8
feat: adhere to VEX Repository Specification
knqyf263 Jul 4, 2024
476dcfc
fix: inherit logger options for fatal errors
knqyf263 Jul 4, 2024
d885ecf
feat: download VEX repos
knqyf263 Jul 4, 2024
8ba0871
feat: add --vex-repos to 'trivy clean'
knqyf263 Jul 4, 2024
319eb65
add 'trivy vex repo download'
knqyf263 Jul 5, 2024
2b18878
feat: cache ETag
knqyf263 Jul 5, 2024
d2ec227
TODO: refactor CycloneDX
knqyf263 Jul 5, 2024
c548e38
refactor: always create parent map
knqyf263 Jul 6, 2024
9787609
refactor: rename library to package
knqyf263 Jul 6, 2024
71b8ca3
refactor: rename FilterOption to FilterOptions
knqyf263 Jul 6, 2024
6a0533d
fix: re-use the existing UID
knqyf263 Jul 6, 2024
7b35ccc
refactor: re-define interface
knqyf263 Jul 6, 2024
abd6ab9
test: fit for new interface
knqyf263 Jul 6, 2024
7458b32
fix: re-use serial number from SBOM
knqyf263 Jul 6, 2024
1353291
fix: go-github may return nil for transport
knqyf263 Jul 8, 2024
e969bf8
feat: store cache metadata for VEX repos
knqyf263 Jul 8, 2024
d098fb6
feat: add RepositorySet
knqyf263 Jul 10, 2024
430954e
feat(csaf): support VEX source
knqyf263 Jul 10, 2024
34ade4b
test: fix sources
knqyf263 Jul 10, 2024
33f8207
test(vex): add tests for repository set
knqyf263 Jul 10, 2024
3d6e0e3
test: add more vexr tests
knqyf263 Jul 10, 2024
02e173a
feat: skip repos that hasn't been downloaded
knqyf263 Jul 10, 2024
ab19441
feat: use repository_url for OCI
knqyf263 Jul 11, 2024
0b8c2fd
feat: add "--vex repo"
knqyf263 Jul 11, 2024
03c707f
feat: add "enabled" field
knqyf263 Jul 11, 2024
82f9595
feat: add authentication
knqyf263 Jul 12, 2024
a22ad36
test(vex): add tests for vex-repo
knqyf263 Jul 13, 2024
2609053
feat: support version array
knqyf263 Jul 18, 2024
438187d
test(vex): add tests for manager
knqyf263 Jul 20, 2024
74ebecf
feat: add "vex repo list"
knqyf263 Jul 20, 2024
83d5ae0
chore: rename --vex-repos to --vex-repo
knqyf263 Jul 20, 2024
db16176
docs: add VEX Repository
knqyf263 Jul 20, 2024
2f04b6e
feat(vex): add --skip-vex-repo-update
knqyf263 Jul 20, 2024
1f4ccb9
Merge branch 'main' into feat/vexrepo
knqyf263 Jul 22, 2024
8fcd8d2
test(integration): add VEX tests
knqyf263 Jul 22, 2024
e2ce02f
fix(plugin): join plugins dir
knqyf263 Jul 22, 2024
bfb24cf
test(vex): comply with new spec
knqyf263 Jul 22, 2024
ba16b88
test(vex): show a file path
knqyf263 Jul 22, 2024
6dff269
test(vex): add enabled field
knqyf263 Jul 22, 2024
8ee2353
feat(download): support client mode
knqyf263 Jul 22, 2024
7e24dca
fix: support insecure in custom transport
knqyf263 Jul 22, 2024
aec8684
fix: lint issues
knqyf263 Jul 22, 2024
32bcd21
ci: switch to ubuntu-latest
knqyf263 Jul 23, 2024
d5cc59d
docs: auto-generate
knqyf263 Jul 23, 2024
422e03c
Update manager.go
knqyf263 Jul 23, 2024
fca16cb
fix: cli usage
knqyf263 Jul 25, 2024
71c9bf3
Update pkg/commands/operation/operation.go
knqyf263 Jul 25, 2024
642f2d9
docs(cache): add a link to vex repo
knqyf263 Jul 25, 2024
9881b0f
revert: add parents flag
knqyf263 Jul 25, 2024
19e60ba
chore: add a comment
knqyf263 Jul 25, 2024
e02af76
chore: add a long description
knqyf263 Jul 25, 2024
424759e
fix: delete unused field
knqyf263 Jul 25, 2024
07ba807
fix: delete debug code
knqyf263 Jul 25, 2024
ae853ce
docs: generate references
knqyf263 Jul 25, 2024
1479468
feat: show debug message once per package
knqyf263 Jul 25, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest-m, windows-latest, macos-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/[email protected]

Expand All @@ -31,15 +31,15 @@ jobs:
echo "Run 'go mod tidy' and push it"
exit 1
fi
if: matrix.operating-system == 'ubuntu-latest-m'
if: matrix.operating-system == 'ubuntu-latest'

- name: Lint
id: lint
uses: golangci/[email protected]
with:
version: v1.59
args: --verbose --out-format=line-number
if: matrix.operating-system == 'ubuntu-latest-m'
if: matrix.operating-system == 'ubuntu-latest'

- name: Check if linter failed
run: |
Expand All @@ -60,14 +60,14 @@ jobs:
echo "Run 'mage docs:generate' and push it"
exit 1
fi
if: matrix.operating-system == 'ubuntu-latest-m'
if: matrix.operating-system == 'ubuntu-latest'

- name: Run unit tests
run: mage test:unit

integration:
name: Integration Test
runs-on: ubuntu-latest-m
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/[email protected]
Expand All @@ -87,7 +87,7 @@ jobs:

k8s-integration:
name: K8s Integration Test
runs-on: ubuntu-latest-m
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/[email protected]
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:

vm-test:
name: VM Integration Test
runs-on: ubuntu-latest-m
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/[email protected]
Expand All @@ -151,7 +151,7 @@ jobs:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest-m, windows-latest, macos-latest]
operating-system: [ubuntu-latest, windows-latest, macos-latest]
env:
DOCKER_CLI_EXPERIMENTAL: "enabled"
steps:
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/configuration/cache.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# Cache
The cache directory includes

- Cache of previous scans (Scan cache).
- [Vulnerability Database][trivy-db][^1]
- [Java Index Database][trivy-java-db][^2]
- [Misconfiguration Checks][misconf-checks][^3]
- Cache of previous scans.
- [VEX Repositories](../supply-chain/vex/repo.md)

The cache option is common to all scanners.

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/configuration/filtering.md
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ You can find more example checks [here](https://github.com/aquasecurity/trivy/tr
| Secret | |
| License | |

Please refer to the [VEX documentation](../supply-chain/vex.md) for the details.
Please refer to the [VEX documentation](../supply-chain/vex/index.md) for the details.


[^1]: license name is used as id for `.trivyignore.yaml` files.
Expand Down
1 change: 1 addition & 0 deletions docs/docs/references/configuration/cli/trivy.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,6 @@ trivy [global flags] command [flags] target
* [trivy sbom](trivy_sbom.md) - Scan SBOM for vulnerabilities and licenses
* [trivy server](trivy_server.md) - Server mode
* [trivy version](trivy_version.md) - Print the version
* [trivy vex](trivy_vex.md) - [EXPERIMENTAL] VEX utilities
* [trivy vm](trivy_vm.md) - [EXPERIMENTAL] Scan a virtual machine image

1 change: 1 addition & 0 deletions docs/docs/references/configuration/cli/trivy_clean.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ trivy clean [flags]
-h, --help help for clean
--java-db remove Java database
--scan-cache remove scan cache (container and VM image analysis results)
--vex-repo remove VEX repositories
--vuln-db remove vulnerability database
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,15 @@ trivy filesystem [flags] PATH
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-java-db-update skip updating Java index database
--skip-vex-repo-update [EXPERIMENTAL] Skip VEX Repository update
-t, --template string output template
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
--tf-vars strings specify paths to override the Terraform tfvars files
--token string for authentication in client/server mode
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
--trace enable more verbose trace output for custom queries
--username strings username. Comma-separated usernames allowed.
--vex string [EXPERIMENTAL] file path to VEX
--vex strings [EXPERIMENTAL] VEX sources ("repo" or file path)
```

### Options inherited from parent commands
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/references/configuration/cli/trivy_image.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ trivy image [flags] IMAGE_NAME
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-java-db-update skip updating Java index database
--skip-vex-repo-update [EXPERIMENTAL] Skip VEX Repository update
-t, --template string output template
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
--token string for authentication in client/server mode
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
--trace enable more verbose trace output for custom queries
--username strings username. Comma-separated usernames allowed.
--vex string [EXPERIMENTAL] file path to VEX
--vex strings [EXPERIMENTAL] VEX sources ("repo" or file path)
```

### Options inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ trivy kubernetes [flags] [CONTEXT]
--skip-files strings specify the files or glob patterns to skip
--skip-images skip the downloading and scanning of images (vulnerabilities and secrets) in the cluster resources
--skip-java-db-update skip updating Java index database
--skip-vex-repo-update [EXPERIMENTAL] Skip VEX Repository update
-t, --template string output template
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
--tolerations strings specify node-collector job tolerations (example: key1=value1:NoExecute,key2=value2:NoSchedule)
--trace enable more verbose trace output for custom queries
--username strings username. Comma-separated usernames allowed.
--vex string [EXPERIMENTAL] file path to VEX
--vex strings [EXPERIMENTAL] VEX sources ("repo" or file path)
```

### Options inherited from parent commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ trivy repository [flags] (REPO_PATH | REPO_URL)
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-java-db-update skip updating Java index database
--skip-vex-repo-update [EXPERIMENTAL] Skip VEX Repository update
--tag string pass the tag name to be scanned
-t, --template string output template
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
Expand All @@ -89,7 +90,7 @@ trivy repository [flags] (REPO_PATH | REPO_URL)
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
--trace enable more verbose trace output for custom queries
--username strings username. Comma-separated usernames allowed.
--vex string [EXPERIMENTAL] file path to VEX
--vex strings [EXPERIMENTAL] VEX sources ("repo" or file path)
```

### Options inherited from parent commands
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/references/configuration/cli/trivy_rootfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,15 @@ trivy rootfs [flags] ROOTDIR
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-java-db-update skip updating Java index database
--skip-vex-repo-update [EXPERIMENTAL] Skip VEX Repository update
-t, --template string output template
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
--tf-vars strings specify paths to override the Terraform tfvars files
--token string for authentication in client/server mode
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
--trace enable more verbose trace output for custom queries
--username strings username. Comma-separated usernames allowed.
--vex string [EXPERIMENTAL] file path to VEX
--vex strings [EXPERIMENTAL] VEX sources ("repo" or file path)
```

### Options inherited from parent commands
Expand Down
3 changes: 2 additions & 1 deletion docs/docs/references/configuration/cli/trivy_sbom.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,11 @@ trivy sbom [flags] SBOM_PATH
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-java-db-update skip updating Java index database
--skip-vex-repo-update [EXPERIMENTAL] Skip VEX Repository update
-t, --template string output template
--token string for authentication in client/server mode
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
--vex string [EXPERIMENTAL] file path to VEX
--vex strings [EXPERIMENTAL] VEX sources ("repo" or file path)
```

### Options inherited from parent commands
Expand Down
28 changes: 28 additions & 0 deletions docs/docs/references/configuration/cli/trivy_vex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
## trivy vex

[EXPERIMENTAL] VEX utilities

### Options

```
-h, --help help for vex
```

### Options inherited from parent commands

```
--cache-dir string cache directory (default "/path/to/cache")
-c, --config string config path (default "trivy.yaml")
-d, --debug debug mode
--generate-default-config write the default config to trivy-default.yaml
--insecure allow insecure server connections
-q, --quiet suppress progress bar and log output
--timeout duration timeout (default 5m0s)
-v, --version show version
```

### SEE ALSO

* [trivy](trivy.md) - Unified security scanner
* [trivy vex repo](trivy_vex_repo.md) - Manage VEX repositories

44 changes: 44 additions & 0 deletions docs/docs/references/configuration/cli/trivy_vex_repo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
## trivy vex repo

Manage VEX repositories

### Examples

```
# Initialize the configuration file
$ trivy vex repo init

# List VEX repositories
$ trivy vex repo list

# Download the VEX repositories
$ trivy vex repo download

```

### Options

```
-h, --help help for repo
```

### Options inherited from parent commands

```
--cache-dir string cache directory (default "/path/to/cache")
-c, --config string config path (default "trivy.yaml")
-d, --debug debug mode
--generate-default-config write the default config to trivy-default.yaml
--insecure allow insecure server connections
-q, --quiet suppress progress bar and log output
--timeout duration timeout (default 5m0s)
-v, --version show version
```

### SEE ALSO

* [trivy vex](trivy_vex.md) - [EXPERIMENTAL] VEX utilities
* [trivy vex repo download](trivy_vex_repo_download.md) - Download the VEX repositories
* [trivy vex repo init](trivy_vex_repo_init.md) - Initialize a configuration file
* [trivy vex repo list](trivy_vex_repo_list.md) - List VEX repositories

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
## trivy vex repo download

Download the VEX repositories

### Synopsis

Downloads enabled VEX repositories. If specific repository names are provided as arguments, only those repositories will be downloaded. Otherwise, all enabled repositories are downloaded.

```
trivy vex repo download [REPO_NAMES] [flags]
```

### Options

```
-h, --help help for download
```

### Options inherited from parent commands

```
--cache-dir string cache directory (default "/path/to/cache")
-c, --config string config path (default "trivy.yaml")
-d, --debug debug mode
--generate-default-config write the default config to trivy-default.yaml
--insecure allow insecure server connections
-q, --quiet suppress progress bar and log output
--timeout duration timeout (default 5m0s)
-v, --version show version
```

### SEE ALSO

* [trivy vex repo](trivy_vex_repo.md) - Manage VEX repositories

31 changes: 31 additions & 0 deletions docs/docs/references/configuration/cli/trivy_vex_repo_init.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## trivy vex repo init

Initialize a configuration file

```
trivy vex repo init [flags]
```

### Options

```
-h, --help help for init
```

### Options inherited from parent commands

```
--cache-dir string cache directory (default "/path/to/cache")
-c, --config string config path (default "trivy.yaml")
-d, --debug debug mode
--generate-default-config write the default config to trivy-default.yaml
--insecure allow insecure server connections
-q, --quiet suppress progress bar and log output
--timeout duration timeout (default 5m0s)
-v, --version show version
```

### SEE ALSO

* [trivy vex repo](trivy_vex_repo.md) - Manage VEX repositories

31 changes: 31 additions & 0 deletions docs/docs/references/configuration/cli/trivy_vex_repo_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
## trivy vex repo list

List VEX repositories

```
trivy vex repo list [flags]
```

### Options

```
-h, --help help for list
```

### Options inherited from parent commands

```
--cache-dir string cache directory (default "/path/to/cache")
-c, --config string config path (default "trivy.yaml")
-d, --debug debug mode
--generate-default-config write the default config to trivy-default.yaml
--insecure allow insecure server connections
-q, --quiet suppress progress bar and log output
--timeout duration timeout (default 5m0s)
-v, --version show version
```

### SEE ALSO

* [trivy vex repo](trivy_vex_repo.md) - Manage VEX repositories

3 changes: 2 additions & 1 deletion docs/docs/references/configuration/cli/trivy_vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ trivy vm [flags] VM_IMAGE
--skip-dirs strings specify the directories or glob patterns to skip
--skip-files strings specify the files or glob patterns to skip
--skip-java-db-update skip updating Java index database
--skip-vex-repo-update [EXPERIMENTAL] Skip VEX Repository update
-t, --template string output template
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
--token string for authentication in client/server mode
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
--vex string [EXPERIMENTAL] file path to VEX
--vex strings [EXPERIMENTAL] VEX sources ("repo" or file path)
```

### Options inherited from parent commands
Expand Down
Loading