Repository navigation
fix(substrate): the credential providers read Secrets only where an actor's grant points - #1286
Merged
Merged
Conversation
…ctor's grant points From Substrate 1.18.0 and the Google access-token plugin 0.3.0 the meta chart binds their Secret readers in the namespaces the derived namespacePolicies name, and with the organizations on agent-platform-operator 0.1.0-rc.13 binds both in every organization namespace. The organizations' admission policies admit the operator's binding of each provider's ServiceAccount to its own reader only. make verify-secret-readers proves the refusals with SubjectAccessReviews on a local API server. Towards #1269
… from the readers' releases An own grant of an agents-* namespace is the operator's to bind, Substrate or the plugin outside ate-system get no operator binding and stay cluster-wide, and verify-secret-readers proves its reviews against a cluster-wide Substrate 1.17.5 first.
Published Helm chart
|
| Chart | agent-platform-connectivity |
| Version | 4.174.4-r1c95e814t20261105161812h8633bf5 |
| OCI reference | oci://gsoci.azurecr.io/charts/giantswarm/agent-platform-connectivity:4.174.4-r1c95e814t20261105161812h8633bf5 |
| Digest | sha256:1d092dae071465b3c0ceb7685c53f2f2a4c9bc51540211e976fa85360dd94b92 |
| Registry | public — gsoci.azurecr.io |
| Git catalog | giantswarm-test-catalog (index) |
Pull this chart
helm pull oci://gsoci.azurecr.io/charts/giantswarm/agent-platform-connectivity --version 4.174.4-r1c95e814t20261105161812h8633bf5Posted by architect-orb · build 30095 · commit 8633bf5 · updated in place on every push
Published Helm chart
|
| Chart | agent-platform |
| Version | 4.174.4-r1c95e814t20261105161812h8633bf5 |
| OCI reference | oci://gsoci.azurecr.io/charts/giantswarm/agent-platform:4.174.4-r1c95e814t20261105161812h8633bf5 |
| Digest | sha256:73359af96e478d9c15a7287102f415847abc0844d482bc437a9ca73ec02be0a7 |
| Registry | public — gsoci.azurecr.io |
| Git catalog | giantswarm-test-catalog (index) |
Pull this chart
helm pull oci://gsoci.azurecr.io/charts/giantswarm/agent-platform --version 4.174.4-r1c95e814t20261105161812h8633bf5Posted by architect-orb · build 30096 · commit 8633bf5 · updated in place on every push
2 tasks
Open
3 tasks
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.
Problem
On a management cluster every workload cluster's admin kubeconfig is a Secret. Substrate's credential provider and the Google access-token plugin each hold a Secret reader ClusterRole bound cluster-wide, so either could read every one of them. The management-cluster profile of the organizations plan calls this the blocker before any management-cluster rollout (#1269).
The narrowing itself already exists upstream of this chart:
egress-mitm-ca-poolin its namespace (atecontroller: Limit the Secrets read to the egress MITM CA pool agent-substrate/substrate#3036, carried by fix(atecontroller): limit the Secrets read to the egress MITM CA pool substrate#553).credentialProvider.rbac.namespaceslists (feat(chart): bind the credential provider's Secret reader by namespace substrate#554, upstream PR feat(helm): bind the credential provider's Secret reader only in the namespaces you list kagent-dev/substrate#131).rbac.namespaces(feat(chart): bind the Secret reader by namespace substrate-credential-providers#33).serviceAccountBindings, feat: bind ClusterRoles to ServiceAccounts of other namespaces in every organization namespace agent-platform-operator#23).This pull request wires them.
Change
allowedNamespacesentry of the derivednamespacePolicies(kagentby default). WithagentPlatformOrganizations.enabled, it forwards to the operatorserviceAccountBindingsfor both readers, and the operator binds them in every organization namespace. The narrowing is held back in three cases, so that no namespace a grant names is left unbound:0.1.0-rc.13;rbac.namespaces, which stays as set.0.1.0-rc.13(from0.1.0-rc.5).ate-system/k8s-credential-provider,ate-system/google-access-token-credential-provider) in an organization namespace. It binds the ServiceAccount alone, to that provider's own reader only, by a RoleBinding named after the reader. It binds a reader to that provider only. Nobody else, a cluster-admin included, binds a provider's ServiceAccount there (agent-platform-organization-rolebinding-subjects,agent-platform-organization-operator-objects).make verify-hooks-secrets).The Substrate and plugin pins do not move here:
components.substrate.versionRangeis>=1.17.5 <1.18.0. 1.18.0 has release candidates only, and the meta chart takes a stable range or an exact pin. The 1.18.0-rc.4 to rc.8 tags published images but no chart: theirscanjob failed, sochartsnever ran.>=0.2.0 <0.3.0until 0.3.0 is stable.The derivation takes effect when those ranges move, with nothing else to change. The operator pin moves now. With the Substrate range still on 1.17, the operator's bindings are additional to the cluster-wide ones.
Placement: upstream already has it (the charts'
rbac.namespaces, Kubernetes RoleBindings to a ClusterRole). Platform for the operator wiring and the admission pins.Tests
make verify-secret-readers(new) does two things:rbac.namespaces.tests/apiserver.py). The RBAC is the Substrate chart 1.18.0-rc.8 (from the tag's tree while its chart is unpublished) and the plugin chart 0.3.0-rc.1, rendered with the forwarded values, beside the operator's bindings. ate-controller reads onlyate-system/egress-mitm-ca-pool. Each provider gets a Secret inkagentand in an organization namespace. Each is refused one inate-system,kube-systemand a workload cluster's namespace (org-acme/acme-kubeconfig), and any list.main's meta chart, 9 checks fail: the render checks, and the provider refusals. The controller checks show the same against the 1.17.5 control.make verify-organization-admissiongains the operator's reader bindings: admitted in an organization namespace, refused elsewhere, refused with another role, another name or another subject, and refused for a cluster-admin.make verify-all(114 targets) on the merge withmainandpre-commit run --all-files: all pass.For agentlab's management-cluster profile tests (slice 8, agentlab#1149)
Run these SubjectAccessReviews on the lab's management cluster with the organizations on, Substrate 1.18.0 or later and the plugin 0.3.0 or later. Each one is
kubectl auth can-i <verb> <resource> -n <ns> --as=system:serviceaccount:ate-system:<sa> --as-group=system:serviceaccounts --as-group=system:serviceaccounts:ate-system --as-group=system:authenticated.ate-system/…)ate-controllersecrets/egress-mitm-ca-poolate-systemate-controllersecrets/<any other>ate-systemate-controllersecrets/<cluster>-kubeconfigorg-*)ate-controllersecretsk8s-credential-providersecrets/<any>kagentk8s-credential-providersecrets/<any>agents-*)k8s-credential-providersecrets/<cluster>-kubeconfigk8s-credential-providersecrets/<any>ate-system,kube-system,giantswarm,flux-giantswarmk8s-credential-providersecretsgoogle-access-token-credential-providerk8s-credential-providerThere is also the negative control for the binding itself:
kubectl get rolebinding k8s-credential-provider-secret-reader google-access-token-credential-provider-secret-reader -n <organization namespace>exists, andkubectl get clusterrolebinding k8s-credential-provider-secret-reader google-access-token-credential-provider-secret-readerdoes not.Review
An independent review (
review-pr --deep) found no blocking finding.12a63bbd)agents-*namespace is left to the operator. UPGRADE.md says that a granted namespace must exist before the ranges move.12a63bbd)ate-system, the operator gets no binding and the readers stay cluster-wide. Before this fix, the admission policy refused those bindings.12a63bbd)12a63bbd, merge)0.1.0-rc.13pin.12a63bbd)Towards #1269
Towards giantswarm/giantswarm#38891