Sean-Walker0 opened a new pull request, #7212:
URL: https://github.com/apache/shenyu/pull/7212

   <!-- Describe your PR here; e.g. Fixes #issueNo -->
   Fixes #6804
   
   `ComposableSignService#skipSignExchange` is evaluated on every signed 
request. Each call parsed the `%s-%s` format string three times via 
`String.format`, although the expected module pattern `pluginName-rpcType` only 
ever contains one of three fixed plugin names (springCloud, divide, websocket).
   
   This PR precomputes those plugin names into a static constant and replaces 
the three `String.format` equality checks with a single suffix comparison. 
Matching semantics are unchanged: skip when `module` equals `pluginName + "-" + 
rpcType` for one of the skip-sign plugins.
   
   <!--
   Thank you for proposing a pull request. This template will guide you through 
the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [x] You have read the [contribution 
guidelines](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 test -pl 
shenyu-plugin/shenyu-plugin-security/shenyu-plugin-sign -am` and `./mvnw 
checkstyle:check -pl shenyu-plugin/shenyu-plugin-security/shenyu-plugin-sign` 
(module-scoped; full build left to CI).
   
   ### Modifications
   
   - `shenyu-plugin-sign`: extract `SKIP_SIGN_PLUGIN_NAMES` constant; 
`skipSignExchange` now checks that `module` ends with `-rpcType` and the prefix 
is one of the skip-sign plugins, so only one string concatenation happens per 
call instead of three format-string parses.
   - Add `ComposableSignServiceTest` covering: supported plugins 
(`divide-http`, `springCloud-http`, `websocket-ws`), mismatched rpc types, 
unsupported plugins and malformed modules.
   
   ### Verifying this change
   
   - New unit tests: 4/4 passed.
   - Full `shenyu-plugin-sign` module test run: 57/57 passed, no regression 
(includes `SignServiceVersionOneTest` / `SignServiceVersionTwoTest`, which 
exercise the changed method indirectly).
   - Checkstyle on the module: passed.
   


-- 
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