Skip to content

[v14] Fix downgrade logic of KubernetesResources to Role v6#36009

Merged
tigrato merged 1 commit intobranch/v14from
tigrato/properly-handle-downgrades-b14
Dec 22, 2023
Merged

[v14] Fix downgrade logic of KubernetesResources to Role v6#36009
tigrato merged 1 commit intobranch/v14from
tigrato/properly-handle-downgrades-b14

Conversation

@tigrato
Copy link
Copy Markdown
Contributor

@tigrato tigrato commented Dec 22, 2023

Backport #35991 to branch/v14

Changelog: Fix downgrade logic of KubernetesResources to Role v6

`KubernetesResources` were improperly downgraded when they grant access
to all resources.

In that case, the role was downgraded to something that can't be used to
access Kubernetes clusters but they could have been downgraded to a
`Role` v6 with the same permissions as the `KubernetesResources`.

This commit fixes the downgrade logic to downgrade to a `Role` v6 with
the same permissions as the `KubernetesResources`.

A role v7 with

```json
kubenretes_labels:
 '*': '*'
kubernetes_resources:
- kind: pod
  name: '*'
  namespace: '*'
  verbs:
  - '*'
```
Is downgraded to a role v6 with

```json
kubenretes_labels:
 '*': '*'
kubernetes_resources:
- kind: pod
  name: '*'
  namespace: '*'
```

Signed-off-by: Tiago Silva <tiago.silva@goteleport.com>
@github-actions
Copy link
Copy Markdown
Contributor

The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with changelog: followed by the changelog entries for the PR.

@tigrato tigrato added this pull request to the merge queue Dec 22, 2023
Merged via the queue into branch/v14 with commit 8df12e4 Dec 22, 2023
@tigrato tigrato deleted the tigrato/properly-handle-downgrades-b14 branch December 22, 2023 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants