Skip to main content

Security model

This page is for security reviewers and cluster admins. It describes what DebugHero can access, what it sends to DebugHero, and the risks that are known today.

Summary​

AreaFact
Cluster permissionsDebugHero uses your kubeconfig. It cannot do more than your RBAC permissions allow.
Debug containerRuns as root with SYS_PTRACE. It has full control of the target process while it runs.
Network in the podDelve listens without authentication on all interfaces of the pod. The debug server accepts only the access token of the session owner.
Your machinedebugd listens on 127.0.0.1:58090 only (DEBUG_DAEMON_ADDR changes the address). Port-forwards also listen on localhost only.
Data sent to DebugHeroAccount and usage events. No cluster data, no source code, no process data.

Cluster permissions​

debugd calls the Kubernetes API with the credentials from your kubeconfig. DebugHero does not install anything in the cluster, and it has no credentials of its own.

The permissions that DebugHero needs (pods/ephemeralcontainers, pods/portforward) give the same access with kubectl debug and kubectl port-forward. DebugHero does not add new access. Control who can debug with RBAC. See Permissions.

The debug container​

The debug container runs as root with the SYS_PTRACE capability, and it shares the process namespace of the target container. While it runs, it can:

  • read and change the memory of the target process, including secrets in memory,
  • read the environment variables of the process,
  • read the files of the target container through /proc/<pid>/root,
  • stop the process, change variables, and call functions through Delve.

Treat a debug session like root shell access to the target container.

The debug container stops after 1 hour. The stopped container stays in the pod spec until the pod is replaced.

Network exposure in the pod​

danger

Delve listens on :<port> (a port from 40000 to 40999) and the debug server listens on :45001. Both listen on all interfaces of the pod network namespace. Delve has no authentication. The debug server accepts only the access token of the session owner (from image 0.0.8). While the debug container runs, every client that can reach the IP address of the pod can connect to Delve and control your process.

debugd itself does not need these ports on the pod IP. It reaches them through kubectl port-forward, which goes through the kubelet into the pod network namespace.

Mitigation: use a NetworkPolicy that allows ingress to the target pods only on the ports of your application. Port-forwards from debugd still work, because they do not use the pod network. Your network plugin must enforce NetworkPolicies.

Allow only the application port
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: checkout-ingress
namespace: payments
spec:
podSelector:
matchLabels:
app: checkout
policyTypes: ["Ingress"]
ingress:
- ports:
- port: 8080
protocol: TCP

An authenticated connection to Delve is planned.

Your machine​

ItemExposure
debugd API, port 58090Listens on all network interfaces. The routes under /v1/debug/ need a valid access token. The login routes under /v1/auth/ and /health/check do not. A change to listen on localhost only is planned. Until then, do not run debugd on untrusted networks, or block port 58090 with your firewall.
Port-forwards to Delve and the debug serverlocalhost only. Any local process can connect to them.
debugctl credentialsOS keychain (service debughero-cli).
VS Code extension credentialsVS Code Secret Storage.
GoLand plugin credentialsGoLand password safe.
Logs~/.debughero/logs. Bearer tokens and JWTs are redacted.

Authentication​

  • You log in through your browser with OAuth 2.0 and PKCE. The identity provider is Frontegg.
  • debugd receives an access token (a JWT signed with RS256) and a refresh token. Access tokens are short-lived. The clients use the refresh token to get new ones.
  • debugd checks the signature and the expiry of the access token against the public keys of the identity provider.
  • debugctl logout and the IDE logout delete the stored tokens on your machine. They do not revoke the tokens at the identity provider. A copied token stays valid until it expires.

Data sent to DebugHero​

RecipientWhenData
Identity provider (Frontegg)Login, token refreshYour login, through the browser. The refresh token.
DebugHero sessions APISession startYour user ID, to check the session limits of your plan.
DebugHero sessions APISession readyYour user ID, to count the session.
DebugHero events APILogin, logout, and each session start, ready, rejection and failureThe event name, the local session number, your user ID, and for failures a reason category such as oom_killed or dlv_failed.

Each request also contains the version of debugd (User-Agent) and, when you are logged in, your access token. The login attempt event is sent before you log in, so it has no user ID and no token.

DebugHero does not send: cluster names or addresses, kubeconfig contents, namespaces, pod or container names, labels, source code, process memory, or Delve data. The Delve connection goes only between the cluster and your machine.

Known risks​

RiskStatus
Delve has no authentication on the pod networkUse a NetworkPolicy. A fix is planned.
If the debug container is killed (for example, OOM), Delve cannot remove its breakpointsThe process can crash at a breakpoint. Stop sessions when you are done, and restart the pod after such a failure.
Logout does not revoke tokensTokens expire. Revocation is planned.