Icesource opened a new pull request, #16570:
URL: https://github.com/apache/dubbo/pull/16570

   ## What is the purpose of the change?
   
   A DTO declared only through an array (for example, `Payload[] read()`) is 
not automatically trusted: `SerializeSecurityConfigurator.checkClass` records 
the array class and returns without visiting its component. With Hessian2 and 
`STRICT` checking, the provider can therefore fail to serialize its own 
response.
   
   Visit `clazz.getComponentType()` through the existing class traversal before 
returning for an array. This discovers the component's fields and nested 
arrays, reuses the existing visited-type cache for recursive models, and keeps 
the configured class/package trust policy.
   
   Fixes #16569
   
   ### Regression tests
   
   `SerializeSecurityConfiguratorTest.testArrayComponentTypes` covers four 
independent paths:
   
   - An array parameter.
   - An array return value.
   - A multidimensional array return value.
   - An array field inside a returned DTO.
   
   Each case starts with a fresh framework, enables `STRICT`, verifies that the 
component is initially rejected, registers the service, then verifies that the 
component is accepted and its nested field type is discovered. An unrelated 
class remains rejected. The fixture includes a recursive array field to 
exercise termination.
   
   ### Validation
   
   - Before the production fix: all four new cases fail with `ArrayPayload is 
not in allow list`; the 18 existing configurator tests pass.
   - After the fix, on JDK 17: `mvn -B -ntp -pl dubbo-common -am test` succeeds 
— 1,182 tests, 0 failures, 0 errors, 10 skipped. This includes the module's 
Spotless checks.
   - Real loopback RPC, `injvm=false`, official Dubbo 3.3.6: the issue's 
Hessian2 + STRICT reproduction fails before the fix and succeeds when the 
patched `SerializeSecurityConfigurator` is placed ahead of the official 
artifact on the classpath.
   
   The complete standalone RPC reproduction and its serializer/mode controls 
are in https://github.com/apache/dubbo/issues/16569.
   
   ## Checklist
   
   - [x] Make sure there is a [GitHub 
issue](https://github.com/apache/dubbo/issues/16569) for the change.
   - [x] Write a pull request description that explains what changes, how, and 
why.
   - [x] Write necessary unit tests to verify the correction.
   - [ ] GitHub Actions: awaiting the upstream workflow result; local 
validation is recorded 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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [PR] fix: auto-trust arra... Icesource (via GitHub) via notifications

Reply via email to