liuqian1990 opened a new pull request, #6051:
URL: https://github.com/apache/shenyu/pull/6051

     🐛 Bug Fix - Commit Message
   
     fix: resolve namespace isolation issue in rule import functionality
   
     The rule import process was incorrectly triggering REFRESH events for all 
namespaces
     instead of only the target namespace, causing cross-namespace event 
pollution.
   
     **Problem:**
     - When importing rules to namespace A, all namespaces (A, B, C...) 
received REFRESH events
     - This was caused by using `syncAll()` which broadcasts to all namespaces
     - Violated namespace isolation principle
   
     **Solution:**
     - Replace `syncAll()` with `syncAllByNamespaceId()` in import controller
     - Ensure only the target namespace receives REFRESH events
     - Maintain proper namespace isolation during rule import operations
   
     **Files Changed:**
     - 
shenyu-admin/src/main/java/com/woo/shenyu/admin/controller/ConfigsExportImportController.java
   
     **Testing:**
     - ✅ Import rules to namespace A - only namespace A receives events
     - ✅ Other namespaces (B, C) are unaffected
     - ✅ Namespace isolation is maintained
   
     📋 GitHub Issue Description
   
     # Bug Report: Cross-Namespace Event Pollution During Rule Import
   
     ## 🐛 **Bug Description**
     When importing rules to a specific namespace, the system incorrectly 
triggers REFRESH events for rules in ALL namespaces instead of only the target 
namespace.
   
     ## 🔍 **Root Cause Analysis**
     The issue is in `ConfigsExportImportController.java` line 146:
     ```java
     // Problem: broadcasts to ALL namespaces
     syncDataService.syncAll(DataEventTypeEnum.REFRESH);
   
     The syncAll() method:
     1. Fetches rules from ALL namespaces via ruleService.listAll()
     2. Groups by namespace and sends events to each namespace
     3. Causes namespace B to receive REFRESH events when importing to 
namespace A
   
     🔧 Fix Applied
   
     Replace the problematic call with namespace-specific synchronization:
     // Solution: only sync target namespace
     syncDataService.syncAllByNamespaceId(DataEventTypeEnum.REFRESH, namespace);
   
     📊 Impact
   
     - Before: Cross-namespace event pollution
     - After: Proper namespace isolation
     - Affected Component: Rule import functionality
     - Severity: Medium (violates namespace isolation)
   
     ✅ Testing
   
     - Import rules to namespace A - only A receives events
     - Namespace B and C clients remain unaffected
     - WebSocket event filtering works correctly
     - No performance impact on other namespaces
   
     📁 Files Modified
   
     - 
shenyu-admin/src/main/java/com/woo/shenyu/admin/controller/ConfigsExportImportController.java
   
     🏷️ Labels
   
     - bug
     - namespace
     - websocket
     - data-sync
     - isolation
   
     ## 🚀 **Pull Request Title**
     fix: resolve namespace isolation issue in rule import functionality
   
   <!-- Describe your PR here; e.g. Fixes #issueNo -->
   
   <!--
   Thank you for proposing a pull request. This template will guide you through 
the essential steps necessary for a pull request.
   -->
   Make sure that:
   
   - [ ] You have read the [contribution 
guidelines](https://shenyu.apache.org/community/contributor-guide).
   - [ ] You submit test cases (unit or integration tests) that back your 
changes.
   - [ ] 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]

Reply via email to