Skip to content

Management-cluster profile: Substrate and the install hooks read Secrets only where granted #1269

Closed

Description

@fiunchinho

Context

The Agent Platform's organizations run on Giant Swarm management clusters beside Cluster API, Flux and the workload clusters' credentials (epic giantswarm/giantswarm#38891). The plan's management-cluster profile names one blocker before any management-cluster rollout: Substrate's controller and its Kubernetes credential provider hold get on every Secret in the cluster, which includes every workload cluster's admin kubeconfig, while each reads only a few.

What to build

  • Substrate's controller reads one Secret in its own namespace: a namespaced Role on that Secret replaces its ClusterRole. The ClusterRole comes from a kubebuilder marker in Substrate, so this is an upstream pull request first; until a re-pin carries it, the Giant Swarm fork narrows it, with a ledger row and a dated exit.
  • Substrate's credential provider reads credentials in the namespaces actors run in and checks the grant in its own process: its ClusterRole loses secrets; agent-platform-operator binds its role by RoleBinding in each organization namespace and the chart binds it in the platform namespace. An upstream issue asks Substrate for Secret access scoped by namespace; the fork narrows it until then.
  • The connectivity chart's install hooks' ClusterRole on Secrets is narrowed to the namespaces and resourceNames the hooks write.
  • The management cluster's audit policy records writes by the Agent Platform's components and by people in organization namespaces: an addition requested from the team that owns it, linked from this issue.

Acceptance criteria

  • Substrate's controller is refused a Secret other than its own; the credential provider is refused a Secret outside the organization namespaces and the platform namespace; both proven in agentlab's management-cluster profile tests.
  • The install hooks are refused a Secret they do not write.
  • The upstream pull request and issue are filed and linked; the fork carries a ledger row with the exit for each narrowing.
  • The audit policy request is filed and linked.
  • This lands before the first management-cluster migration.

Activity

  1. moved this to Backlog 📦 in Roadmapon Nov 4, 2026
  2. QuentinBisson commented on Nov 5, 2026

    @QuentinBisson
    Contributor

    Progress on the Secret narrowing.

    Merged:

    graveler (agent-platform 4.175.0-rc.20, Substrate 1.18.0, Google plugin 0.3.0), SubjectAccessReview for get secrets:

    ServiceAccount (ate-system) org-agent-platform-test-a org-agent-platform-test-b kagent ate-system
    k8s-credential-provider denied denied allowed (RoleBinding k8s-credential-provider-secret-reader/kagent) denied
    google-access-token-credential-provider denied denied allowed (RoleBinding google-access-token-credential-provider-secret-reader/kagent) denied
    ate-controller denied denied denied egress-mitm-ca-pool only (Role ate-controller)

    gazelle is still on 4.174.3 / Substrate 1.17.5, where all three are allowed in every namespace through ClusterRoleBindings. It changes when 4.175.0 is released as stable.

    Left:

    • 4.175.0 stable on gazelle, then the same check there.
    • The agentlab management-cluster proof (ate-controller, both providers with one agent fetching its credential in an organization namespace, and the install hooks refused a Secret they do not write).
    • The audit policy request (not filed yet).
    • Other cluster-wide Secret readers, to be filed separately: the kagent controller, the agentgateway controller, mcp-kubernetes (clusterWideSecrets).
  3. QuentinBisson commented on Nov 5, 2026

    @QuentinBisson
    Contributor

    Acceptance proof in agentlab: agent-platform 4.175.0-rc.20 (Substrate 1.18.0, Google access-token plugin 0.3.0), agentPlatformOrganizations.enabled, agentlab built from giantswarm/agentlab#1153. AgentPlatformOrganizations default (agents-default-5s7rp) and acme (agents-acme-dpzn5) Ready, plus a dummy org-acme/acme-kubeconfig Secret.

    The operator bound both providers' readers in each organization namespace as soon as the organization was created:

    agents-acme-dpzn5/k8s-credential-provider-secret-reader                  -> ClusterRole/k8s-credential-provider-secret-reader
    agents-acme-dpzn5/google-access-token-credential-provider-secret-reader  -> ClusterRole/google-access-token-credential-provider-secret-reader
    kagent/...-secret-reader (both, from the chart)
    ate-system/ate-controller -> Role/ate-controller (secrets: get,list,watch on egress-mitm-ca-pool only)
    

    No ClusterRoleBinding gives any of them Secrets.

    Real reads, as each ServiceAccount (kubectl create token <sa>, then kubectl --token with a kubeconfig that carries no client certificate; auth whoami returns system:serviceaccount:ate-system:<sa>):

    k8s-credential-provider                  get secret org-acme/acme-kubeconfig                          -> Forbidden
    k8s-credential-provider                  get secret kagent/kagent-anthropic                           -> secret/kagent-anthropic
    k8s-credential-provider                  get secret agents-default-5s7rp/tenant-credential-anthropic  -> secret/tenant-credential-anthropic
    google-access-token-credential-provider  get secret org-acme/acme-kubeconfig                          -> Forbidden
    google-access-token-credential-provider  get secret kagent/kagent-anthropic                           -> secret/kagent-anthropic
    google-access-token-credential-provider  get secret agents-default-5s7rp/tenant-credential-anthropic  -> secret/tenant-credential-anthropic
    ate-controller                           get secret org-acme/acme-kubeconfig                          -> Forbidden
    ate-controller                           get secret kagent/kagent-anthropic                           -> Forbidden
    ate-controller                           get secret agents-default-5s7rp/tenant-credential-anthropic  -> Forbidden
    ate-controller                           get secret ate-system/egress-mitm-ca-pool                    -> secret/egress-mitm-ca-pool
    all three                                list secrets -A                                              -> Forbidden (cluster scope)
    

    An agent in an organization namespace fetches its credential. agentlab organizations-test: alice (editor of organization agentlab-a) and bob (editor of agentlab-b) each create an agent in their own organization as themselves and run a turn; both answer. Each turn's credential is read from its own organization namespace, for that Session's actor:

    alice@lab.local's turn answered: ready
    bob@lab.local's turn answered: ready
    
    22:00:20.187  agents-agentlab-a-vgfhb  tenant-credential-anthropic  actor agents-agentlab-a-vgfhb/session-01a1adba-246c-7c5f-97b7-b476444d3308
    22:00:23.126  agents-agentlab-b-b7pjs  tenant-credential-anthropic  actor agents-agentlab-b-b7pjs/session-01a1adba-3031-7ca6-8e92-3b1d7f004494
    

    alice's CreateSession and A2A message on bob's agent are refused (PermissionDenied), and no Session is created for them. With giantswarm/agentlab@8932826 (the credential-read check counts only reads logged after it starts), organizations-test passes its credential-read and cross-organization checks. It stops later at Slack S3, because the chart does not yet turn on agent-manager's organization tools; that is the agent-platform chart follow-up, not this issue.

    Connectivity install hooks. Their RBAC exists only during a hook event, so I applied the RBAC objects from helm get hooks agent-platform-connectivity (rc.20, hook annotations removed), read as agent-platform/agent-platform-connectivity-hooks, then deleted them:

    get secret org-acme/acme-kubeconfig                          -> Forbidden
    get secret kagent/kagent-anthropic                           -> Forbidden
    get secret agents-default-5s7rp/tenant-credential-anthropic  -> Forbidden
    get secret ate-system/egress-mitm-ca-pool                    -> secret/egress-mitm-ca-pool
    get secret kagent/kagent-pg-app                              -> secret/kagent-pg-app
    list secrets -A                                              -> Forbidden (cluster scope)
    

    Its only Secret rules are by name: podcertificate-controller-system (service-dns-ca-pool, pod-identity-ca-pool), ate-system (actor-id-*, egress-mitm-ca-pool, kagent-pg-substrate-app), kagent (kagent-pg-app, kagent-pg-kagent-v2-app, kagent-pg-substrate-app), plus create, which RBAC cannot scope by name.

    Left: 4.175.0 stable on gazelle and the same check there; the audit policy request; the other cluster-wide Secret readers (kagent controller, agentgateway controller, mcp-kubernetes) as separate issues.

  4. QuentinBisson commented on Nov 5, 2026

    @QuentinBisson
    Contributor

    Acceptance criteria 3 and 4:

    The automated Secret-refusal checks for agentlab's management-cluster profile are in a follow-up agentlab pull request. organizations-test can only run them once the chart turns on agent-manager's organization tools, because its turns now start through agent-manager's start_session.

  5. self-assigned this
    on Nov 13, 2026
  6. moved this from Backlog 📦 to In Progress ⛏️ in Roadmapon Nov 13, 2026
  7. fiunchinho commented on Nov 13, 2026

    @fiunchinho
    MemberAuthor

    Closing: every acceptance criterion holds.

    1. Substrate's controller and the credential providers are refused Secrets outside their grant, proven in agentlab's management-cluster profile.

    2. The install hooks are refused a Secret they do not write.

    3. Upstream pull request and issue filed and linked; a ledger row with the exit for each narrowing.

    4. Audit policy. Closed in the comment above: the management clusters' policy in giantswarm/cluster already records the writes (RBAC with its body, Secrets and the platform's resources at Metadata), and the logs ship to Loki. No request to another team is needed.

    5. This lands before the first management-cluster migration. graveler and gazelle both run it, and gazelle has no organization namespaces yet.

    gazelle check (agent-platform 4.179.2, Substrate 1.18.0, Google access-token plugin 0.3.7; 2026-11-13; RBAC objects only):

    kubectl --context teleport.giantswarm.io-gazelle get clusterrolebindings -o wide
      ate-system/ate-controller                          -> ClusterRole/ate-controller (no rule on secrets)
      ate-system/k8s-credential-provider                 -> no ClusterRoleBinding
      ate-system/google-access-token-credential-provider -> no ClusterRoleBinding
      agent-platform/agent-platform-connectivity-hooks   -> no ClusterRoleBinding (its RBAC exists only during a hook)
      no group binding (system:serviceaccounts, system:authenticated) grants secrets
    
    kubectl --context teleport.giantswarm.io-gazelle get rolebindings -A -o wide
      ate-system/ate-controller                                     -> Role/ate-controller: secrets get,list,watch, resourceNames [egress-mitm-ca-pool]
      kagent/k8s-credential-provider-secret-reader                  -> ClusterRole/k8s-credential-provider-secret-reader (secrets get)
      kagent/google-access-token-credential-provider-secret-reader  -> ClusterRole/google-access-token-credential-provider-secret-reader (secrets get)
    

    So on gazelle ate-controller can read only ate-system/egress-mitm-ca-pool, and both providers only Secrets in kagent.

    The other identities that still read Secrets in every namespace (the kagent controller, the ChatGPT login refresher, the agentgateway controller, mcp-kubernetes) are #1391.

  8. moved this from In Progress ⛏️ to Validation ☑️ in Roadmapon Nov 13, 2026
  9. moved this from Validation ☑️ to Done ✅ in Roadmapon Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

team/bumblebee

Type

No type

Projects

  • Status
    Done ✅

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions