Add OIDC authentication support to the Doppler provider#157
Open
coetzeevs wants to merge 7 commits into
Open
Conversation
Add exchangeOIDCToken() standalone function that exchanges an OIDC JWT for a short-lived Doppler API token via POST /v3/auth/oidc. This is an unauthenticated endpoint - the JWT itself serves as the credential. The function reuses existing HTTP, TLS, and error handling patterns from the API client. It is not yet called by any code path.
Add oidc_identity, oidc_token, and oidc_token_file as alternative authentication fields to the provider schema. Change doppler_token from Required to Optional. The provider now accepts either a static doppler_token OR an OIDC identity + JWT. When OIDC fields are provided, the provider exchanges the JWT for a short-lived Doppler API token at configure time via POST /v3/auth/oidc, then uses it identically to a static token. Validation ensures mutual exclusivity between the two auth methods and that all required OIDC fields are present when OIDC is used.
Update the provider documentation template and regenerated docs to describe both authentication methods: static token and OIDC. The schema section now shows all fields as Optional with the new OIDC fields included.
The Doppler API requires oidc_identity to be a valid UUID. This adds client-side validation with a clear error message before making the API call, and updates field descriptions, docs, and examples to reflect the UUID requirement.
MEDIUM fixes: - Pass context.Context through exchangeOIDCToken and use http.NewRequestWithContext for cancellation support - Bound OIDC response body read to 1MB via io.LimitReader, migrate from deprecated ioutil.ReadAll to io.ReadAll - Reject non-absolute paths for oidc_token_file LOW fixes: - Sanitize file-read error messages to avoid OS error leakage - Emit warning when verify_tls=false is used with OIDC auth - Emit warning when host does not use HTTPS with OIDC auth - Validate JWT has 3 dot-separated parts before transmission
Show both oidc_token_file and oidc_token variants in the provider documentation and example configuration so users are aware of both OIDC authentication options.
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.
Summary
Adds OpenID Connect (OIDC) authentication as a new provider authentication method, enabling keyless authentication from CI/CD platforms (GitHub Actions, GitLab CI, etc.) and Kubernetes workloads that issue OIDC tokens.
Changes
doppler/api.go): AddexchangeOIDCTokenfunction that exchanges an OIDC JWT for a Doppler API token via the/v3/auth/oidcendpoint, with TLS 1.2 minimum, 30s timeout, and 1MB response size limitdoppler/provider.go): Add three new optional attributes:oidc_identity— UUID of the Doppler service account identity (DOPPLER_OIDC_IDENTITY)oidc_token— JWT token directly (DOPPLER_OIDC_TOKEN)oidc_token_file— path to a file containing a JWT (DOPPLER_OIDC_TOKEN_FILE)doppler/provider.go):doppler_tokenand OIDC auth, and betweenoidc_token/oidc_token_fileoidc_identityoidc_token_file, with empty-file checkoidc_tokenmarkedSensitive: trueto prevent plan output leakagedoppler_tokenchanged fromRequiredtoOptionaltemplates/index.md.tmpl,docs/index.md): Document both OIDC authentication options with usage examplesexamples/main.tf): Add commented-out OIDC provider configuration examplesUsage
Test plan
make buildcompiles successfullymake testpassesmake tfdocsproduces docs consistent with templates (hash unchanged)exec.Command,ioutil.WriteFile)