dubbo-go-bot opened a new pull request, #814: URL: https://github.com/apache/dubbo-go-pixiu/pull/814
## 🔄 Upstream Sync from Community Fork This PR automatically syncs changes from the community fork to the upstream repository. ### Original Contribution - **Author**: @Aetherance - **Original PR**: https://github.com/dubbo-go-pixiu/dubbo-go-pixiu/pull/38 - **Merged at**: 2025-11-23 03:53:22 UTC ### Original PR Description --- Some Pixiu filters have complex configurations (maps, slices, nested structs). Passing the factory.cfg pointer directly can cause in-flight requests to read inconsistent or modified configs when FilterManager.ReLoad() updates factory instances at runtime, violating the HttpFilterFactory interface contract. This commit implements DeepCopy() for complex filter configs and updates PrepareFilterChain to use it. Each filter instance now has its own independent config, preventing runtime inconsistencies. Affected files: - pkg/filter/auth/jwt/jwt.go - pkg/filter/authority/authority.go - pkg/filter/authority/config.go - pkg/filter/cors/cors.go - pkg/filter/csrf/csrf.go - pkg/filter/event/event.go - pkg/filter/failinject/filter.go - pkg/filter/http/grpcproxy/grpc.go - pkg/filter/mcp/mcpserver/filter.go - pkg/filter/sentinel/circuitbreaker/circuit_breaker.go - pkg/filter/sentinel/config.go - pkg/filter/sentinel/ratelimit/rate_limit.go - pkg/model/mcpserver.go **What this PR does**: - Implements `DeepCopy()` for complex filter configurations. - Updates `PrepareFilterChain` in affected filters to use `DeepCopy()` instead of directly passing `factory.cfg`. - Ensures each filter instance has an independent copy of its configuration, preventing runtime inconsistencies during hot reload. - Adds comments explaining deep copy usage and runtime safety. **Which issue(s) this PR fixes**: Fixes #795 **Special notes for your reviewer**: - Only applies deep copy to filters with complex configs (maps, slices, nested structs). - Does not affect filters where shallow copy is sufficient. - Reviewers should verify that all `DeepCopy()` implementations correctly handle nested structures. **Does this PR introduce a user-facing change?**: NONE ```release-note None ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Prevented shared mutable configuration between factories and filters by using independent configuration copies, reducing runtime config mutation issues. * **Refactor** * Added comprehensive deep-copy support across filter and model configurations so each filter instance receives an isolated config, improving stability and data safety. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- All commits preserve original authorship. **Note**: Auto-created when PR #38 was merged into `dubbo-go-pixiu/dubbo-go-pixiu:develop`. cc @Aetherance -- 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]
