How codemowers/agent confines workers, where credentials go and what the
cluster administrator must enforce. The README covers
installation.
All kinds are in the codemowers.ai/v1alpha1 API group. Namespace
administrators are humans: no automation gets RBAC to create or change Agents,
and workers never read or write these resources through the Kubernetes API.
| Kind | Scope | Administered by | Read by | Changed by |
|---|---|---|---|---|
| Agent | Namespaced | Namespace administrators | Operator; dashboard users allowed on the Agent | Administrators; operator writes status |
| Task | Namespaced | Namespace administrators; the operator creates event and dashboard Tasks | Operator; dashboard users allowed on its Agent | Administrators; operator on behalf of users, events and the worker's MCP calls |
| WebhookBinding | Namespaced | Namespace administrators | Webhook receiver | Administrators |
| WebhookReceiver | Namespaced | Namespace administrators | Webhook receiver | Administrators |
| ClusterWebhookReceiver | Cluster | Cluster administrators | Webhook receiver | Cluster administrators |
| WebhookProtocol | Cluster | Cluster administrators | Webhook receiver | Cluster administrators |
| TaskPolicy | Namespaced | Namespace administrators | Operator | Administrators |
| Mailbox | Namespaced | Namespace administrators | Operator | Administrators; operator writes the IMAP cursor |
| MailBinding | Namespaced | Namespace administrators | Operator | Administrators |
| Device | Namespaced | Namespace administrators | Device bridge | Administrators; bridge writes connection status |
| Feed | Namespaced | Namespace administrators | Feed crawler | Administrators; crawler writes crawl state and recent items |
| FeedBinding | Namespaced | Namespace administrators | Feed crawler | Administrators |
| ClusterMCPServer | Cluster | Cluster administrators; the chart for built-in servers | Operator | Cluster administrators |
| MCPServer | Namespaced | Namespace administrators | Operator | Administrators |
- Agent: a worker definition with CLI and model, Pod template, workspace volume claims, Git providers, idle timeout, coalescing window and extra MCP servers.
- Task: one objective with its own PVC, conversation, routing keys such as an issue URL, and external references.
- WebhookProtocol: a sender's signature format, CEL extraction, allowed key prefixes and HTTP response.
- WebhookReceiver (
/hooks/<namespace>/<name>) and ClusterWebhookReceiver (/hooks/<name>): an endpoint holding the sender's secret, token or key, and optional address limits. - WebhookBinding: subscribes one Agent to a receiver for key prefixes such
as
https://github.com/codemowers, with a fallback Task. A cluster receiver fans each event out to every matching binding. - TaskPolicy: when an event whose key no Task claims may create a Task.
- Mailbox: a Pod holding one account's IMAP and SMTP credentials. MailBinding wakes one Agent's Tasks for matching mail headers.
- Device: a remote machine and its connection key.
- Feed: a public feed the crawler polls; FeedBinding wakes a Task of its namespace with the feed's new items.
- ClusterMCPServer and MCPServer: an MCP server advertised to workers.
A worker token's audience is the server's
audience, else its Service,<service>.<namespace>, derived from an in-cluster URL. A server withcredential: truegets the worker'sMCP_<NAME>_TOKENkey of its Agent's credential Secret instead.
Dashboard users listed in an Agent's spec.access may do everything with its
Tasks. Without that list, verbs on the Agent decide: get reads Tasks and
conversations, prompt creates, prompts, stops and configures them, and
suspend suspends and resumes the Agent and its Tasks, so observers can
follow an Agent without steering it. Deleting a Task takes delete on it.
Workers get a Mailbox, Device or MCP server, and callers wake a Task, through
custom RBAC verbs on that object. Mailbox and Device verbs are checked by
their MCP server on every call; use is checked when the operator builds a
worker Pod. Standard verbs such as get grant none of them, but wildcard
grants such as cluster-admin include them all.
| Kind | Verb | Allows |
|---|---|---|
| Mailbox | send |
Sending mail |
| Mailbox | read |
Listing folders and messages, reading messages |
| Device | exec |
device_shell |
| Device | read |
device_file_read |
| Device | write |
device_file_write, which usually allows code execution too |
| ClusterMCPServer, MCPServer | use |
The server's endpoint and a token for its audience, or its credential key, in the worker |
| Task | wake |
Waking the Task through the operator's wake endpoint |
Tools that reach sensitive data must authorize each call themselves. An MCP server that answers every caller with its own credentials is a confused deputy: a Prometheus MCP accepts any PromQL, and Prometheus sees every namespace. An authentication layer bolted on in front, whether a token check, a proxy such as kube-rbac-proxy or per-tool policies, decides who connects but not what the arguments reach, so it does not make such a server safe. Generic authless servers that proxy sensitive data are therefore of little use here.
ClusterMCPServer and MCPServer advertise three kinds of server:
- Kubernetes-native: the server checks the worker's ServiceAccount token with TokenReview and authorizes each call with SubjectAccessReview on the exact object, as the Device bridge, Mailboxes and Driftmower do.
- Credentialed external: a service such as Linear that authorizes each
call against the worker's
MCP_<NAME>_TOKENkey. The worker can read the key, as it can its Git provider keys, so scope it to what that Agent may do. - Authless with nothing sensitive: public advisory content such as the Codemowers MCP, or a tool whose reach any worker may have anyway.
Granting use asserts that the server can do no more for the grantee than
the grantee could alone; the operator cannot check it. Gateways that layer
policy over existing servers, such as
ToolHive, do not change this.
| Identity | Permissions |
|---|---|
agent-operator |
Reads Agents, Mailboxes, MCP servers and policies; manages Tasks, worker Pods, PVCs and Mailbox Services; writes Agent, Task and Mailbox status; gets the credential Secrets listed in operator.credentialSecretNames by name; creates TokenReviews and SubjectAccessReviews. |
agent-operator-webhook |
Reads protocols, receivers, bindings and the Secret each receiver names; creates TokenReviews for ServiceAccount-token senders. |
agent-devices |
Reads Devices and the Secrets named in deviceBridge.secretNames; writes Device status; creates TokenReviews and SubjectAccessReviews. |
agent-mailbox |
Creates TokenReviews and SubjectAccessReviews. Only the Mailbox Pod's MCP container gets its token. |
agent-builder |
Creates TokenReviews; gets Pods, Tasks and Agents; manages Pods, pods/exec and Secrets in the builds namespace; impersonates and mints tokens for ServiceAccounts in builder.agentNamespaces, acting only for the authenticated worker's own. Holds the zot cache credential. |
agent-feeds |
Reads Feeds and FeedBindings, writes Feed status, holds wake on Tasks cluster-wide and creates TokenReviews. FeedBindings decide which Tasks it wakes. |
agent-worker-<agent> |
Whatever the namespace administrator grants; examples/ has three profiles. |
Credentials live in namespaced Secrets, and resources select individual keys, so no component mounts a whole Secret. Keep the values out of manifests, images, chat and shell history.
| Secret | Holds | Selected by |
|---|---|---|
An Agent's credentialSecretRef, conventionally <name>-credentials |
Model API keys, Git provider tokens, MCP server tokens and tool credentials, under fixed key names | The Agent; credentialKeyRef selects another key of it |
Any, conventionally agent-operator-webhook-keys |
Webhook signing keys | senders.secretKeyRef in a receiver |
A name allowed by deviceBridge.secretNames |
Device connection keys | connectionSecretRef in a Device |
| Any | Mailbox IMAP and SMTP credentials | credentialsSecretRef in a Mailbox |
A worker without its model key fails instead of switching provider. A forge webhook signing key only authenticates deliveries; it is not an API token.
| Credential | Operator | Worker |
|---|---|---|
| Model API keys | Reads the key to discover models, if operator.credentialSecretNames lists the Secret |
Every key of its Agent's credential Secret, as environment variables |
| Git provider tokens | Reads them to check repositories and assignment, likewise | The same; gh, tea and Git configuration in a memory-backed volume |
| Registry push credential | Build service mints a one-hour token for the calling Agent's ServiceAccount, bound to the worker Pod, into a per-build Secret in the builds namespace | Never; Kaniko Pods in the builds namespace mount it |
| Webhook signing keys | Not held; the webhook receiver reads them | Never |
| Mailbox IMAP and SMTP | Not held | Never; mail goes through the Mailbox MCP server |
| Device keys | Not held; the Device bridge reads them | Never; commands go through the Devices MCP server |
| Kubernetes API token | Operator identity; the build service impersonates the calling Agent's ServiceAccount to deploy | The Agent ServiceAccount, projected into the worker; its RBAC is the boundary |
| MCP tokens | Verifies Agent MCP tokens | A projected, audience-bound token per server |
| OIDC | Verifies user access tokens | Never |
Agents can each have their own namespace, share one in groups, or all live in the harness namespace.
- A namespace per Agent separates Secrets, reads and network policy with plain RBAC, at the cost of more namespaces and per-namespace setup.
- Several Agents per namespace, grouped by trust level, shares that setup between Agents that may see each other's workloads.
- One namespace for all Agents is simplest. It relies on the
resourcePrefixadmission policy below, and every worker can still read the namespace's Pods, logs and ConfigMaps.
Use ValidatingAdmissionPolicy and MutatingAdmissionPolicy, both stable in Kubernetes 1.36, to enforce for worker, Kaniko and development Pods alike:
hostUsers: falseor a supported Kata Containers runtime. Kata adds a VM and guest kernel, but does not change API authorization or hide credentials delivered into the guest.- No privileged containers, host namespaces or host paths.
- For Agents sharing a namespace,
resourcePrefix: theagent-resource-prefixpolicy takes the namespace's Agents as parameters and confines each worker's writes, Pod ServiceAccounts, Secret references and PVC mounts to resources named with its prefix. - For Agents sharing a namespace, the Agents themselves: an Agent's
credentialSecretRefand every Secret reference and ServiceAccount in its Pod template must start with<name>-. The operator, not the Agent's author, creates the worker Pod, so without this rule anyone who may write an Agent can point it at another Agent's Secret. Agent names cannot contain dashes, so prefixes never overlap; bind each name to its owner, for example through its immutablecodemowers.io/created-byannotation, so a user cannot create an Agent named after another user's prefix.
Confine external credentials first, for example with a dedicated GitHub account
whose permissions and branch protection forbid pushing to main. A stolen
token can still be used within those grants. Known gaps:
- Labels and selectors are not confined. A worker can label its Pods into another Service, or point a NetworkPolicy, Ingress or autoscaler at harness workloads.
- Reads are namespace-wide. Admission does not see reads, so a developer worker can read every Pod spec, log and ConfigMap in its namespace.
- Tasks of one Agent share an identity. A worker's ServiceAccount, build identity and operator MCP tools reach every other Task of its Agent.
- Agents may share Git credentials. Separate review rights need a separate forge identity per Agent.
- Delivered credentials leave with the code. Malicious code can copy model keys, forge tokens or the registry push credential and use them elsewhere within their grants.
Three Agents separated by trust level, in any of the namespace layouts above. examples/ implements it.
| Boundary | Kube admin | Developer | Customer service |
|---|---|---|---|
| Kubernetes access | Cluster-admin | Cluster-wide operational reads; build and deploy in its namespace | No ServiceAccount token |
| GitHub access | Read reviewed main |
Pull, push topic branches, manage issues, open PRs | Issues in selected support repositories |
| Model | Local model through LiteLLM | Claude or a local model | A cheaper Claude model or a local model |
| People reach it through | Dashboard, limited to DevOps by OIDC group | GitHub issues and PR reviews | Email, GitHub issues, Slack |
| Events | Critical alerts | GitHub events, critical and warning alerts | GitHub issue events, external webhooks |
| Main risk | Sensitive-data disclosure | Supply-chain attack and privilege escalation | Prompt injection |
The developer pushes topic branches; branch protection requires human review
and reserves merging for humans, with no bypass for agents. The admin reads the
reviewed branch with a read-only token. GitHub read tokens cannot be limited to
one branch, so enforcing main-only reads takes a branch-only mirror.
Kube admin can read every namespace's Secrets, configuration and logs and change permissions, so trust it accordingly. A local model keeps prompts away from a hosted provider but does not stop leaks through other channels, and PR review does not gate its direct API writes.
Developer runs repository code, dependencies and build scripts, starts Kaniko Pods, pushes development images and deploys them. Its cluster-wide reads exclude Secrets, and its writes stay in its namespace, under its prefix when the namespace is shared. The admission policies above limit host compromise; restrict its ServiceAccounts, Secret references and registry ACLs to contain credential theft, image poisoning and API escalation.
Customer service reads email, tickets, webhook payloads and Slack messages written by outsiders. An authenticated source does not make that text trusted, so this worker has no Kubernetes access, source-code writes or administrative credentials, and issues it files for the developer remain untrusted input. Isolation limits what a fooled model can do, but not misuse of its permitted mail and issue actions or disclosure of customer data it can read.
Mailbox Pods and the webhook receiver hold the mail and webhook credentials and authenticate events; payloads cannot choose namespaces or grant permissions. The customer-service worker gets issue and model credentials and its Agent MCP token, with no Kubernetes or Driftmower token. The developer uses separate GitHub credentials and gets no mail credentials. Separate namespaces keep these workers from mounting each other's Secrets, but cannot constrain a cluster-admin Agent.