[BUG] Plugin exclusion search retains matches because negative predicates use OR
Maintainers usually reply within 2 days
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
The bad predicate is in shenyu-admin/src/main/resources/mappers/plugin-sqlmap.xml around lines 255-260 and namespace-plugin-rel-sqlmap.xml around lines 179-184; start with the searchByCondition statements and how PluginServiceImpl.searchByCondition() passes the excluded value. Replace the OR between the negative name and role predicates with AND, or negate the combined positive match, in both mappers. Done when excluding 'divide' removes the (divide, Proxy) row from the seeded H2 data, keeps (request, HttpProcess), and nullable fields still behave as before.
Written by the indexing model from the issue text.
Description
Current behavior
Plugin search combines exclusions across name and role with OR:
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
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
- Use plugins
(divide, Proxy)and(request, HttpProcess); these name/role combinations exist in the H2 seed data. - Run a plugin search with
excluded='divide'(or the ordinary plugin search keyword!divide). - Expected:
requestonly. Current predicate: bothdivideandrequest.
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.
- Dominant language
- Java
- Stars
- 8.9k
- Forks
- 3.1k
- Avg merge
- 3d 19h
- Merged PRs (30d)
- 374
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/shenyu
-
refactor(dependencies): remove unused commons-io and commons-collections4 from shenyu-adminPossibly taken @konlue claimed this 3 days ago. Openpriority: medium type: dependencies type: refactor
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
apache/shenyu#7607 · 2 comments ·
Maintainers usually reply within 2 days
-
status: volunteer wanted
Difficulty 2/5 Under an hour Newbie friendliness 72/100
apache/shenyu#7510 · 2 comments ·
Maintainers usually reply within 2 days
-
[BUG] ApacheDubboPlugin NPE when DubboRuleHandle is absent/emptyPossibly taken @dengliming claimed this 28 days ago. Openplugin: apache-dubbo priority: medium type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/shenyu#6741 · 1 comment ·
Maintainers usually reply within 2 days
-
[BUG] Boolean tars parameter parsed via Byte.valueOf → NumberFormatExceptionMay be free again A pull request for this issue was closed without being merged. Openplugin: tars priority: medium type: bug
Difficulty 1/5 Under an hour Newbie friendliness 82/100
apache/shenyu#6736 · 1 comment ·
Maintainers usually reply within 2 days
-
[BUG] WebsocketDataHandler stores handlers in a static mutable EnumMap mutated by every constructorMay be free again A pull request for this issue was closed without being merged. Opendata-sync: websocket priority: medium type: bug
Difficulty 1/5 Under an hour Newbie friendliness 78/100
apache/shenyu#6732 · 1 comment ·
Maintainers usually reply within 2 days
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/rocketmq-dashboard#6896 ·
Maintainers usually reply within 3 days
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OpenIntegrationEngine/engine#496 ·
Maintainers usually reply within 1 day
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
SasanLabs/VulnerableApp#836 ·
Maintainers usually reply within 1 day
-
enhancement frontend
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
Albertinesilva/backend-engineering-journey-java-springboot#46 ·