Repository navigation
Commit 380afb5
authored
fix(sdk): percent-encode request param names and values in query strings (#7492)
RequestParamParameterProcessor appended parameter keys and values
into the URL verbatim, so reserved characters were interpreted as
URL syntax instead of parameter data: a value like "a&admin=true"
was sent as one logical parameter becoming two, and spaces, '=' and
'%' could produce malformed or differently parsed URLs.
Encode both the key and the value with UriUtils.encodeQueryParam
before appending. Plain alphanumeric values are unchanged, and the
map-valued RequestParam branch is covered as well. Regression tests
use values with reserved characters, spaces, and a map with reserved
keys and values (red on the previous code, which appended them raw).
Fixes #7464
Co-authored-by: Sean-Walker0 <[email protected]>1 parent 1797bd3 commit 380afb5
2 files changed
Lines changed: 30 additions & 1 deletion
File tree
- shenyu-sdk/shenyu-sdk-spring/src
- main/java/org/apache/shenyu/sdk/spring/annotation
- test/java/org/apache/shenyu/sdk/spring/annotation
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
| |||
61 | 63 | | |
62 | 64 | | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
65 | 69 | | |
66 | 70 | | |
67 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
56 | 81 | | |
57 | 82 | | |
58 | 83 | | |
| |||
0 commit comments