Skip to main content

Trivy

The trivy scraper uses Trivy to scan for security vulnerabilities & misconfigurations in your configuration. At the moment, there's only support for scanning Kubernetes objects.

trivy-scraper.yaml
apiVersion: configs.flanksource.com/v1
kind: ScrapeConfig
metadata:
name: trivy-scraper
spec:
trivy:
- version: '0.40.0'
kubernetes:
namespace: production

Unlike other scrapers, this one does not scape new configs but rather look for security vulnerabilities in the existing configs. This scrapper, if configured to scan a kubernetes cluster, will map all the found vulnerabilities to the corresponding config item.

Config Insights generated by Trivy Scraper Fig: Config Insights generated by Trivy Scraper

Config Insights generated by Trivy Scraper Fig: A detailed view of the analysis on the postgres container

Scraper

FieldDescriptionSchemeRequired
logLevelSpecify the level of logging.string
scheduleSpecify the interval to scrape in cron format. Defaults to every 60 minutes.string
fullSet to true to extract changes from scraped configurations. Defaults to false.bool
retentionSettings for retaining changes, analysis and scraped itemsRetention
trivySpecifies the list of Trivy configurations to scrape.[]Trivy

Trivy

FieldDescriptionSchemeRequired
idA static value or JSONPath expression to use as the ID for the resource.stringtrue
nameA static value or JSONPath expression to use as the Name for the resource. Default value is the id.string
itemsA JSONPath expression to use to extract individual items from the resourcestring
typeA static value or JSONPath expression to use as the type for the resource.stringtrue
transformSpecify field to transform result.Transform
formatFormat of config item, defaults to JSON, available options are JSON.string
timestampFormatTimestampFormat is a Go time format string used to parse timestamps in createFields and DeletedFields. If not specified, the default is RFC3339.string
versionSpecify the Trivy version to use. (default 0.40.0)string
compliancecompliance report to generate(k8s-nsa, k8s-cis, k8s-pss-baseline, k8s-pss-restricted).string
ignoredLicensesspecify a list of license to ignore.[]string
ignoreUnfixeddisplay only fixed vulnerabilities.bool
licenseFulleagerly look for licenses in source code headers and license files.bool
severityseverities of security issues to be displayed (comma separated)(default "UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL").string
vulnTypecomma-separated list of vulnerability types (comma separated)(default "os,library").string
kubernetesSpecify the trivy option to scan kubernetes objects.K8sOptionstrue

K8sOptions

Trivy Options consist of selected few flags that are passed on to trivy.

FieldDescriptionSchemeRequired
componentsSpecify which components to scan(default workload, infra).[]string
kubeconfigSpecify the kubeconfig file path to use as a static value or as a JSONPath expression.string
namespaceSpecify a namespace to scan.stringtrue
contextSpecify a context to scan.string