DocsSecurity

On this page

Security model

Kubernanny runs with read access to most of your cluster and a few write verbs. This page says exactly what it can do, what an attacker with each piece could do, and what keeps that small.

What the agent can do#

The complete, generated list of every permission, why it is needed and the Helm value that removes it is PERMISSIONS.md. In short:

  • Reads, cluster-wide: the inventory every run needs (nodes, pods, workloads, events, volumes, ingresses) plus, per module, the resources of the tools it checks. A module in checks.disabled gets no rule at all.
  • Writes, cluster-wide, four in all: patch on Deployments, StatefulSets and DaemonSets (restart: the restartedAt annotation), patch on Argo CD Applications (sync, hard refresh), create of CNPG Backups. Only for an action an open issue offers, on the object that issue names, after a confirmed tap in the app. rbac.allowActions: false removes all of them. One more, off by default: with actions.enabled: [argocd-rollback] a paired device can roll a manual-sync, single-source Argo CD app back to an earlier deployment from its own history, without an open issue (the same patch on Applications, plus a branch of the admission policy rendered only then).
  • Its own namespace: get on its two Secrets by name, patch on the device list, get/patch on the ConfigMap kubernanny-settings, and create of Secrets and ConfigMaps (Kubernetes cannot limit create by name).

What it cannot do in any switch combination (a test enforces it): read Secrets other than its own two, delete anything, exec into pods, change RBAC, create workloads, reach services through the API server proxy. Switches in the app are softer than the Helm values: they stop the agent from using a permission, but the permission stays granted; use the Helm values for anything that must be impossible (PERMISSIONS.md, "Switch -> what is removed").

Network#

  • Inbound: port 8080 (web UI, /healthz, /api/identity and the end-to-end endpoint /api/e2e; every other API route only through the in-pod socket) and 9100 (metrics). Every call is end-to-end encrypted and authenticated (PROTOCOL.md), so plain HTTP in a LAN is fine; still keep 8080 on a VPN or not exposed at all. The chart's ingress never routes /metrics.
  • Outbound: the API server; Prometheus, Alertmanager, Grafana and Loki over cluster DNS (only GET on their read endpoints); your notification endpoints. Only if you switch them on: one WebSocket to the relay (relay.enabled, carries sealed messages only, native push included, RELAY.md) and HTTPS to api.osv.dev or your mirror (vulnerabilities.enabled, package names and versions only, SECURITY-CHECKS.md). With NetworkPolicies, allow exactly these; the chart's policy does. The complete list with ports and how to check it: IN-CLUSTER.md.

Threats#

If someone gets… They can They cannot Mitigation
a device's private key (lost, unlocked phone) read the status, node and workload lists, events, logs of pods that currently have an issue; sync or refresh a broken Argo app; restart a currently broken workload; start a CNPG backup of a cluster whose backup is overdue; create a pairing code and so pair a device of their own; blind and lock out the owner: switch notifications, any module or any action off, silence issues, start a 24 h maintenance window, revoke every other device; switch on a module that is off by default because it sends data out of the cluster (vulnerabilities, image-updates) name any other target, restart healthy workloads, delete, read Secrets, switch on anything the Helm values switched off, do any of the blinding changes unnoticed actions bound to open issues; switching notifications, a module or an action off, switching on a module that sends data out, starting a maintenance window, silencing any warning or outage (and a silenced warning that becomes an outage notifies again), revoking a device and pairing a new one each send one notification through your channels first, naming the device, even with notifications off in the app or during maintenance (only checks.disabled: [notifications] in Helm silences them); every change is in the audit log with the device. On such a message you did not expect: revoke that device from another paired device (settings → Paired devices) or with node dist/cli.js revoke <id>, check the settings, and if it already revoked your devices, rotate everything
a device's private key, with rollbacks enabled (actions.enabled: [argocd-rollback]) roll any manual-sync, single-source Argo CD app back to any of its recent deployed states (the last entries of its status.history, usually 10), whether or not anything is wrong with it: an older release with a known bug or vulnerability is back in the cluster until someone syncs again roll back an app with automated sync or several sources, pick a revision that is not in the app's history, point the app at another repository, path or chart, prune, change sync options, roll the same app back more than once in 5 minutes, do it unnoticed the action is off unless the chart opts in; every rollback sends one notification through your channels first (even with notifications off in the app or during maintenance) and is in the audit log with the device, the app and both revisions; the agent and the admission policy both accept only a revision from the app's own history; a sync in Argo CD (or of the newest commit) undoes it. Leave it off unless you need it, and switch it off in the app when you do not need it right now
the agent's key (Secret kubernanny-identity) answer devices in the agent's place, if they also control the network path; read recorded requests act as a device, read recorded answers only readable with kubectl; rotate by deleting the Secret (all devices pair again)
the device list (Secret kubernanny-devices) public keys and names; FCM tokens of devices with native push anything in the cluster; read a push a token alone sends no text of one's own (that takes the relay's Firebase service account), but anyone can register an agent id on a relay with push and send that token Kubernanny's generic alert ("New status from a cluster"), within the relay's per-token limit (30 an hour) and its other push budgets (RELAY.md); such a push never opens and carries no marker
a device's FCM token (from the device list, a relay's memory) with the Firebase service account of the app's project too: make that phone show a notification with any text, on Android (an FCM notification message, shown by the system) and on iOS (an APNs alert without mutable-content, shown without the extension) read a Kubernanny push or forge one that opens (sealed for the push key, authenticated by the agent key); put the person's marker on their text (it never leaves the phone); trigger any action (a tap at most opens a cluster already in the app) a push without your marker did not come from your cluster (NOTIFICATIONS.md); turn push off for that device, or revoke it; tokens FCM reports as gone are forgotten
a phone's push key (iOS shared keychain item, Android Keystore-protected entry) open pushes for that one cluster, recorded ones included; read the push marker kept next to it act as the device, call the agent a key of its own per cluster, not the device key; turning push off deletes it
the relay's Firebase service account (the relay's operator, or whoever steals it) make every phone whose token it knows show a notification with any text, on Android and on iOS: FCM and APNs offer no way to forbid that, by design open sealed pushes or forge one that opens; show a real cluster's text; add the person's marker; trigger any action the marker on every real push (NOTIFICATIONS.md); keep it in a Secret; RELAY_PUSH=off; a relay of your own with your own Firebase project and app build removes the third party
the pod's log a pairing code: expired after 60 min, single use; the agent's public key a credential none needed
a pairing code pair one device, once, within 60 min; it then shows in the device list, the log and as a notification anything after the code was used revoke the unknown device
a pairing link (anyone can make one: a website, a QR code, a message, another app; kubernanny://pair?… or the web UI's #/pair?…) open the app's pairing page with an address, a relay and an agent key of their choice, for example the address of a cluster already in the app, their own relay and the key of a fake agent pair without a tap; give a cluster already in the app another agent key, relay or device key unless the person explicitly chooses "Replace the key anyway" past a warning; reach the pairing page through a push the pairing page connects only after a tap and shows name, address, relay and the agent key's fingerprint first, the same one the agent's log prints (Agent key: …): compare them. An entry with that address or name and another key is refused by default, with both fingerprints shown. Replacing removes the old push registration and the old device at the old agent (best effort)
the agent's public key (a pairing link, a QR code) send pairing attempts, directly or through the relay: wrong ones get 429 PAIRING_RATE_LIMITED past 5 per 10 minutes, and all strangers together share a small budget (about 7200 attempts an hour at most) guess a code (31^10 codes, under 10^-11 per code's hour), burn the code, keep the owner from pairing (the right code is compared before any throttle), use up a paired device's budget none needed
the network path (Wi-Fi, ingress, proxy, relay) see sizes and timing; drop calls read, change or replay calls; pose as the agent end-to-end encryption with a pinned agent key
Google or Apple (FCM, APNs) that a phone gets Kubernanny pushes, when and how large; drop them read them (sealed with HPKE for the phone's push key) notifications.appPush.enabled: false, or simply do not switch push on
the pod (RCE in the agent) everything the ServiceAccount can read (above), the agent key, the device list; restart any Deployment, StatefulSet or DaemonSet, start a plain sync or a refresh of any Argo CD Application (with actions.enabled: [argocd-rollback] also a sync of any manual-sync, single-source app to a revision from its history), create a plain CNPG Backup (the action permissions are cluster-wide, not bound to open issues once the agent's own code is bypassed). Without the admission policy (Kubernetes before 1.30, or rbac.admissionPolicy.enabled: false): also change anything else on those objects with the same patch, such as images, service accounts, host settings or an Application's source, which amounts to running code in other namespaces read other Secrets, delete, create workloads, escalate via RBAC; with the admission policy: change any field of a workload but the restart annotation, or an Application but operation and the refresh annotation non-root (user and group 1000), read-only root FS, no capabilities, seccomp; the chart's ValidatingAdmissionPolicy (on by default whenever a write action is enabled, Kubernetes 1.30+) denies the ServiceAccount everything beyond what the actions change (PERMISSIONS.md); rbac.allowActions: false for read-only
any pod in the cluster (an in-cluster HTTP service the agent reads: Prometheus, Alertmanager, Grafana, Loki, Gatus, Uptime Kuma, or a pod answering in their place) show wrong findings in the app and in notifications: made-up issues, stats, alert names crash the agent or blank the app (every answer is type-checked, cut to a length and to 50 issues per module; a run that fails is logged, never fatal), offer actions (such modules never carry one), mention people in a chat (Slack and Discord bodies are escaped, Discord with allowed_mentions off) checks.disabled for the module; networkPolicy.egress limits what the agent reaches
unauthenticated network access to the agent (in the cluster, or through the ingress or the relay) spend the handshake budget of its own source address, of all strangers together, or of its path (direct or relay) lock out paired devices: direct and relayed calls have separate ceilings, every direct source address has its own bucket, and a share of the direct ceiling stays reserved for addresses that recently made an authenticated call. Behind an ingress all direct calls share the controller's address; the relay path then stays usable the relay's own per-agent limits; a NetworkPolicy on port 8080
the metrics port the score, issue counts, module status issue texts, names, logs not on the ingress; NetworkPolicy
the phone's storage (app preferences: UserDefaults / SharedPreferences, localStorage on the web) the cluster list: names, addresses, pinned agent keys, the relay; with push on, the FCM token it registered (see the FCM token row) the device keys (Keychain / Keystore, bound to this device), the push keys and the marker (see above): so no call to an agent, no push opened revoke the device if the phone itself is lost
the widget storage (App Group / SharedPreferences, see Home-screen widgets) per cluster: its name in the app, light, number of outages and warnings, time of the last check addresses, keys, issue texts, call an agent switch the widget off per cluster or for all; the home screen shows the same anyway
the browser profile (web UI) the device keys of the clusters paired in that browser revoke the device; prefer the app on shared computers

Keys. Device and agent keys are X25519; every call is a Noise IK handshake (Noise_IK_25519_ChaChaPoly_BLAKE2b) on audited primitives (@noble/*), checked against libsodium's implementation and published test vectors. Pairing codes are compared in constant time.

Content Security Policy. No inline script and no eval run anywhere the app's code runs: the agent sends a CSP header with its web UI (agent/src/security/http-security.ts); the native apps' WebView, where no server sets one, gets a <meta> policy from app/src/index.html, whose connect-src allows https: and http: because the app talks to whatever agent address was paired (every such call is end-to-end encrypted with the pinned key); the demo host gets its headers from app/src/demo-host/_headers; the website allows only the hashes of the inline scripts its prerendering writes. Links an agent sends (component links, ingress hosts, the web pairing address) open only if they are http(s). On Android, Capacitor adds its bridge as a document-start script where the WebView supports that and falls back to an inline script on older WebViews, which this policy blocks; the app then needs a current Android System WebView.

No HSTS from the agent. The agent speaks plain HTTP on port 8080 and never terminates TLS; it used to send Strict-Transport-Security when a request carried X-Forwarded-Proto: https, a header any caller can write. HSTS belongs on whatever terminates TLS: set it on the ingress (for ingress-nginx nginx.ingress.kubernetes.io/hsts, which is on by default with TLS).

Every channel (app, pairing, Kubernetes API, monitoring, notifications, metrics, logs) with its protection and residual risks: COMMUNICATION.md.

Logs of pods with an issue are readable by every paired device. They can contain secrets your application logs. rbac.allowActions: false does not change that (reading a log is no write). If it matters, restrict who may use the app, or set actions.disabled: [logs]: the chart then grants no pods/log and the logs route answers 403.

Home-screen widgets#

The iOS and Android apps can show each cluster's light on a home-screen widget (ARCHITECTURE.md, Widgets). The widget never calls an agent and holds no key. What the app stores for it on the device, per cluster, and nothing else:

Field Example
the app's id for the cluster (for the tap that opens it) a random UUID, or demo-broken
the name you gave the cluster in the app (at most 64 characters) homelab
the traffic light red
the number of open outages and warnings (silenced issues and hints not counted) 3, 19
when the agent last checked 2026-11-25T10:42:00Z
whether it is a built-in demo cluster false

No address, no agent or device key, no issue text, no component or node name. Where: iOS, the App Group group.app.kubernanny (UserDefaults, readable by the app and its widget extension only); Android, the app's private SharedPreferences file kubernanny_widget (Android backups are off for the whole app). Anyone who can see the phone's home screen sees what the widget shows; iOS StandBy (iOS 17 and later, while charging) can show it on a locked phone too.

Turning it off. Per cluster: cluster settings → "Show this cluster on the home-screen widget". For all clusters: cluster list → "Home-screen widgets: Off". Either removes the entries from the device's widget storage at once (before the switch returns), and the app writes nothing more for them until switched on again. Removing a cluster from the app removes its entry too. The web UI has no widgets and stores nothing for them.

Revoking a device#

In the app: cluster settings → Paired devices → Remove. Any paired device can revoke any other, including itself. Or in the pod:

sh
kubectl -n kubernanny exec deploy/kubernanny -- node dist/cli.js devices
kubectl -n kubernanny exec deploy/kubernanny -- node dist/cli.js revoke <id>

The key is dead on the next call.

Rotating everything#

sh
kubectl -n kubernanny delete secret kubernanny-identity kubernanny-devices
kubectl -n kubernanny rollout restart deploy/kubernanny
kubectl -n kubernanny logs deploy/kubernanny    # new key, new pairing code

All devices must pair again; the app reports the old agent key as no longer answering.

Supply chain#

One image, built by GitHub Actions from this repository (Dockerfile, multi-arch). Runtime dependencies (bundled into one file with esbuild, no node_modules in the image): ws (the relay connection), qrcode, and @noble/curves, @noble/ciphers, @noble/hashes (audited, pure JavaScript, pinned to exact versions) through the shared protocol/ package. The web UI is built in the same pipeline and copied into the image; it loads no third-party resources at runtime (fonts are bundled).

Every published image carries a build provenance attestation and an SBOM, and is signed keyless with Sigstore by the workflow itself (no long-lived key exists). Verify before you deploy:

sh
cosign verify ghcr.io/kubernanny/agent:<version> \
  --certificate-identity-regexp '^https://github\.com/kubernanny/kubernanny/\.github/workflows/ci\.yml@refs/(tags/v.*|heads/main)$' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com
docker buildx imagetools inspect ghcr.io/kubernanny/agent:<version> --format '{{ json .SBOM }}'

The identity is the workflow file and the ref it ran for: …/ci.yml@refs/tags/v1.2.3 for a release, …/ci.yml@refs/heads/main for edge; nothing else in the repository can sign. The workflows run with read-only permissions except the jobs that publish, pin every third-party action by commit, check the kubeconform download against its checksum, and the image starts from a base pinned by digest, without npm or other package managers in the final stage.

The Helm chart in oci://ghcr.io/kubernanny/charts/kubernanny is signed the same way. CI also renders the chart with the switches (checks.disabled, actions.disabled, rbac.allowActions) and fails if a switched-off permission is still granted.

Reporting a vulnerability#

Please do not open a public issue. Use GitHub's private vulnerability reporting on this repository ("Security" tab → "Report a vulnerability"). You will get an answer within a week.