hengyuss opened a new pull request, #6943:
URL: https://github.com/apache/shenyu/pull/6943
…ngs with {} (data loss)
<!-- Describe your PR here; e.g. Fixes #issueNo -->
Fixes #6845.
Log desensitization currently treats request bodies, response bodies, and
query strings as JSON. When the source is
not a JSON object, `JsonUtils.jsonToMap` returns an empty map, causing the
original content to be replaced with `{}`.
## Changes
- Preserve the original body when it is not a valid JSON object.
- Add a JSON parsing method that distinguishes parsing failures from valid
empty objects.
- Preserve unmatched JSON value types with `Map<String, Object>`.
- Handle query parameters separately instead of parsing them as JSON.
- Reuse `desensitizeSingleKeyword` for query parameter desensitization.
- Add regression tests for non-JSON bodies, JSON arrays, query parameters,
duplicate parameters, and malformed
encoding.
## Tests
- `JsonUtilsTest`
- `DataDesensitizeUtilsTest`
- Compilation of `shenyu-plugin-logging-common` and required modules
<!--
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 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]