Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Gjallarhorn

Gjallarhorn is a read-only dashboard over the reports the Trivy Operator writes to a Kubernetes cluster. It answers one question first: which few images hold most of your critical vulnerabilities, so you know what to update next.

It is one Rust binary. It reads the aquasecurity.github.io reports every two minutes, aggregates them in memory and serves a JSON API and an embedded Svelte frontend. On a cluster with about 130 images and 3,000 distinct CVEs one read takes about a second and peaks at about 170 MiB of memory.

Features

  • A “fix first” overview: the images that carry the largest share of critical findings, ranked, with the share each one holds.
  • Images counted once per digest, however many pods run them. Reports on ReplicaSets show under their Deployment.
  • Per image, findings grouped by package with the one version to update to. End-of-life base OSes are flagged.
  • CVEs across the cluster with how many images, workloads and namespaces each one reaches, and the critical and high ones published in the last 30 days.
  • Workload misconfigurations and RBAC risks, by resource or by check.
  • Secrets found in image layers. The matched text is never read or served.
  • NSA and Pod Security Standards compliance.
  • Findings without a vendor severity are counted as “not rated” and kept out of the bars.
  • Light and dark themes, usable on a phone.

Gjallarhorn does not scan anything itself and never writes to the cluster. What it shows is what the Trivy Operator found.

Install

Gjallarhorn needs the Trivy Operator installed and scanning. Install the chart:

helm install gjallarhorn oci://ghcr.io/diverofdark/charts/gjallarhorn \
  --namespace gjallarhorn --create-namespace \
  --set ingress.enabled=true \
  --set 'ingress.hosts[0].host=security.example.com' \
  --set 'ingress.hosts[0].paths[0].path=/' \
  --set 'ingress.hosts[0].paths[0].pathType=Prefix'

The chart also lives in this repository under charts/gjallarhorn, which is what an Argo CD Application can point at.

Gjallarhorn has no login. The page tells anyone who opens it which of your images are vulnerable and how. Keep the Ingress on a private network, or put an authenticating proxy such as oauth2-proxy in front of it.

The first read takes a few seconds; until then the page shows “Loading”. If the Trivy Operator is installed but has not finished its first scans, the page is mostly empty and fills in as reports arrive.

Resources

Memory grows with the number of reports. As a starting point:

resources:
  requests: { cpu: 20m, memory: 192Mi }
  limits: { memory: 512Mi }

Configuration

Chart values

KeyMeaningDefault
image.repository, image.tag, image.pullPolicyThe image.ghcr.io/diverofdark/gjallarhorn, latest, IfNotPresent
refreshSecondsSeconds between reads of the reports.120
logLevelLog filter, e.g. gjallarhorn=debug,warn.gjallarhorn=info,warn
ingress.*A standard Ingress: className, annotations, labels, hosts, tls.off
service.type, service.portThe Service.ClusterIP, 8080
rbac.createCreate the ClusterRole and its binding, see Permissions.true
serviceAccount.annotationsAnnotations on the service account.{}
additionalObjectsExtra manifests rendered with the release, passed through tpl.[]
podAnnotations, podLabels, resources, nodeSelector, tolerations, affinityThe usual pod settings.empty

Flags

The binary reads flags or the matching environment variables. The chart sets them for you.

FlagEnvironmentMeaningDefault
--bindGJALLARHORN_BINDAddress to listen on. The image sets 0.0.0.0:8080.127.0.0.1:8080
--refreshGJALLARHORN_REFRESHSeconds between reads of the reports.120
--contextGJALLARHORN_CONTEXTKubeconfig context. In a pod the service account is used.current context
--fixturesGJALLARHORN_FIXTURESServe reports from a JSON file instead of a cluster, see Development.off
RUST_LOGLog filter.info

Overview

The overview is built to tell you what to do next, not only how bad things are.

Fix first

The headline counts the critical findings in the five images that hold the most of them, out of all critical findings in the cluster: “Five images carry 63 of your 111 critical vulnerabilities.” When there are no critical findings it uses high ones instead.

The bar under the headline is every critical finding in the cluster. The numbered segments are the five images, sized by their share; the hatched part is everything else. Each segment and each row of the list opens that image.

When every one of those findings has a fixed version, the text says so. That is the common case when the Trivy Operator runs with trivy.ignoreUnfixed: true.

Totals

Below the headline are the totals by severity, each a link to the CVE list filtered to that severity. Findings that are too new to have a vendor severity are counted separately as “not rated” and kept out of the bar, see How findings are counted.

The row under the totals links to the other report types: misconfigured resources, critical RBAC risks, secrets found in images, and images on an end-of-life OS.

Namespaces

Namespaces sorted by critical, then high findings. The switch above the table measures them by vulnerabilities, workload misconfigurations or RBAC findings. A row opens the namespace’s workloads, or its misconfigurations.

Lists on the right

  • New this month: critical and high CVEs published in the last 30 days that affect at least one image.
  • Most widespread: the CVEs that reach the most images.
  • Compliance: each compliance report with its failing controls, or “not run yet”.

The header shows when the reports were last read. Refresh reads them again now.

Images and CVEs

Images

One row per image digest, sorted by critical findings. Filters: free text (image, registry, OS or namespace), Has critical, and End-of-life OS.

An image

The page shows the registry, OS and digest, a warning when the OS is end of life, and the counts by severity. Clicking a count filters the list below to that severity.

By package is the default. Each row is one installed package with the version to update it to, and how many critical, high and total findings that clears. The version shown is the highest fixed version across the package’s findings, preferring stable releases over release candidates, so updating to it clears every finding in the row. Click a row for the CVEs behind it.

By CVE lists each finding with its package, installed and fixed version, CVSS score and title.

On the right: the workloads that run this image, and any secrets found in it.

CVEs

Every distinct vulnerability in the cluster, sorted by severity and then by how many images it reaches. Filter by severity or by text: id, title, package or namespace. The first 300 rows render, with a button for more.

A CVE’s page shows its severity, CVSS score, publication date, whether a fix exists, a link to the advisory, and every affected image with the package, installed and fixed versions, and the workloads running it.

Workloads

Deployments, StatefulSets, DaemonSets, CronJobs, Jobs and bare Pods, each with the images it runs. Columns: findings in its images by severity, failed configuration checks and secrets found.

Filter by namespace or by text: name, kind or image. The namespace links on the overview open this page filtered to one namespace.

A workload’s vulnerability counts add up its distinct images, so two containers with the same image count once.

Misconfigurations and RBAC

The page has two report types, switched at the top:

  • Workload config: ConfigAuditReport and ClusterConfigAuditReport. Checks such as running as root, a writable root file system, host networking or privileged containers.
  • RBAC: RbacAssessmentReport and ClusterRbacAssessmentReport. Roles and bindings that grant too much, such as managing Secrets or wildcard verbs.

Only failed checks are listed, and resources where everything passes are left out.

By resource lists each resource with its failed checks by severity. Click a row for each check’s message and how to fix it.

By check turns it around: each failed check with how many resources fail it and the fix. Click a row for the list of resources. This is the quicker view when one setting is wrong in many places.

Filter by severity or by text: namespace, name or check.

Infrastructure such as CSI drivers or a CNI often needs host access and fails several checks by design. Those findings are accurate; whether they matter is your call.

Exposed secrets

Secrets the Trivy Operator found in image layers: keys, tokens and private keys baked into an image. Each row shows the severity, what kind of secret it is, the file inside the image, the image and the workload running it.

Gjallarhorn never reads the matched text from the report, so it cannot show it, even partly masked. Open the file in the image to see what was found.

Many findings are example or test files shipped with an application. They still end up in every copy of the image, so check them.

The scanner is controlled by operator.exposedSecretScannerEnabled in the Trivy Operator chart.

Compliance

One section per ClusterComplianceReport, for example the NSA Kubernetes Hardening Guidance or the Pod Security Standards. Each control shows its id, name, severity and how many resources fail it, or “Pass”.

The Trivy Operator produces these reports on a schedule, every six hours by default. Until the first run a report shows “First run pending” with its schedule.

The specs are chosen in the Trivy Operator chart under compliance.specs.

How findings are counted

Images

An image is its registry, repository and digest. When several pods or containers run the same digest, its findings count once. Totals on the overview add up images, not containers.

The Trivy Operator writes a report per container. Gjallarhorn keeps the first report for each digest and drops findings that repeat the same CVE, package, version and file.

Workloads

Reports on a ReplicaSet are shown under the Deployment that owns it, looked up from the ReplicaSet’s owner reference. When a Deployment has old ReplicaSets that are still reported, their images appear under it too.

CVEs

A CVE’s severity is the highest any image reports for it, and its score the highest CVSS score. It is “fixable” when at least one affected package has a fixed version.

Not rated

Trivy reports severity UNKNOWN when the vendor has not rated a CVE yet, which is common for the newest ones, even when a CVSS score already exists. Gjallarhorn calls these “not rated”, counts them, and keeps them out of the bars and the “fix first” ranking, because there can be many of them and they would hide the rated ones.

Fixed versions

Only findings the Trivy Operator reports are counted. With trivy.ignoreUnfixed: true it skips CVEs that have no fix, so every finding shown has a fixed version.

Endpoints

Everything is on one port, 8080 by default.

PathPurpose
/The dashboard. Routes after #/ are handled in the browser.
/healthzLiveness. Answers ok once the server is up, before the first read finishes.
/api/statusWhether a snapshot is ready, whether a read is running, when the last one finished, and the last error.
/api/overviewEverything the overview shows.
/api/images, /api/images/{id}Images, and one image with its findings, workloads and secrets.
/api/cves, /api/cves/{id}CVEs, and one CVE with every affected image.
/api/workloadsWorkloads with their images and counts.
/api/misconfigsFailed configuration and RBAC checks, by resource.
/api/secretsExposed secrets, without the matched text.
/api/complianceCompliance reports and their controls.
POST /api/refreshRead the reports again now.

Until the first read finishes, the data endpoints answer 503 with {"error": "loading reports…"}. Responses are gzip-compressed when the client accepts it.

Permissions

The chart creates a ClusterRole with:

  • get and list on vulnerabilityreports, configauditreports, clusterconfigauditreports, rbacassessmentreports, clusterrbacassessmentreports, exposedsecretreports and clustercompliancereports in aquasecurity.github.io.
  • list on replicasets, to show reports under their Deployment. Without it, they show under the ReplicaSet.

Nothing else: no Secrets, no Pods, and no write access of any kind.

exposedsecretreports contain the matched secret text, partly masked by Trivy. Gjallarhorn’s parser skips that field, so it is never kept in memory or served, but the service account can read it. If that is a concern, remove exposedsecretreports from the role and the Secrets page stays empty.

The dashboard has no login. Anyone who can open the page sees which images are vulnerable. See Install.

Development

(cd web && npm ci && npm run build)
cargo test
cargo run -- --bind 127.0.0.1:18080

With a kubeconfig, Gjallarhorn reads that cluster. --fixtures fixtures/demo.json serves a made-up homelab instead, with no cluster at all. python3 fixtures/generate_demo.py writes a fresh one, with publication dates relative to today.

For frontend work, run the backend on port 18080 and npm run dev in web/; Vite proxies /api to it.

The aggregation is in src/snapshot.rs. build() takes the raw reports and returns the snapshot, without touching the network, and the tests feed it report fixtures shaped like the Trivy Operator’s output. The report shapes are in src/raw.rs; the HTTP server is in src/main.rs.

The frontend is Svelte 5 in web/src, one file per page in web/src/pages. The release binary embeds web/dist, so build the frontend before cargo build --release.