lymerin opened a new pull request, #7449:
URL: https://github.com/apache/shenyu/pull/7449

   Fixes #7441
   
   ### Problem
   
   `UriUtils.getPathWithParams()` combines `getRawPath()` with `getQuery()`, 
which decodes percent-encoded query parameters. Both the relative redirect and 
internal `fallback:` branches compare this result against the raw configured 
fallback target.
   
   For example, a request to `/fallback?reason=a%26b` becomes 
`/fallback?reason=a&b` during comparison. The identical configured target is 
therefore treated as different, bypassing the self-target guard and allowing a 
redirect or internal dispatch back to the same URI.
   
   The same mismatch also causes false positives: a request containing `a%26b` 
is incorrectly treated as identical to a target containing `a&b`, skipping the 
configured fallback.
   
   ### Changes
   
   - Use `getRawQuery()` instead of `getQuery()` so both sides of the 
comparison preserve percent encoding.
   - Add utility tests for encoded query parameters.
   - Add regression tests for both fallback branches, covering encoded 
self-targets, plain queries, requests without a query, and different targets 
whose decoded queries match.
   
   The production change is limited to one line in `UriUtils`.
   
   ### Validation
   
   Passed targeted tests using Java 17 and the Maven wrapper: 25 tests, zero 
failures or errors. Checkstyle and Apache RAT checks also passed.
   
   Make sure that:
   
   - [x] You have read the [[contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide)](https://shenyu.apache.org/community/contributor-guide).
   - [x] You submit test cases (unit or integration tests) that back your 
changes.
   - [x] Your local test passed `./mvnw clean install 
-Dmaven.javadoc.skip=true`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to