Skip to content

rpadmin: add OAUTHBEARER auth option for debug bundle#165

Merged
david-yu merged 2 commits intomainfrom
dyu/rpadmin-oauthbearer-debug-bundle
Apr 21, 2026
Merged

rpadmin: add OAUTHBEARER auth option for debug bundle#165
david-yu merged 2 commits intomainfrom
dyu/rpadmin-oauthbearer-debug-bundle

Conversation

@david-yu
Copy link
Copy Markdown
Contributor

Summary

  • Add WithOAuthBearerAuthentication(token string) so callers can forward an OIDC bearer token to the broker's /v1/debug/bundle endpoint. The existing WithSCRAMAuthentication only covers SCRAM profiles, leaving rpk with no way to express OAUTHBEARER credentials to the broker-side rpk subprocess.
  • Add a peer payload debugBundleOAuthBearerAuthentication { mechanism, token } — sent as {\"mechanism\":\"OAUTHBEARER\",\"token\":\"<JWT>\"} on the same authentication field as the existing SCRAM payload.
  • Export an OAuthBearer = \"OAUTHBEARER\" constant alongside ScramSha256 / ScramSha512 / CloudOIDC.

Motivation

Follow-up on review feedback in redpanda#30169, which adds OAUTHBEARER to rpk's Kafka/admin/Schema Registry clients. In that PR, `rpk debug remote-bundle start` silently drops auth for OAUTHBEARER profiles (via `HasSASLCredentials()`, which requires both user and password), so requests go to the broker with no auth and fail confusingly on secured clusters.

That PR lands a short-term guard that rejects OAUTHBEARER for remote debug bundle up front with a clear error. This PR unblocks the end-to-end fix by adding the client-side option; the broker-side JSON parser and subprocess arg builder still need to accept the new payload ([tracked in a separate redpanda issue]).

Test plan

  • `go test ./rpadmin/... -count=1` passes locally
  • New sub-test `TestDebugBundleOption/oauthbearer_auth` asserts both the struct discriminator and the serialized JSON
  • Wait for broker-side support before rpk consumes this option

🤖 Generated with Claude Code

Add WithOAuthBearerAuthentication(token) so callers can forward an
OIDC bearer token to the broker's /v1/debug/bundle endpoint. The
existing WithSCRAMAuthentication option only covers SCRAM profiles,
which leaves rpk with no way to express OAUTHBEARER credentials to
the broker-side rpk subprocess.

The new payload is {"mechanism":"OAUTHBEARER","token":"<JWT>"}, sent
as a peer variant of the existing SCRAM payload on the same
Authentication field. Also export an OAuthBearer constant alongside
ScramSha256/ScramSha512/CloudOIDC.

Broker-side support for this payload is a separate change in
redpanda.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@secpanda
Copy link
Copy Markdown

secpanda commented Apr 17, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

gosec G117 flags fields named "Password"/"Pass", not generic token
fields, so the nolint directive copied from the SCRAM password field
is inert and trips nolintlint.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@david-yu david-yu merged commit 3d14b1b into main Apr 21, 2026
27 checks passed
@david-yu david-yu deleted the dyu/rpadmin-oauthbearer-debug-bundle branch April 21, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants