Skip to content

fix(k8s): skip passed misconfigs for the summary report #8684

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

Merged
merged 2 commits into from
Apr 5, 2025

Conversation

afdesk
Copy link
Contributor

@afdesk afdesk commented Apr 4, 2025

Description

This PR removes passed misconfigs from the summary report. It's important if --include-non-failures is enabled.

$ minikube start
$ trivy k8s  --scanners=misconfig --report=summary --include-non-failures

Before:

Summary Report for minikube

Workload Assessment
┌───────────┬────────────────────┬───────────────────────┐
│ Namespace │      Resource      │   Misconfigurations   │
│           │                    ├────┬────┬────┬────┬───┤
│           │                    │ C  │ H  │ M  │ L  │ U │
├───────────┼────────────────────┼────┼────┼────┼────┼───┤
│ default   │ Service/kubernetes │ 26 │ 44 │ 25 │ 61 │   │
│           │ Node/minikube      │ 26 │ 44 │ 25 │ 61 │   │
└───────────┴────────────────────┴────┴────┴────┴────┴───┘
Severities: C=CRITICAL H=HIGH M=MEDIUM L=LOW U=UNKNOWN


Infra Assessment
┌─────────────┬──────────────────────────────────────────────┬───────────────────────┐
│  Namespace  │                   Resource                   │   Misconfigurations   │
│             │                                              ├────┬────┬────┬────┬───┤
│             │                                              │ C  │ H  │ M  │ L  │ U │
├─────────────┼──────────────────────────────────────────────┼────┼────┼────┼────┼───┤
│ kube-system │ Pod/kube-controller-manager-minikube         │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ ConfigMap/extension-apiserver-authentication │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ DaemonSet/kube-proxy                         │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ Pod/etcd-minikube                            │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ Service/kube-dns                             │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ Deployment/coredns                           │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ Pod/kube-apiserver-minikube                  │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ Pod/kube-scheduler-minikube                  │ 26 │ 44 │ 25 │ 61 │   │
│ kube-system │ Pod/storage-provisioner                      │ 26 │ 44 │ 25 │ 61 │   │
│             │ Node/minikube                                │ 26 │ 44 │ 25 │ 61 │   │
└─────────────┴──────────────────────────────────────────────┴────┴────┴────┴────┴───┘
Severities: C=CRITICAL H=HIGH M=MEDIUM L=LOW U=UNKNOWN

after:

Summary Report for minikube

Workload Assessment
┌───────────┬────────────────────┬───────────────────┐
│ Namespace │      Resource      │ Misconfigurations │
│           │                    ├───┬───┬───┬───┬───┤
│           │                    │ C │ H │ M │ L │ U │
├───────────┼────────────────────┼───┼───┼───┼───┼───┤
│ default   │ Service/kubernetes │   │   │   │ 2 │   │
│           │ Node/minikube      │   │   │   │ 2 │   │
└───────────┴────────────────────┴───┴───┴───┴───┴───┘
Severities: C=CRITICAL H=HIGH M=MEDIUM L=LOW U=UNKNOWN


Infra Assessment
┌─────────────┬──────────────────────────────────────────────┬────────────────────┐
│  Namespace  │                   Resource                   │ Misconfigurations  │
│             │                                              ├───┬───┬───┬────┬───┤
│             │                                              │ C │ H │ M │ L  │ U │
├─────────────┼──────────────────────────────────────────────┼───┼───┼───┼────┼───┤
│ kube-system │ Service/kube-dns                             │   │   │ 1 │ 2  │   │
│ kube-system │ Pod/etcd-minikube                            │   │ 2 │ 6 │ 9  │   │
│ kube-system │ Deployment/coredns                           │   │   │ 8 │ 6  │   │
│ kube-system │ Pod/kube-controller-manager-minikube         │   │ 2 │ 6 │ 12 │   │
│ kube-system │ Pod/kube-scheduler-minikube                  │   │ 2 │ 6 │ 10 │   │
│ kube-system │ Pod/storage-provisioner                      │   │ 3 │ 7 │ 12 │   │
│ kube-system │ ConfigMap/extension-apiserver-authentication │   │   │ 1 │    │   │
│ kube-system │ Pod/kube-apiserver-minikube                  │   │ 2 │ 7 │ 19 │   │
│ kube-system │ DaemonSet/kube-proxy                         │   │ 3 │ 8 │ 12 │   │
│             │ Node/minikube                                │   │ 3 │   │ 2  │   │
└─────────────┴──────────────────────────────────────────────┴───┴───┴───┴────┴───┘
Severities: C=CRITICAL H=HIGH M=MEDIUM L=LOW U=UNKNOWN

Related issues

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

@afdesk afdesk marked this pull request as ready for review April 4, 2025 11:26
@afdesk afdesk requested a review from simar7 as a code owner April 4, 2025 11:26
@simar7 simar7 enabled auto-merge April 5, 2025 06:32
@simar7 simar7 added this pull request to the merge queue Apr 5, 2025
Merged via the queue into aquasecurity:main with commit bff0e9b Apr 5, 2025
12 checks passed
@simar7
Copy link
Member

simar7 commented Apr 16, 2025

@aqua-bot backport release/v0.61

@aqua-bot
Copy link
Contributor

Backport PR created: #8748

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug(k8s): --include-non-failures shows incorrect results in trivy k8s scanner
3 participants