Skip to content

Commit

Permalink
Restrict space-only keys (#6431)
Browse files Browse the repository at this point in the history
  • Loading branch information
tkmsaaaam committed May 9, 2024
1 parent 0d2d67e commit ca79821
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
Expand Up @@ -127,7 +127,7 @@ private static boolean baggageIsInvalid(String key, BaggageEntry baggageEntry) {
* @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);
}

/**
Expand Down
Expand Up @@ -448,6 +448,7 @@ void inject() {
.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<>();
Expand Down

0 comments on commit ca79821

Please sign in to comment.