Merged
Conversation
🐛 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
moremind
previously approved these changes
Jul 15, 2025
Contributor
|
hi, fix ci, pls |
Aias00
approved these changes
Jul 19, 2025
Contributor
|
hi, add my wechat: aias00 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 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:
syncAll()which broadcasts to all namespacesSolution:
syncAll()withsyncAllByNamespaceId()in import controllerFiles Changed:
Testing:
📋 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.javaline 146: