Repository navigation
fix(k8s): gateways and commonly-bot mount no service account token - #4176
Merged
Merged
Conversation
Both run as agent-provisioner, an account that can read and write every Secret in its namespace and exec into pods. Neither calls the Kubernetes API: a gateway runs agent turns, and commonly-bot calls LiteLLM and the Commonly API. So both now set automountServiceAccountToken: false. The account carries no cloud identity, so the token was its only reach. A chart check (scripts/verify-service-account-tokens-chart.js, in chart-lint) fails if any workload other than backend, backend-worker and ops-runner runs as agent-provisioner with a token. A backend test covers the gateway pods the provisioner creates at runtime. F533. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4VWLGaqG2kVEDDn4hY3nm
…pts Deployments only Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4VWLGaqG2kVEDDn4hY3nm
lilyshen0722
commented
Nov 15, 2026
lilyshen0722
left a comment
Contributor
Author
There was a problem hiding this comment.
This is the one review for this change (D218, Tier 2: access rights): an Opus subagent, read-only, at dbb413f. It found nothing Major. Its Minors on the verifier are fixed at 46b7a27.
Lanes covered: k8s chart, backend provisioner, CI workflow (chart-lint step and path filter).
Checked and true:
- commonly-bot (
external/commonly-agent-services/commonly-bot/index.js:1-4,../shared, Dockerfile): no Kubernetes client, kubectl,/var/run/secretsor sidecar.fsonly reads the config file. - Gateway: the openclaw source (
src/,extensions/) has no Kubernetes use. The backend's exec into a gateway uses the backend's own kubeconfig (agentProvisionerServiceK8s.ts:232). - No cloud identity: read-only,
agent-provisionercarries only Helm annotations on dev and staging. - Live pods on the account: backend, backend-worker, ops-runner and commonly-bot. No gateway pods. The allowlist is right for today.
- The verifier: it flags
Deployment/commonly-botin all 3 lanes on main's template and passes here (12 renders = 4 workloads × 3 lanes). It covers Job and CronJob, theserviceAccountfallback, and the account-level setting, with the pod-level setting winning. - CI: the filter regex matches, and
chart-linthas node,npm ciand helm like the other verify-*.js steps. - Gateway test: it drives the real
provisionGateway, create (404 then create) and replace (read then replace), and passes 2 of 2. - Roll safety: neither image uses the default token. No infra identifiers in the diff.
buildAgentDeploymentManifest(agentProvisionerServiceK8s.ts:2867) is not exported and has no callers, so it's dead and goes to the dead-code sweep.
Minors, with what was done:
- The account name was hard-coded. It's now read from
values.yaml(rbac.serviceAccount.name), tolerating Helm's duplicate keys. Fixed at 46b7a27. - The exemption matched by name for any kind. It's now
Deployment/<name>only. Fixed at 46b7a27. - An existing gateway picks up the setting on its next re-provision. None are live, so this has no effect today.
ops-runneris an exec target, and nothing found uses Kubernetes from inside it. Filed as F539, not changed here.
Nits: the success line's wording is fixed. A bare Pod or ReplicaSet isn't checked, and the chart renders neither.
GATE: PASS
This was referenced Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@coderabbitai ignore
Agent gateways the backend provisions, and the chart's
commonly-bot, no longer mount the provisioner's service account token (F533).Why
Both run as
agent-provisioner. Its Role (templates/agent-provisioning/rbac.yaml) covers the Secrets, Deployments, Services, ConfigMaps and PVCs in the namespace, and pod exec. Neither workload calls the Kubernetes API:commonly-botcalls LiteLLM and the Commonly API.A token neither one uses is reach that a compromised process would get for free. The account carries no cloud identity (checked read-only on dev and staging: only Helm's own annotations), so the mounted token was its only reach.
What changes
backend/services/gatewayProvisionerServiceK8s.ts: the gateway pod spec setsautomountServiceAccountToken: false, on both the create and replace paths.k8s/helm/commonly/templates/agents/commonly-bot-deployment.yaml: the same setting.scripts/verify-service-account-tokens-chart.js, wired intochart-lintand its path filter:backend,backend-workerandops-runnerDeployments runs as the provisioner account with a token.serviceAccountspelling, and an account-level setting.backend/__tests__/unit/services/gatewayProvisionerServiceK8s.serviceAccount.test.js: drives the realprovisionGatewaythrough create and replace.Proof
Deployment/commonly-botin all three lanes, and both gateway tests failed.commonly-botand its shared code have no Kubernetes client, kubectl or/var/run/secrets, and neither does the openclaw gateway source.Rollout
commonly-botrestarts once on the next deploy, which rides Tuesday's roll. No gateway runs today, so the gateway change takes effect at the next provision.Filed separately:
ops-runnerprobably needs no token either (F539).buildAgentDeploymentManifestinagentProvisionerServiceK8s.tsuses the same account but has no callers, so it goes to the dead-code sweep.Tier 2, with one review (Opus) below. It touches
.github/, so it's a hand press.🤖 Generated with Claude Code
https://claude.ai/code/session_01N4VWLGaqG2kVEDDn4hY3nm