feat(otel-collector): add OIDC bearer token auth for the OTLP receiver - #2788
feat(otel-collector): add OIDC bearer token auth for the OTLP receiver#2788arj22 wants to merge 3 commits into
Conversation
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 detectedLatest commit: 251d9e9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
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 |
|
@arj22 is attempting to deploy a commit to the HyperDX Team on Vercel. A member of the Team first needs to authorize it. |
Greptile SummaryThe PR adds opt-in OIDC bearer-token validation to the standalone OTLP receiver while preserving static-token authentication as the fallback.
Confidence Score: 5/5The 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.
|
| 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
Reviews (3): Last reviewed commit: "Merge branch 'main' into add-oidc-otlp-a..." | Re-trigger Greptile
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 This looks stuck on pending workflow approval, not code — Mind approving the pending runs when you get a chance? |
Summary
Adds
oidcauthextensionas 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), checkingiss/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 needsissuer_urlandaudience.Changes:
packages/otel-collector/builder-config.yaml: addoidcauthextensionto the OCB build manifest (same version pin pattern as the existingbearertokenauthextensionentry)docker/otel-collector/config.standalone.oidc.yaml: new file, mirrorsconfig.standalone.auth.yaml's structure --OIDC_ISSUER_URL/OIDC_AUDIENCEenv vars configure the extension on both OTLP protocols (grpc + http)docker/otel-collector/entrypoint.sh: include the new config file whenOIDC_ISSUER_URLis set; otherwise fall back toOTLP_AUTH_TOKENas before. The two are treated as mutually exclusive (both configure the same receiver'sauth.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 thedevandprodimage stages, alongside the existing standalone config filesValidation: ran a local
docker build -f docker/otel-collector/Dockerfile --target ocb-builder .and confirmed the extension compiles intootelcol-hyperdxand appears incomponentsoutput (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 aCUSTOM_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