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

OIDC client-secret gets passed to the proxy as a cli argument even if set as a Secret #39

Open
PastNullInfinity opened this issue Feb 17, 2020 · 3 comments
Labels
enhancement New feature or request

Comments

@PastNullInfinity
Copy link

The Proxy Injector supports taking parameters as a Secret, which would have made me believe that the injected sidecar would do the same, which is not the case.

When configuring the sidecar container, the ProxyInjector will always set the configuration of Gatekeeper as command line arguments,making the whole point of passing sensitive variables as a Secret moot.

In particular, these lines are problematic:

if config.ClientSecret != "" && annotations[constants.AnnotationPrefix+"client-secret"] == "" {
configArgs = append(configArgs, "--client-secret="+config.ClientSecret)
}

What i would expect is that the ProxyInjector controller would create a separate Secret for the client-secret, and mount it as a VolumeMount inside the Gatekeeper container.

As it stands, this issue makes the whole premise of the {{- if eq .Values.proxyinjector.mount "secret" }} option inside the configuration of ProxyInjector pretty much useless ☹️

@PastNullInfinity PastNullInfinity changed the title OIDC gets passed to the proxy as a cli argument even if set as a Secret OIDC client-secret gets passed to the proxy as a cli argument even if set as a Secret Feb 17, 2020
@usamaahmadkhan
Copy link
Contributor

@PastNullInfinity Thank you for opening an issue. Does gatekeeper provides support to get the secrets from Environment variables instead of cli? If yes, then we can just set them and this can be resolved.

@usamaahmadkhan usamaahmadkhan added the enhancement New feature or request label Feb 18, 2020
@PastNullInfinity
Copy link
Author

@PastNullInfinity Thank you for opening an issue. Does gatekeeper provides support to get the secrets from Environment variables instead of cli? If yes, then we can just set them and this can be resolved.

Unfortunately not, only through cli flags or via the config.yaml.

For now I have a (admittedly, pretty hacky) workaround: I've made a new dockerfile for gatekeeper that passes $CLIENT_SECRET as a flag to gatekeeper, and then I've modified the patch that ProxyInjector applies in order to also add an env: declaration with a reference to a Secret containing the key.

As far as I can tell, there's no easy way to set the secret without mounting it as a file (so a volumeMount), or by editing the dockerfile itself.

I realize also that adding a volume would mean to change quite a bit of the current patch method, since it only cares for the container spec right now.

@PastNullInfinity
Copy link
Author

Ping for this issue. If the proposed solution seems usable, I can start to work on a PR.
Otherwise, I'm happy to help with changing the Patching method in a way that solves this issue

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

No branches or pull requests

2 participants