Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to limit serviceaccount access to one secret only #378

Open
simonsystem opened this issue Dec 12, 2024 · 0 comments
Open

Ability to limit serviceaccount access to one secret only #378

simonsystem opened this issue Dec 12, 2024 · 0 comments

Comments

@simonsystem
Copy link

For security reason, we would like to restrict access for the sidecar service-account to get only one named secret with the resourceNames option.
See the following role:

apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
  name: allow-only-one-secrets
rules:
  - apiGroups:
      - ""
    resources:
      - secrets
    resourceNames:
      - my-holy-secret
    verbs:
      - get
      - watch

Poorly, the sidecar is using the list_namespaced_secret function here. So it will result in a forbidden response from K8S-API.

Error from server (Forbidden): secrets is forbidden: User "system:serviceaccount:default:sidecar" cannot list resource "secrets" in API group "" in the namespace "default"

We suggest adding functionality to fetch/get only one secret from K8S-API using read_namespaced_secret.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant