Fix baggage parsing for invalid percent-encoded members#8480
Conversation
90736f6 to
f8d2245
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8480 +/- ##
============================================
- Coverage 78.54% 78.53% -0.01%
- Complexity 8468 8473 +5
============================================
Files 1008 1008
Lines 28824 28833 +9
Branches 3569 3570 +1
============================================
+ Hits 22639 22644 +5
- Misses 5342 5343 +1
- Partials 843 846 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| decodedValue = decodeValue(value); | ||
| metadataValue = decodeValue(metadataValue); | ||
| } catch (IllegalArgumentException e) { | ||
| return; |
There was a problem hiding this comment.
Could be good to log a warning here.
There was a problem hiding this comment.
I looked into this, but left it unchanged since the current parsing behavior appears to favor ignoring invalid baggage and continuing. Happy to update this if logging is preferred.
There was a problem hiding this comment.
Isn't the current parsing behavior to throw an exception on invalid baggage?
IMO adding a warning level log about invalid baggage fields makes sense here - that will still let the program continue, but will inform the user that there probably is some invalid encoding in the baggage data.
f8d2245 to
12bf01b
Compare
Description
Currently, an invalid percent-encoded baggage member can cause parsing of the remaining members in the same baggage header to abort.
For example:
When parsing
bad=va%lue, percent decoding throws anIllegalArgumentException, preventing subsequent valid members from being processed.This change skips only the invalid member and continues processing the remaining members in the header.
A regression test has been added to verify that valid members are preserved when another member contains invalid percent encoding.
Testing