Skip to content

feat(otel-collector): add OIDC bearer token auth for the OTLP receiver - #2788

Open
arj22 wants to merge 3 commits into
hyperdxio:mainfrom
arj22:add-oidc-otlp-auth
Open

feat(otel-collector): add OIDC bearer token auth for the OTLP receiver#2788
arj22 wants to merge 3 commits into
hyperdxio:mainfrom
arj22:add-oidc-otlp-auth

Conversation

@arj22

@arj22 arj22 commented Aug 4, 2026

Copy link
Copy Markdown

Summary

Adds oidcauthextension as an alternative to the existing static bearer token auth (config.standalone.auth.yaml / OTLP_AUTH_TOKEN) in standalone mode.

Motivation: the current standalone-mode auth option is a single long-lived shared secret (OTLP_AUTH_TOKEN) checked against every request. That's a reasonable default for small/trusted deployments, but doesn't scale well to large or less-trusted fleets of OTLP producers -- a single leaked token compromises every sender indefinitely, since there's no way to revoke or scope it to one client. This PR adds OIDC-based bearer token validation as an opt-in alternative: producers present a JWT (Authorization: Bearer <token>) issued by any OIDC-compatible provider, and the collector validates it against that provider's published JWKS (fetched from {issuer_url}/.well-known/openid-configuration), checking iss/aud/exp. This lets self-hosters issue short-lived, per-client tokens instead of one static secret, using whatever identity provider/token-minting approach they already have -- the collector side just needs issuer_url and audience.

Changes:

  • packages/otel-collector/builder-config.yaml: add oidcauthextension to the OCB build manifest (same version pin pattern as the existing bearertokenauthextension entry)
  • docker/otel-collector/config.standalone.oidc.yaml: new file, mirrors config.standalone.auth.yaml's structure -- OIDC_ISSUER_URL/OIDC_AUDIENCE env vars configure the extension on both OTLP protocols (grpc + http)
  • docker/otel-collector/entrypoint.sh: include the new config file when OIDC_ISSUER_URL is set; otherwise fall back to OTLP_AUTH_TOKEN as before. The two are treated as mutually exclusive (both configure the same receiver's auth.authenticator, so enabling both would just make config-load order decide the winner, which seemed worth avoiding)
  • docker/otel-collector/Dockerfile: copy the new config into both the dev and prod image stages, alongside the existing standalone config files

Validation: ran a local docker build -f docker/otel-collector/Dockerfile --target ocb-builder . and confirmed the extension compiles into otelcol-hyperdx and appears in components output (oidc | github.com/open-telemetry/opentelemetry-collector-contrib/extension/oidcauthextension). I have not run this against a live OIDC provider end-to-end, and there's no automated test yet -- happy to add one if there's a preferred pattern for extension-config integration tests in this repo, or to adjust the approach (e.g. if a CUSTOM_OTELCOL_CONFIG_FILE-based approach is preferred over a new baked-in standalone config).

How to test on Vercel preview

N/A -- non-UI change (otel-collector only).

References


This PR was drafted with Claude Code assistance (I saw your CONTRIBUTING.md's AI-Assisted Development section and the .claude/ tooling in-repo, so figured that was fair game) and reviewed/tested by me before opening -- happy to adjust the approach based on maintainer feedback.

🤖 Generated with Claude Code

Adds oidcauthextension as an alternative to the existing static bearer
token auth (config.standalone.auth.yaml / OTLP_AUTH_TOKEN) in standalone
mode. This lets self-hosters authenticate OTLP producers with per-client,
short-lived, centrally-issued JWTs (validated against a provider's
published JWKS) instead of a single long-lived shared secret -- useful
for large/untrusted fleets where a leaked static token would otherwise
compromise every sender indefinitely.

- packages/otel-collector/builder-config.yaml: add oidcauthextension to
  the OCB build manifest
- docker/otel-collector/config.standalone.oidc.yaml: new, mirrors
  config.standalone.auth.yaml's pattern -- OIDC_ISSUER_URL/OIDC_AUDIENCE
  env vars configure the extension on both OTLP protocols
- docker/otel-collector/entrypoint.sh: include the new config when
  OIDC_ISSUER_URL is set, otherwise fall back to OTLP_AUTH_TOKEN as
  before (the two are mutually exclusive, since both configure the same
  receiver's auth.authenticator)
- docker/otel-collector/Dockerfile: copy the new config file into both
  the dev and prod image stages

Validated with a local `docker build --target ocb-builder` -- the
extension compiles into otelcol-hyperdx and shows up in `components`
output. Not yet covered by an automated test; happy to add one if
there's a preferred pattern for extension-config integration tests in
this repo.

This was drafted with Claude Code assistance and reviewed/tested by me
before opening.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Aug 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 251d9e9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/otel-collector Minor
@hyperdx/api Minor
@hyperdx/app Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Aug 4, 2026

Copy link
Copy Markdown

@arj22 is attempting to deploy a commit to the HyperDX Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds opt-in OIDC bearer-token validation to the standalone OTLP receiver while preserving static-token authentication as the fallback.

  • Compiles oidcauthextension into the custom collector distribution.
  • Adds and packages a standalone OIDC configuration for both OTLP transports.
  • Selects OIDC authentication when issuer and audience are configured and fails fast when the audience is missing.
  • Adds the required collector package changeset.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the missing-audience path now exits with a clear error, and the required changeset is present.

Important Files Changed

Filename Overview
docker/otel-collector/entrypoint.sh Selects OIDC ahead of static-token authentication and now explicitly rejects a missing audience before collector startup.
docker/otel-collector/config.standalone.oidc.yaml Defines the OIDC authenticator and attaches it to both standalone OTLP transports.
packages/otel-collector/builder-config.yaml Adds the published OIDC authentication extension to the custom collector build.
docker/otel-collector/Dockerfile Packages the new OIDC configuration in both development and production collector images.
.changeset/add-oidc-otlp-auth.md Records the user-facing collector authentication feature as a minor package change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Env{Standalone auth environment}
  OIDC[OIDC issuer and audience]
  Static[Static OTLP auth token]
  Open[No receiver authentication]
  Config[Load standalone OIDC config]
  Bearer[Load standalone bearer-token config]
  Receiver[OTLP receiver: gRPC and HTTP]
  Provider[OIDC discovery and JWKS]
  Pipeline[HyperDX ingest pipelines]

  Env -->|OIDC_ISSUER_URL set| OIDC
  Env -->|Otherwise OTLP_AUTH_TOKEN set| Static
  Env -->|Neither set| Open
  OIDC --> Config
  Config --> Receiver
  Config --> Provider
  Static --> Bearer
  Bearer --> Receiver
  Open --> Receiver
  Receiver --> Pipeline
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into add-oidc-otlp-a..." | Re-trigger Greptile

Comment thread docker/otel-collector/entrypoint.sh
Comment thread packages/otel-collector/builder-config.yaml
arj22 and others added 2 commits August 3, 2026 21:23
Addresses review feedback on hyperdxio#2788:
- entrypoint.sh: oidcauthextension requires a non-empty audience unless
  ignore_audience is set. Previously, setting OIDC_ISSUER_URL without
  OIDC_AUDIENCE would load a config that fails the extension's own
  validation, crashing the collector with a less obvious error. Now
  checked explicitly with a clear message before that happens.
- .changeset/add-oidc-otlp-auth.md: this is a user-facing change to a
  published package (@hyperdx/otel-collector), which AGENTS.md requires
  a changeset for. Missed in the initial commit.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@pulpdrew
pulpdrew requested a review from wrn14897 August 4, 2026 18:49
@arj22

arj22 commented Aug 4, 2026

Copy link
Copy Markdown
Author

@pulpdrew This looks stuck on pending workflow approval, not code — Docker Build/Main/Knip/PR Triage are all action_required (first-time-contributor gate), so the test suite hasn't actually run yet.

Mind approving the pending runs when you get a chance?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant