fix(request): escape literal '+' when rebuilding query parameters #8006
All Vouch review confidence checks passed
Residual risk 0.10 = Change Risk (0.26) × (1 − Review Confidence (0.64)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.26 · 37 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.35 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.218
Real PR Conversation Timeline
2 items
Approved
LGTM. UriUtils.encodeQueryParam delegates to encodeUriComponent, whose allowed set for query parameters includes +, so a literal plus survived re-encoding and was decoded as a space upstream. Escaping it to %2B after encoding is correct, and % itself is already encoded to %25, so there is no double-encoding hazard.
The test covers all three shapes in one assertion set: pre-encoded %2B, a raw + that must become %20, and an added parameter containing +. Good coverage.
Aias00
Duansg
What
When a rule has a
parameterconfig,RequestPluginrebuilds the query from decoded values withUriUtils.encodeQueryParam, which leaves+unescaped. Because the URI is then built withbuild(true), a literal plus reaches the upstream as a raw+, and the upstream decodes it as a space.| Input | Before | After |
|---|---|---|
|
q=a%2Bb|q=a+b(decoded asa b) |q=a%2Bb||
addParameters: c+d|added=c+d(decoded asc d) |added=c%2Bd|How
After
encodeQueryParam, also replace+with%2Bfor both keys and values. Valueless parameters (nullvalues) are left unchanged.Scope
parameterconfig go through this code. Header-only and cookie-only rules, and path encoding, are unchanged.String.replaceper component, and it allocates nothing when the string has no+.Tests
RequestPluginTest#testParameterRulePreservesLiteralPlus.shenyu-plugin-request: 33 tests pass, and checkstyle passes.Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.