chore(cli): disable java-db flags in server mode (#5263)

* disable java-db flag for server mode

* update docs
This commit is contained in:
DmitriyLewen
2023-09-28 13:10:14 +06:00
committed by GitHub
parent 908a4914c7
commit 0ccbb4f7fd
3 changed files with 29 additions and 24 deletions

View File

@@ -64,6 +64,9 @@ Downloading the Java index DB from an external OCI registry can be done by using
$ trivy image --java-db-repository registry.gitlab.com/gitlab-org/security-products/dependencies/trivy-java-db --download-java-db-only
```
!!! Note
In [Client/Server](../references/modes/client-server.md) mode, `Java index DB` is currently only used on the `client` side.
## Remove DBs
The `--reset` flag removes all caches and databases.

View File

@@ -25,10 +25,8 @@ trivy server [flags]
--clear-cache clear image caches without scanning
--db-repository string OCI repository to retrieve trivy-db from (default "ghcr.io/aquasecurity/trivy-db")
--download-db-only download/update vulnerability database but don't run a scan
--download-java-db-only download/update Java index database but don't run a scan
--enable-modules strings [EXPERIMENTAL] module names to enable
-h, --help help for server
--java-db-repository string OCI repository to retrieve trivy-java-db from (default "ghcr.io/aquasecurity/trivy-java-db")
--listen string listen address in server mode (default "localhost:4954")
--module-dir string specify directory to the wasm modules that will be loaded (default "$HOME/.trivy/modules")
--no-progress suppress progress bar
@@ -40,7 +38,6 @@ trivy server [flags]
--registry-token string registry token
--reset remove all caches and database
--skip-db-update skip updating vulnerability database
--skip-java-db-update skip updating Java index database
--token string for authentication in client/server mode
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
--username strings username. Comma-separated usernames allowed.

View File

@@ -582,6 +582,11 @@ func NewServerCommand(globalFlags *flag.GlobalFlagGroup) *cobra.Command {
RegistryFlagGroup: flag.NewRegistryFlagGroup(),
}
// java-db only works on client side.
serverFlags.DBFlagGroup.DownloadJavaDBOnly = nil // disable '--download-java-db-only'
serverFlags.DBFlagGroup.SkipJavaDBUpdate = nil // disable '--skip-java-db-update'
serverFlags.DBFlagGroup.JavaDBRepository = nil // disable '--java-db-repository'
cmd := &cobra.Command{
Use: "server [flags]",
Aliases: []string{"s"},