Skip to content

fix: reject invalid traceparent flags#4538

Open
immanuwell wants to merge 1 commit into
linkerd:mainfrom
immanuwell:fix-traceparent-flags
Open

fix: reject invalid traceparent flags#4538
immanuwell wants to merge 1 commit into
linkerd:mainfrom
immanuwell:fix-traceparent-flags

Conversation

@immanuwell
Copy link
Copy Markdown

What

W3C v00 traceparent has trace-flags = 2 HEXDIGLC. The parser accepted ...-0102, and ...- could hit decoded[0] after decoding an empty string. Tiny parser footgun.

This checks the flags length before decode and adds regression cases.

Repro

Before this patch, add the new invalid flag cases and run:

cargo test -p linkerd-trace-context propagation::w3c::tests::w3c_context_invalid_flags -- --nocapture

It fails because ...-0102 is accepted. The empty flags case is also a real incoming HTTP header shape, no weird infra limit needed.

Validation

cargo fmt --check
cargo test -p linkerd-trace-context
cargo clippy -p linkerd-trace-context --all-targets -- -D warnings

Signed-off-by: immanuwell <pchpr.00@list.ru>
@immanuwell immanuwell requested a review from a team as a code owner May 22, 2026 04:28
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.

1 participant