You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "dubbo-go-bot (via GitHub)" <gi...@apache.org> on 2025/11/23 03:53:28 UTC

[PR] fix(filter): deep copy factory config for filters with complex configs to avoid pointer sharing [dubbo-go-pixiu]

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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(filter): deep copy factory config for filters with complex configs to avoid pointer sharing [dubbo-go-pixiu]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl merged PR #814:
URL: https://github.com/apache/dubbo-go-pixiu/pull/814


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(filter): deep copy factory config for filters with complex configs to avoid pointer sharing [dubbo-go-pixiu]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #814:
URL: https://github.com/apache/dubbo-go-pixiu/pull/814#issuecomment-3567449630

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go-pixiu&pullRequest=814) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&pullRequest=814&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go-pixiu&pullRequest=814&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go-pixiu&pullRequest=814&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go-pixiu&pullRequest=814&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.8% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go-pixiu&pullRequest=814&metric=new_duplicated_lines_density&view=list)  
     
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go-pixiu&pullRequest=814)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] fix(filter): deep copy factory config for filters with complex configs to avoid pointer sharing [dubbo-go-pixiu]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #814:
URL: https://github.com/apache/dubbo-go-pixiu/pull/814#issuecomment-3567461809

   ## [Codecov](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `0%` with `258 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 21.34%. Comparing base ([`26606a8`](https://app.codecov.io/gh/apache/dubbo-go-pixiu/commit/26606a8317ac79fb8ce826138a34908b62beae1c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`d7daafc`](https://app.codecov.io/gh/apache/dubbo-go-pixiu/commit/d7daafc301b5621cf0ea197db5b40a7cda849cbc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 88 commits behind head on develop.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [pkg/model/mcpserver.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Fmodel%2Fmcpserver.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL21vZGVsL21jcHNlcnZlci5nbw==) | 0.00% | [90 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/auth/jwt/jwt.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fauth%2Fjwt%2Fjwt.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9hdXRoL2p3dC9qd3QuZ28=) | 0.00% | [40 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/authority/config.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fauthority%2Fconfig.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9hdXRob3JpdHkvY29uZmlnLmdv) | 0.00% | [21 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/http/grpcproxy/grpc.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fhttp%2Fgrpcproxy%2Fgrpc.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9odHRwL2dycGNwcm94eS9ncnBjLmdv) | 0.00% | [20 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [.../filter/sentinel/circuitbreaker/circuit\_breaker.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fsentinel%2Fcircuitbreaker%2Fcircuit_breaker.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9zZW50aW5lbC9jaXJjdWl0YnJlYWtlci9jaXJjdWl0X2JyZWFrZXIuZ28=) | 0.00% | [17 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/sentinel/ratelimit/rate\_limit.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fsentinel%2Fratelimit%2Frate_limit.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9zZW50aW5lbC9yYXRlbGltaXQvcmF0ZV9saW1pdC5nbw==) | 0.00% | [17 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/failinject/filter.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Ffailinject%2Ffilter.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9mYWlsaW5qZWN0L2ZpbHRlci5nbw==) | 0.00% | [16 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/cors/cors.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fcors%2Fcors.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9jb3JzL2NvcnMuZ28=) | 0.00% | [11 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/csrf/csrf.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fcsrf%2Fcsrf.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9jc3JmL2NzcmYuZ28=) | 0.00% | [11 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [pkg/filter/sentinel/config.go](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&filepath=pkg%2Ffilter%2Fsentinel%2Fconfig.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cGtnL2ZpbHRlci9zZW50aW5lbC9jb25maWcuZ28=) | 0.00% | [11 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | ... and [3 more](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
   > :exclamation:  There is a different number of reports uploaded between BASE (26606a8) and HEAD (d7daafc). Click for more details.
   > 
   > <details><summary>HEAD has 1 upload less than BASE</summary>
   >
   >| Flag | BASE (26606a8) | HEAD (d7daafc) |
   >|------|------|------|
   >||1|0|
   ></details>
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff              @@
   ##           develop     #814       +/-   ##
   ============================================
   - Coverage    54.67%   21.34%   -33.33%     
   ============================================
     Files          671      245      -426     
     Lines        78658    15983    -62675     
   ============================================
   - Hits         43006     3412    -39594     
   + Misses       31981    12220    -19761     
   + Partials      3671      351     -3320     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [unittests](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `21.34% <0.00%> (?)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo-go-pixiu/pull/814?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org