Skip to content

getSecretKey template function shouldn't exist #5690

@budimanjojo

Description

@budimanjojo

Is your feature request related to a problem? Please describe.

getSecretKey template function (https://external-secrets.io/latest/guides/templating/#rsa-decryption-data-from-provider) introduced by this PR is likely to be problematic for security reasons.
It opens a door to do something like this:

apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
  name: test
spec:
  # THIS IS NOT USED AT ALL, CAN BE ANY STORE YOU HAVE
  secretStoreRef:
    name: a-secret-store
    kind: SecretStore
  target:
    template:
      data:
        password: '{{ getSecretKey "a-secret-name" "another-namespace" "a-key" }}'
  # THIS IS NOT USED TOO; it's just a requirement for the validating webhook
  dataFrom:
    - extract:
        key: something

As seen above, I created an ExternalSecret just to get value of a secret key from another namespace.
Normally, I should setup the Kubernetes provider with appropriate RBAC to do something like this.

Describe the solution you'd like

I don't have any solution to offer, but I think this function shouldn't be available for the users. The appropriate way to get a secret from a Kubernetes cluster should be to use the already available Kubernetes provider.
This feature was not even introduced for Kubernetes provider in the first place.

I'm also guilty because I'm using this right now to make external-secrets as an easy "secret replicator" as it is convenient not to setup RBAC and Kubernetes secret store but I feel bad not telling people about the security issue that might be exploited by a bad actor.

Another solution is to make this feature exclusive for Senhasegura Devops Secrets Management (DSM) or to have a switch to turn this feature off completely, I really don't know.

I'm also tagging @felipeosantos as they're the feature implementer.

Thanks before!

Metadata

Metadata

Assignees

Labels

kind/featureCategorizes issue or PR as related to a new feature.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions