Aias00 opened a new issue, #6826:
URL: https://github.com/apache/shenyu/issues/6826

   ## Description
   `SelectorServiceImpl.deleteByNamespaceId(List<String> ids, String 
namespaceId)` calls `selectorMapper.selectByIdSet(new TreeSet<>(ids))` whose 
SQL is `WHERE id IN (...)` with no `namespace_id`, and the eventual 
`deleteByIds` is `DELETE FROM selector WHERE id IN (...)`. `namespaceId` is 
passed only to event publishing, never to SELECT or DELETE. Sibling 
`selectByQuery`/`updateSelective` enforce `namespace_id`, confirming bug.
   
   Controller-exposed at `SelectorController:155`. The fetched selectors 
(unfiltered by namespace) also drive `unbindDiscovery` and the downstream 
`BatchSelectorDeletedEvent` rule cleanup, amplifying blast radius.
   
   ## Location
   - 
`shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/SelectorServiceImpl.java:297-303,633-636`
   - `shenyu-admin/src/main/resources/mappers/selector-sqlmap.xml:80-88` 
(`selectByIdSet`), `465-471` (`deleteByIds`)
   - 
`shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/SelectorController.java:152-156`
   
   ## Impact
   Cross-namespace selector deletion (and cascade 
unbindDiscovery/deleteSelector) — a user can tear down selectors in another 
namespace, removing routing configuration and bound discovery bindings. 
Requires authenticated admin with `system:plugin:delete`.
   
   ## Suggested fix
   Add `AND namespace_id = #{namespaceId}` to `selectByIdSet` and 
`deleteByIds`, or filter ids via a namespace-scoped select first.
   
   ## Related existing
   Distinct from H-2 (rule) and N2 (#6615) — different mapper file and 
operation.
   


-- 
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