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

   ### Current behavior
   
   Plugin search combines exclusions across `name` and `role` with `OR`:
   
   ```sql
   name NOT LIKE :excluded OR role NOT LIKE :excluded
   ```
   
   For the seeded plugin `name='divide', role='Proxy'`, excluding `divide` 
still returns the plugin because `role NOT LIKE '%divide%'` is true. Excluding 
a role likewise retains its plugins whenever their names do not contain that 
role. A row is removed only if **both** columns contain the excluded term.
   
   ### Locations
   
   - 
[plugin-sqlmap.xml:255–260](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/resources/mappers/plugin-sqlmap.xml#L255)
   - 
[namespace-plugin-rel-sqlmap.xml:179–184](https://github.com/apache/shenyu/blob/66d7d954ca37d651a5ad916f988a8081157a7ab4/shenyu-admin/src/main/resources/mappers/namespace-plugin-rel-sqlmap.xml#L179)
   
   `PluginServiceImpl.searchByCondition()` initializes the `keyword!excluded` 
syntax before calling the mapper. `NamespacePluginQueryCondition` inherits the 
same exclusion field, and its paged search uses the namespace mapper.
   
   ### Expected behavior / impact
   
   **P3 / Low.** Exclusion search should remove a plugin when either searchable 
field contains the excluded term, i.e. negate the positive predicate `(name 
LIKE term OR role LIKE term)`. This affects administrative search results and 
pagination, rather than gateway traffic.
   
   ### Reproduction and evidence
   
   1. Use plugins `(divide, Proxy)` and `(request, HttpProcess)`; these 
name/role combinations exist in the H2 seed data.
   2. Run a plugin search with `excluded='divide'` (or the ordinary plugin 
search keyword `!divide`).
   3. Expected: `request` only. Current predicate: both `divide` and `request`.
   
   A local SQL predicate probe extracted each exclusion clause directly from 
its current MyBatis XML and executed it against these two rows in an in-memory 
SQLite database. Both returned the excluded plugin. The probe verifies standard 
SQL boolean semantics; a full running Admin/MyBatis request was not exercised.
   
   ### Suggested fix
   
   Use `AND` between the negative predicates in both mappers, or an equivalent 
explicit negation of the positive predicate. Preserve intended handling of 
nullable fields and existing include/exclude keyword semantics.
   
   ### Related existing work
   
   Searched the 3,074-issue baseline, 85 open PR titles, and live 
plugin/excluded searches. #6614 is a namespace-plugin enabled result-map typo; 
#6717 concerns the separate `nameExistedExclude` query and a missing column. 
Neither addresses boolean exclusion logic in these `searchByCondition` 
statements. The two affected mappers are grouped here because they share the 
same root cause.
   
   ### Environment
   
   Apache ShenYu `2.7.2-SNAPSHOT`, 
`master@66d7d954ca37d651a5ad916f988a8081157a7ab4`. Unit-test and CI issue 
categories excluded.
   


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