feat(k8s): scan secrets (#2178)

This commit is contained in:
Jose Donizetti
2022-05-29 10:40:51 -03:00
committed by GitHub
parent 4ab696eaa2
commit 84af32a7fe
2 changed files with 15 additions and 3 deletions

View File

@@ -4,7 +4,7 @@
This feature might change without preserving backwards compatibility. This feature might change without preserving backwards compatibility.
Scan your Kubernetes cluster for both Vulnerabilities and Misconfigurations. Scan your Kubernetes cluster for both Vulnerabilities, Secrets and Misconfigurations.
Trivy uses your local kubectl configuration to access the API server to list artifacts. Trivy uses your local kubectl configuration to access the API server to list artifacts.
@@ -24,6 +24,14 @@ Filter by severity:
$ trivy k8s --severity=CRITICAL --report=all $ trivy k8s --severity=CRITICAL --report=all
``` ```
Filter by security check (Vulnerabilties, Secrets or Misconfigurations):
```
$ trivy k8s --security-checks=secret --report=summary
# or
$ trivy k8s --security-checks=config --report=summary
```
Scan a specific namespace: Scan a specific namespace:
``` ```

View File

@@ -806,13 +806,17 @@ func NewPluginCommand() *cli.Command {
func NewK8sCommand() *cli.Command { func NewK8sCommand() *cli.Command {
k8sSecurityChecksFlag := withValue( k8sSecurityChecksFlag := withValue(
securityChecksFlag, securityChecksFlag,
fmt.Sprintf("%s,%s", types.SecurityCheckVulnerability, types.SecurityCheckConfig), fmt.Sprintf(
"%s,%s,%s",
types.SecurityCheckVulnerability,
types.SecurityCheckConfig,
types.SecurityCheckSecret),
) )
return &cli.Command{ return &cli.Command{
Name: "kubernetes", Name: "kubernetes",
Aliases: []string{"k8s"}, Aliases: []string{"k8s"},
Usage: "scan kubernetes vulnerabilities and misconfigurations", Usage: "scan kubernetes vulnerabilities, secrets and misconfigurations",
CustomHelpTemplate: cli.CommandHelpTemplate + `EXAMPLES: CustomHelpTemplate: cli.CommandHelpTemplate + `EXAMPLES:
- cluster scanning: - cluster scanning:
$ trivy k8s --report summary $ trivy k8s --report summary