Fix downgrade logic of KubernetesResources to Role v6#35991
Merged
Conversation
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 |
AntonAM
approved these changes
Dec 21, 2023
espadolini
approved these changes
Dec 22, 2023
Contributor
There was a problem hiding this comment.
I'd make it more explicit here
Suggested change
| !slices.Equal(resource.Verbs, []string{types.Wildcard}) { | |
| (len(resource.Verbs) != 1 || resource.Verbs[0] != types.Wildcard) { |
Contributor
There was a problem hiding this comment.
(what if there's two verbs and they're both "*" tho?)
Contributor
Author
There was a problem hiding this comment.
You can't. CheckAndSetDefaults prevents you from adding * and any other verb
`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>
5c038a2 to
34a3942
Compare
tigrato
added a commit
that referenced
this pull request
Dec 22, 2023
`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-merge-queue Bot
pushed a commit
that referenced
this pull request
Dec 22, 2023
…36009) `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>
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.
KubernetesResourceswere 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
Rolev6 with the same permissions as theKubernetesResources.This commit fixes the downgrade logic to downgrade to a
Rolev6 with the same permissions as theKubernetesResources.A role v7 with
Is downgraded to a role v6 with
Changelog: Fix downgrade logic of KubernetesResources to Role v6