Open Source
Apache OpenTelemetry
OpenTelemetry Java
Baggage header parsing could discard valid members after encountering invalid percent-encoded entries.
Pull RequestOriginal Issue
- Baggage header parsing could fail recovery when invalid percent-encoded entries appeared.
- The parser needed to reject malformed entries without losing valid baggage members.
Root Cause Analysis
- Parser recovery treated malformed percent encoding too broadly.
- Valid members were not preserved cleanly after an invalid entry was encountered.
Investigation Process
- Reduced the failing input to mixed valid and invalid baggage entries.
- Compared expected parser recovery behavior with actual member preservation.
Fix Implementation
- Adjusted parser recovery to preserve valid entries while rejecting malformed ones.
- Kept the behavior narrow so the patch did not change unrelated header parsing semantics.
Regression Tests
- Added focused tests around invalid percent-encoded baggage members.
- Validated behavior across Linux, macOS, and Windows CI.
Lessons Learned
- Parser fixes are often about recovery semantics, not only accepting or rejecting input.
- A small open-source patch needs a narrow behavioral claim and strong regression coverage.