Skip to content

fix(configuration): percent-decode headers_list names and values - #5973

Open
mwear wants to merge 1 commit into
open-telemetry:mainfrom
mwear:decode-headers-list
Open

mwear wants to merge 1 commit into
open-telemetry:mainfrom
mwear:decode-headers-list

Conversation

@mwear

@mwear mwear commented Nov 26, 2026

Copy link
Copy Markdown
Member

Description

headers_list in a declarative configuration file is documented as matching the format of OTEL_EXPORTER_OTLP_HEADERS, whose values are percent-encoded. _parse_headers splits it without decoding, so Authorization=Bearer%20<token> is sent as Bearer%20<token>, while the same value in OTEL_EXPORTER_OTLP_HEADERS is sent as Bearer <token> because parse_env_headers calls unquote. Since the common pattern is headers_list: ${OTEL_EXPORTER_OTLP_HEADERS}, an auth header that works from the environment stops working once a config file is used, and the backend rejects it.

This decodes each name and value in headers_list with unquote, the same as parse_env_headers and _parse_attributes_list. Values from headers are used as written. unquote leaves a malformed sequence such as %zz unchanged, so that doesn't fail.

Fixes # (issue)

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • I am a human and not a bot
  • I have run tox -e precommit
  • I have run tox -e typecheck
  • I have run the relevant tests and linting tox environments

@mwear
mwear requested a review from a team as a code owner November 26, 2026 21:44
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Nov 26, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Waiting on reviewers · refreshed 2026-11-26 22:57 UTC

Review the latest changes.

Status above doesn't look right?
  • Just replied or pushed? Anything around or after the refresh time above may not be picked up yet — give it a few minutes.
  • Should this be with the author? Comment /dashboard route:author to route it back.
  • Anything wrong — including the routing? Report it with what you expected; it helps us improve the dashboard.

headers_list uses the OTEL_EXPORTER_OTLP_HEADERS format, so
Authorization=Bearer%20<token> must send Bearer <token>, as
parse_env_headers does for the environment variable. Struct header values
are used as written.
@mwear
mwear force-pushed the decode-headers-list branch from cf6e3c5 to 37a4cef Compare November 26, 2026 22:51

This branch has not been deployed

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant