Coder Social home page Coder Social logo

oAuthSecret stored in plain text about che HOT 11 CLOSED

guydog28 avatar guydog28 commented on June 2, 2024
oAuthSecret stored in plain text

from che.

Comments (11)

tolusha avatar tolusha commented on June 2, 2024

Hello @guydog28
Make sense for me.

Suggestion:
Modify networking.auth.oAuthSecret to first check in the namespace for a secret with the provided name, and a key of 'secret', and if it does not exist, assume the value is the plaintext secret. This keeps things working with backward compatibility but allows us to keep sensitive oauth client secrets out of our git repo.

from che.

ibuziuk avatar ibuziuk commented on June 2, 2024

Adding help-wanted label. @guydog28 Would you be interested in contributing this functionality to Eclipse Che?

from che.

guydog28 avatar guydog28 commented on June 2, 2024

Adding help-wanted label. @guydog28 Would you be interested in contributing this functionality to Eclipse Che?

Possibly. If someone wants to point me in the right direction for eclipse's requirements for contributing and the section of the architecture to look at for this, I can possibly dig in a bit.

from che.

tolusha avatar tolusha commented on June 2, 2024

I think we can read the secret here [1] like this:

secret := &corev1.Secret{}
exists, err := deploy.GetNamespacedObject(ctx, ctx.CheCluster.Spec.Networking.Auth.OAuthSecret, secret)

If secret exists, then read some key from it, otherwise use ctx.CheCluster.Spec.Networking.Auth.OAuthSecret as plain text

[1] https://github.com/eclipse-che/che-operator/blob/32974f029ee66275cf1fa4c49cc6e7ae2c621f23/pkg/deploy/gateway/oauth_proxy.go#L103

from che.

guydog28 avatar guydog28 commented on June 2, 2024

I think we can read the secret here [1] like this:

secret := &corev1.Secret{}
exists, err := deploy.GetNamespacedObject(ctx, ctx.CheCluster.Spec.Networking.Auth.OAuthSecret, secret)

If secret exists, then read some key from it, otherwise use ctx.CheCluster.Spec.Networking.Auth.OAuthSecret as plain text

[1] https://github.com/eclipse-che/che-operator/blob/32974f029ee66275cf1fa4c49cc6e7ae2c621f23/pkg/deploy/gateway/oauth_proxy.go#L103

I agree that is probably the right spot since it isn't done the same way in openshift. Is this something your team would do or is it still preferred that I do it? I've only written minimal Go, so it might take me a bit to get a working environment going and wrap my head around it and add tests and such.

from che.

guydog28 avatar guydog28 commented on June 2, 2024

I created this:

eclipse-che/che-operator@main...guydog28:che-operator:main

But I lack the background to create proper unit tests that test the cases where:

  1. The secret exists and the key oAuthSecret does not exist on the secret, and
  2. The secret exists and the key oAuthSecret does exist on the secret

Mainly - how to mock the calls to get the secret and the key in the cluster for the tests.

Any help on that would be appreciated and then I can submit a PR.

from che.

tolusha avatar tolusha commented on June 2, 2024

@guydog28
Sounds good, could you create a PR ?
I will provide comments there.

from che.

guydog28 avatar guydog28 commented on June 2, 2024

@tolusha eclipse-che/che-operator#1836 Created there.

from che.

tolusha avatar tolusha commented on June 2, 2024

@guydog28
Thank you for contribution.

from che.

guydog28 avatar guydog28 commented on June 2, 2024

@guydog28 Thank you for contribution.

You are very welcome. Thanks for the help!

from che.

ibuziuk avatar ibuziuk commented on June 2, 2024

@guydog28 thank you for the contribution \o/
Adding the issue to the upstream Release Notes:

Previously, when deployed on Kubernetes, `oAuthClientSecret` was stored in plain text in the CheCluster resource.   That was not convenient for the GitOps approach when the cluster state is stored in Git and managed by ArgoCD. Starting from this release the values for oAuthSecret can be configured using ExternalSecrets to keep all sensitive data out of the code base.

will you be able to contribute additional docs to https://github.com/eclipse-che/che-docs?

from che.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.