cloudbase-ai opened a new pull request, #7903:
URL: https://github.com/apache/shenyu/pull/7903
Fixes #6476.
When response field extraction returns no value,
`CryptorResponsePlugin.fieldErrorParse` currently returns the original body. A
stale `fieldNames` rule can therefore silently bypass the configured
transformation.
Throw the existing `ResponsiveException` with
`CRYPTOR_RESPONSE_ERROR_CONFIGURATION` (`-116`) and `[fieldNames]`, matching
the request cryptor's missing-field handling. The existing response error
handler writes the configured ShenYu error result before the buffered body is
emitted.
Add tests that write actual downstream response bodies through the plugin
and its response decorator. Six regression cases cover encryption/decryption
with missing top-level, nested and multiple fields; they reproduce the
passthrough before this change and now verify the error code/message, absence
of the original confidential marker and corrected Content-Length. Four controls
use generated RSA keys to verify successful `field` and `all`
encryption/decryption.
### Compatibility and scope
Routes that previously relied on missing-field passthrough now receive a
configuration error and should correct or narrow their rules. This change
covers the buffered `writeWith` conversion path. The shared response
decorator's streaming `writeAndFlushWith` conversion bypass remains a separate
follow-up; this PR does not claim to enforce transformations on streaming
responses.
### Validation
All 33 tests in the cryptor module pass, including the existing request, RSA
and JSON tests. The selected reactor passes Checkstyle and Apache RAT:
```sh
./mvnw -B -ntp -nsu \
-pl shenyu-plugin/shenyu-plugin-security/shenyu-plugin-cryptor -am verify \
-Dtest=CryptorResponsePluginTest,CryptorRequestPluginTest,RSAStrategyTest,JsonUtilTest
\
-Dsurefire.failIfNoSpecifiedTests=false \
-Djacoco.skip=true -Dmaven.javadoc.skip=true
```
The full repository test suite and deployment end-to-end tests were not run.
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.
- [ ] Your local test passed `./mvnw clean install
-Dmaven.javadoc.skip=true`. Focused verification is listed above.
--
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]