mirror of
https://github.com/cozystack/cozystack.git
synced 2026-11-21 12:13:55 +09:00
docs(observability-proxy): explain why both application roots need the namespace root
The reason given for the second access review held only for the metrics root. The log root needs it too, because an ownerless pod keeps the lineage labels its creator set and can claim any application. The tenant ClusterRole comment also named only the namespace roots, though the application roots now depend on the same rule. Assisted-by: LLM Signed-off-by: ZverGuy <maximbel2003@gmail.com>
This commit is contained in:
1 parent
e8e0cede61
commit
19dbee15fc
3 files changed
+17
-8
No files matched your search
@@ -132,10 +132,14 @@ func ParseRoute(escapedPath string) (Route, *HTTPError) {
|
||||
}
|
||||
|
||||
// Reviews lists every access a request on the route needs. An application
|
||||
// root also needs read access to its namespace root: its pod and PVC
|
||||
// branches match by name across the window, so a name another application
|
||||
// held earlier reaches that application's series, and a grant narrowed by
|
||||
// resourceNames would read more than it names.
|
||||
// root also needs read access to its namespace root, because its scope
|
||||
// narrows within the namespace but does not isolate: on both roots the
|
||||
// identity comes from lineage labels that the lineage webhook keeps as set
|
||||
// on an object it finds no owner for, so anyone who can create a pod there
|
||||
// can label it as the application; on the metrics root the pod and PVC
|
||||
// branches also match by name across the window, so a name another
|
||||
// application held earlier reaches that application's series. A grant
|
||||
// narrowed by resourceNames would read more than it names.
|
||||
func (r Route) Reviews() []authorizationv1.ResourceAttributes {
|
||||
switch r.Kind {
|
||||
case ApplicationLog:
|
||||
|
||||
@@ -282,9 +282,10 @@ func TestServerApplicationMetricsBranches(t *testing.T) {
|
||||
|
||||
// A grant narrowed to application "a" by resourceNames must not reach "b"
|
||||
// through any endpoint of either root. Without read access to the
|
||||
// namespace roots it does not reach "a" either: the pod and PVC branches
|
||||
// match by name, and a name another application used earlier in the
|
||||
// window would pull its series in.
|
||||
// namespace roots it does not reach "a" either: an ownerless pod keeps the
|
||||
// lineage labels its creator set, so it can claim to be "a" on both roots,
|
||||
// and on the metrics root the pod and PVC branches match by name, so a name
|
||||
// another application used earlier in the window would pull its series in.
|
||||
func TestServerApplicationNarrowedGrant(t *testing.T) {
|
||||
h := newPolicyHarness(t, Config{}, appMetricsUpstream([]string{"a-0"}, nil, http.StatusOK), appPolicy, nil)
|
||||
paths := []string{
|
||||
|
||||
@@ -1,7 +1,11 @@
|
||||
# Aggregated into cozy-tenant-view (and consequently use, admin, super-admin).
|
||||
# No API server serves cozystack.io logs or metrics: the rule exists only for
|
||||
# the SubjectAccessReview the observability proxy asks before it answers a
|
||||
# read under /apis/cozystack.io/v1alpha1/namespaces/<ns>/{logs,metrics}/.
|
||||
# read under /apis/cozystack.io/v1alpha1/namespaces/<ns>/{logs,metrics}/,
|
||||
# and before a read under an application root,
|
||||
# /apis/apps.cozystack.io/v1alpha1/namespaces/<ns>/<plural>/<name>/{log,metrics}/,
|
||||
# which needs the namespace root too. Narrowing this role also cuts off the
|
||||
# application roots.
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
|
||||
Reference in new issue
Block a user