Skip to content

opentelemetry-api: refine traceparent parsing - #5818

Merged
xrmx merged 7 commits into
open-telemetry:mainfrom
herin049:fix/traceparent-parsing
Oct 26, 2026
Merged

xrmx merged 7 commits into
open-telemetry:mainfrom
herin049:fix/traceparent-parsing

Conversation

@herin049

Copy link
Copy Markdown
Contributor

Description

Refines traceparent parsing to accept reasonable input sizes.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

See contributing.md for styleguide, changelog guidelines, and more.

  • 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
  • This requires the following PR in contrib:

@herin049
herin049 requested a review from a team as a code owner October 23, 2026 19:24
@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Merged · refreshed 2026-10-26 09:22 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@aabmass aabmass left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Comment thread opentelemetry-api/src/opentelemetry/trace/propagation/tracecontext.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The changes are narrowly scoped, include targeted regression coverage, and have no identified blocking issues.

No open issues 🎉

What changed in this PR

This PR hardens trace-context extraction in opentelemetry-api by limiting traceparent headers to 512 characters and refining suffix and whitespace matching.

Changes:

  • Reject oversized headers with a warning before parsing.
  • Adjust the parsing expression while preserving accepted inputs within the limit.
  • Add length-boundary and whitespace/suffix regression tests, plus a changelog entry.
File Description
opentelemetry-api/​tests/​trace/​propagation/​test_tracecontexthttptextformat.py Adds boundary and parsing regression tests.
opentelemetry-api/​src/​opentelemetry/​trace/​propagation/​tracecontext.py Enforces the length limit and refines matching.
.changelog/​5818.fixed Documents the extraction limit.

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this to Approved PRs in Python PR digest Oct 26, 2026
@xrmx
xrmx added this pull request to the merge queue Oct 26, 2026
Merged via the queue into open-telemetry:main with commit faa72da Oct 26, 2026
580 checks passed
@github-project-automation github-project-automation Bot moved this from Approved PRs to Done in Python PR digest Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants