Skip to content

Commit 7888cc7

Browse files
authored
Merge pull request #3530 from ntnn/kcp3513
Add `system:cluster:<logical-cluster>` group to effective users to enhance cross-workspace authz
2 parents 67ea956 + 42e5f88 commit 7888cc7

File tree

4 files changed

+899
-12
lines changed

4 files changed

+899
-12
lines changed

docs/content/concepts/authorization/authorizers.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,12 @@ roleRef:
125125
name: cluster-admin
126126
```
127127

128+
##### Cross-Workspace
129+
130+
Users from other workspaces can be authorized to peform actions using RBAC, e.g. to `bind` and APIExport.
131+
132+
###### Service Accounts
133+
128134
A service-account defined in a workspace implicitly is granted access to it.
129135

130136
A service-account defined in a different workspace is NOT given access to it.
@@ -136,6 +142,14 @@ A service-account defined in a different workspace is NOT given access to it.
136142

137143
Service accounts declared within a workspace don't have access to initializing workspaces.
138144

145+
###### Foreign Users
146+
147+
Users can either be global kcp users or users that originate from a specific workspace, e.g. through an OIDC provider configured for that workspace.
148+
149+
Users that do not originate from the workspace the request is being made to and are not global kcp users are only visible as user `system:anonymous`
150+
with groups `system:authenticated` and `system:cluster:<logical-cluster>`, where `<logical-cluster>` is the name of the logical cluster backing
151+
the workspace they originated from.
152+
139153
#### System CRD Authorizer
140154

141155
This small authorizer simply prevents updates to the `status` subresource on APIExports or APIBindings. Note that this authorizer does not validate changes to the CustomResourceDefinitions themselves, but to objects from those CRDs instead.
@@ -270,13 +284,21 @@ The webhook will receive JSON-marshalled `SubjectAccessReview` objects, that (co
270284
"group2"
271285
],
272286
"extra": {
273-
"authorization.kubernetes.io/cluster-name": ["root"]
287+
"authorization.kcp.io/cluster-name": ["root"]
274288
}
275289
}
276290
}
277291
```
278292

279-
The extra field will contain the logical cluster _name_ (e.g. o43u2gh528rtfg721rg92), not the human-readable path. Webhooks need to resolve the name to a path themselves if necessary.
293+
The extra field will contain the logical cluster _name_ (e.g. o43u2gh528rtfg721rg92), not the human-readable path. Webhooks need to resolve the name to a path themselves if necessary.
294+
295+
!!! note
296+
In the past the cluster name was provided in the `authorization.kubernetes.io/cluster-name` extra field instead of `authorization.kcp.io/cluster-name`.
297+
This field is deprecated as of kcp v0.28.3 and will be removed in a future release.
298+
299+
!!! note
300+
Request payloads can also contain the `authentication.kcp.io/cluster-name` and `authentication.kcp.io/scopes` extra fields if the user originates from the workspace the request is made against.
301+
If the users authenticated against another workspace than the target of the request these fields will not be present - instead the user will be seen as `system:anonymous` with groups `system:authenticated` and `system:cluster:<logical-cluster>`, where `<logical-cluster>` is the name of the logical cluster backing the workspace they authenticated against.
280302

281303
### Authorizer Order
282304

@@ -310,8 +332,8 @@ extra:
310332
- cluster:logical-cluster-1
311333
```
312334
This user will only be allowed to access resources in `logical-cluster-1`,
313-
falling back to be considered as user `system:anonymous` with group
314-
`system:authenticated` in all other logical clusters.
335+
falling back to be considered as user `system:anonymous` with groups
336+
`system:authenticated` and `system:cluster:logical-cluster-1` in all other logical clusters.
315337

316338
Each extra field can contain multiple scopes, separated by a comma:
317339
```yaml
@@ -322,8 +344,10 @@ extra:
322344
- cluster:logical-cluster-1,cluster:logical-cluster-2
323345
```
324346
This user is allowed to operate in both `logical-cluster-1` and
325-
`logical-cluster-2`, falling back to be considered as user `system:anonymous`
326-
with group `system:authenticated` in all other logical clusters.
347+
`logical-cluster-2`, falling back to be considered as user
348+
`system:anonymous` with groups `system:authenticated`,
349+
`system:cluster:logical-cluster-1` and
350+
`system:cluster:logical-cluster-2` in all other logical clusters.
327351

328352
If multiple `authentication.kcp.io/scopes` values are set, the intersection is
329353
taken:
@@ -335,9 +359,10 @@ extra:
335359
- cluster:logical-cluster-1,cluster:logical-cluster-2
336360
- cluster:logical-cluster-2,cluster:logical-cluster-3
337361
```
338-
This user is only allowed to operate in `logical-cluster-2`, falling back to be
339-
considered as user `system:anonymous` with group `system:authenticated` in all
340-
other logical clusters.
362+
This user is only allowed to operate in `logical-cluster-2`, falling
363+
back to be considered as user `system:anonymous` with groups
364+
`system:authenticated` and `cluster:logical-cluster-2` in all other
365+
logical clusters.
341366

342367
The intersection can be empty, in which case it falls back in every logical
343368
cluster.

0 commit comments

Comments
 (0)