Restrict space-only keys (#6431)
This commit is contained in:
parent
0d2d67efe4
commit
ca798212a2
|
@ -127,7 +127,7 @@ public final class W3CBaggagePropagator implements TextMapPropagator {
|
|||
* @return whether the name is valid.
|
||||
*/
|
||||
private static boolean isValidBaggageKey(String name) {
|
||||
return name != null && !name.isEmpty() && StringUtils.isPrintableString(name);
|
||||
return name != null && !name.trim().isEmpty() && StringUtils.isPrintableString(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -448,6 +448,7 @@ class W3CBaggagePropagatorTest {
|
|||
.put("\2ab\3cd", "wacky key nonprintable")
|
||||
.put(null, "null key")
|
||||
.put("nullvalue", null)
|
||||
.put(" ", "key is only space")
|
||||
.build();
|
||||
W3CBaggagePropagator propagator = W3CBaggagePropagator.getInstance();
|
||||
Map<String, String> carrier = new HashMap<>();
|
||||
|
|
Loading…
Reference in New Issue