[type:feat] register the sensitive word plugin in the admin - #7155
Merged
Merged
Conversation
- db/init: the plugin, plugin_handle, resource, permission, shenyu_dict and namespace_plugin_rel rows for mysql, ob, pg, og, oracle and the admin h2 script - db/upgrade: the 2.7.1 -> 2.7.2 scripts of the same dialects, listed in the upgrade guide - rule handle: `words` (separated by commas or by new lines) merged with the redis set of the rule, and `maxBodySize` for a body that is too large to scan - the declared Content-Length is checked before the body is buffered, so an oversized request is never read into memory; a body without a declared size is checked once it has been read - an oversized request is passed through unscanned with a warning, or rejected when the rule is failClosed - the dictionary cache is keyed by the rule words as well, and a rule change drops the cache of both the previous and the new configuration - the words of the rule are enforced even when the redis set cannot be read - README: the new fields, the registration and how to feed the dictionary
13 tasks
Aias00
approved these changes
Sep 22, 2026
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.
Motivation
#7153 added the sensitive word plugin, but the plugin was not registered in the admin: no
pluginrow and no
plugin_handlerows, so no console form and no menu entry. This is the follow up trackedin #7154.
What is added
1. The admin rows, for every dialect (
db/init/{mysql,ob,pg,og,oracle}plus the h2 script theadmin uses):
pluginrow (id67, roleAi, sort197, the order ofPluginEnum.SENSITIVE_WORD);plugin_handlerows: the redis client of the plugin (plugin level) and the five rule fields;resourcerows of the menu and the 10permissionrows binding them to the default role;failClosedoptions inshenyu_dict, so the console renders a select for it;namespace_plugin_relrow.db/upgrade/2.7.1-upgrade-2.7.2-{mysql,ob,og,oracle,pg}.sqlcarries the same rows for an existinginstallation, and
db/upgrade/upgrade-guide.mdlists the new pair.2.
wordson the rule. A small list can now be configured from the console form directly,separated by commas or by new lines, and it is merged with the redis set the rule points at. This
answers the request to support a simple word list from the configuration side: a large list still
belongs in redis, and the console renders
wordsas the generic single line input, so noshenyu-dashboardchange is involved.3.
maxBodySize. The largest body that is scanned, in bytes (0scans every body):Content-Lengthis checked before the body is buffered, so an oversized requestis never read into memory;
failClosed, for the deployments that would rather block than let unfiltered content through.Notes on the plugin changes
the same redis set with different words never share an automaton, and a changed word list is
compiled again. A rule change drops the cached dictionary of both the previous and the new handle.
which also softens the fail open default (a broken redis no longer means "no filtering at all" for
such a rule).
Not included
Uploading a word list file from the console. It would need a redis client inside
shenyu-admin(the admin has none today), an upload endpoint with its size limit, encoding and audit rules, plus a
component in the separate
shenyu-dashboardrepository. Redis remains the way to feed a large listand the module README documents it, so this is left out of the PR rather than half done — happy to
continue on it as a separate issue if it is wanted.
Testing
dto, no failure, checkstyle 0, RAT ok.
enforced while redis is down, and both
maxBodySizepolicies (including a body whose size is notdeclared).
org.h2.tools.RunScriptin MySQLmode) so the new rows are known to be valid, and every
INSERTof the touched files was checkedagainst the column count of its table, which is how a missing pair of date columns was caught
before the push.