resolve bearer token secrets before authentication #3259
Merged
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
Fixes a bug where bearer tokens in CLI format were not being resolved to plain text before being passed to the authentication handler, causing authentication failures.
Problem
When a bearer token was configured without an OAuth client secret, the runner was passing the CLI format string (e.g.,
"BEARER_TOKEN_posthog-remote-bearer,target=bearer_token") directly toBearerTokenSourceinstead of resolving it to the actual token value first.This occurred because
WithSecrets()(which resolves CLI format secrets to plain text) was only called whenClientSecretwas present, not when onlyBearerTokenwas configured.Root Cause
In
pkg/runner/runner.go, the condition on line 169 only checked forClientSecret:hasRemoteAuthSecret := r.Config.RemoteAuthConfig != nil && r.Config.RemoteAuthConfig.ClientSecret != ""