fix: support OIDC refresh and trusted CA server certificates - #598
Merged
Merged
Conversation
OIDC providers were excluded from the trusted CA server certificate exception, and the kube build did not enable token refresh. Enable OIDC refresh and allow OIDC through the TLS guard while retaining the exclusions for exec plugins and other providers. Closes #597
Greptile SummaryThis PR enables kube-client’s OIDC support and permits OIDC-authenticated kubeconfigs to use the existing, narrowly bounded CA server-certificate exception.
Confidence Score: 5/5The PR appears safe to merge; the previously missing OIDC refresh success path is now covered through both supported client-construction paths. The mock issuer verifies discovery and refresh request details, while the Kubernetes API harness confirms that the returned ID token—not the expired cached token—is applied to subsequent requests. The TLS exception remains limited to qualifying configured CA certificates and OIDC providers, with existing exclusions preserved. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Kube configuration] --> B{OIDC auth provider?}
B -- No --> C[Standard kube TLS verification]
B -- Yes --> D{Configured certificate qualifies<br/>for CA server exception?}
D -- No --> C
D -- Yes --> E[Custom Kubernetes API TLS verifier]
B -- Yes --> F{ID token valid?}
F -- Yes --> G[Send cached ID token]
F -- No --> H[Discover identity provider]
H --> I[Refresh through separate HTTPS connection<br/>using system trust]
I --> J[Send refreshed ID token]
E --> K[Kubernetes API request]
G --> K
J --> K
Reviews (2): Last reviewed commit: "test: verify successful OIDC token refre..." | Re-trigger Greptile |
The existing regression test stopped at a missing refresh field. Use a mock HTTPS issuer to verify discovery, the refresh exchange, and use of the returned ID token in a keyboard-triggered Kubernetes watch through both TLS client paths. Set fixture trust only in the child test process.
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.
OIDC kubeconfigs could fail at TLS verification when the API server used a trusted CA as its server certificate. Expired OIDC tokens also could not refresh because the build did not enable the kube
oidcfeature.Enable OIDC token refresh and allow
auth-providerentries withname: oidcto use the existing CA server certificate exception. The certificate must still exactly match a trusted kubeconfig CA and pass the existing checks. Exec plugins and other providers retain standard verification. Update the documentation with the OIDC configuration requirements and separate identity provider trust requirements.Validation:
just checkpassed: formatting, Clippy, and 1,682 tests passed; 2 ignored.Closes #597