fix incorrect return value from ensureOIDCProvider - #63
Open
travisbcotton wants to merge 2 commits into
Open
travisbcotton wants to merge 2 commits into
travisbcotton wants to merge 2 commits into
Conversation
Signed-off-by: Travis Cotton <trcotton@lanl.gov>
alexlovelltroy
approved these changes
Sep 24, 2026
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
In
internal/vault/client_vault.go,ensureOIDCProviderwrote the base issuer to Vault (correct — Vault requires scheme+host with no path), but then compared Vault's read-back againstcfg.IssuerURLdirectly. Since Vault appends/v1/identity/oidc/provider/openchamito form the effective issuer, the operator flagged a provider it had just created as a conflict on the next reconcile.Notably, the existing tests hid the bug because their mock Vault returned the base issuer on read-back instead of the effective issuer that real Vault returns.
Changes
internal/vault/client_vault.goexpectedOIDCProviderIssuer(base string)helper that appends the provider path to the trimmed base (matches the suggested fix and the existingvaultOIDCProviderPathSuffixinhelpers.go).ensureOIDCProviderstill writes the base issuer to Vault, but now compares both the pre-write read and the post-write read-back against the effectiveexpectedissuer. Conflict errors now report the effective issuer on both sides.internal/vault/client_vault_test.goTestExpectedOIDCProviderIssuer— unit test for the helper (incl. trailing-slash trimming).TestVaultClient_EnsureOIDCProviderIdempotentOnEffectiveIssuer— the core case: an operator-created provider read back as the effective issuer is accepted, not a conflict.TestVaultClient_EnsureOIDCProviderRealConflict— a genuine cross-Vault host mismatch is still anOIDCIssuerConflictErrorwith no write.TestVaultClient_EnsureOIDCProviderCreateReconcileReconcile— create → reconcile → reconcile all succeed.Checklist
make test(or equivalent) locally and all tests passgit commit -s) with my real name and email<filename>.licensesidecarLICENSES/directoryType of Change