fix vault OIDC client_id injection - #39
Open
travisbcotton wants to merge 1 commit into
Open
travisbcotton wants to merge 1 commit into
travisbcotton wants to merge 1 commit into
Conversation
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
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.
Description
The operator's
EnsureOIDCConfigonly configuresidentity/oidc/config(issuer) andidentity/oidc/key/openchami-<cluster>— but never creates the OIDC client (identity/oidc/client/...). Because no Vault OIDC client existsclient_idwas ever generated.openchami/<cluster>/oidc/tokensmith-clientwas seeded with only a randomclient_secret(internal/reconcilers/vault.go:238) — a bogus value, not a real Vault-issued credential.OIDC_CLIENT_SECRET, neverOIDC_CLIENT_ID(internal/reconcilers/tokensmith.go:250).So the
client_secretin the k8s secret was justrandomHex(32), andclient_idwas entirely absent — JWT validation had no way to succeed.Fixes
internal/vault/client_vault.go—EnsureOIDCConfignow creates theidentity/oidc/client/openchami-<cluster>-tokensmith(using the built-inallow_allassignment), reads it back, and returns the Vault-generatedclient_id/client_secret. Signature changed to return a newOIDCClientCredentialsstruct.internal/vault/client.go— interface updated +OIDCClientCredentialstype added.internal/reconcilers/vault.go— whenoidcProvider: vault, the returned credentials are written (overwrite) into theTokensmithOIDCKV path, so VSO syncs a realclient_idandclient_secretintoopenchami-<cluster>-tokensmith-oidc. The seed now also includes aclient_idplaceholder (matters for theexternalprovider).internal/reconcilers/tokensmith.go— added theOIDC_CLIENT_IDenv var sourced from the secret'sclient_idkey (alongside the existingOIDC_CLIENT_SECRET).internal/vault/fake/client.go& tests — fake returns stable per-cluster creds; added regression testTestVaultReconciler_OIDCClientCredentialsand extended the tokensmith test to assertOIDC_CLIENT_ID.hack/local-dev/seed-vault.sh— now seedsclient_idtoo.Fixes #38
Checklist
make test(or equivalent) locally and all tests passgit commit -s) with my real name and email<filename>.licensesidecarLICENSES/directoryType of Change