Skip to content

[Task] register the sensitive word plugin in the admin (db rows + rule form) and bound the inspected body #7154

Description

@HY-love-sleep

Description

The sensitive word plugin is proposed in #7153: the plugin module, the starter, the rule handle
(SensitiveWordHandle) and PluginEnum.SENSITIVE_WORD are all in that PR, and the dictionary is read
from a redis set (default key shenyu:sensitive:words).

What #7153 deliberately does not contain is the registration data, so as of now the plugin cannot be
reached from the admin: there is no plugin row, no plugin_handle rows (neither the redis connection
nor the rule level settings), and no resource rows, which means no menu entry and no rule form.

This issue tracks that work. It will be done in a follow-up PR once #7153 is merged, so that the review
of the plugin itself stays focused on the plugin implementation.

TODO

db/init + db/upgrade

  • db/init/mysql/schema.sql
  • db/init/pg/create-table.sql
  • db/init/oracle/schema.sql
  • db/init/ob/schema.sql
  • db/init/og/create-table.sql
  • shenyu-admin/src/main/resources/sql-script/h2/schema.sql
  • db/upgrade/2.7.1-upgrade-2.7.2-{mysql,pg,oracle,ob,og}.sql and the upgrade guide entry

for every dialect, the same set of rows:

  • the plugin row: name sensitiveWord, role Ai, sort 197
  • the plugin_handle rows: the redis connection (url / password / database) and the rule level
    settings (redisKey, refreshIntervalSeconds, failClosed)
  • the resource rows: the menu entry and its children
  • namespace_plugin_rel if the plugin has to be enabled for the default namespace

Console

  • the rule form for the handle above, so that the dictionary key, the refresh interval and the fail
    strategy can be configured without editing sql

Body size

  • a bound on the inspected body (maxBodySize), raised in the review of [type:feat] add the sensitive word plugin #7153: decide what happens
    when the body exceeds it (skip the scan and warn, or reject) and how that interacts with
    failClosed

Related

  • [type:feat] add the sensitive word plugin #7153 - the plugin itself
  • When the plugin config changes the redis connection is rebuilt and the previous lettuce connection is
    not released, because RedisConnectionFactory exposes no destroy() yet. This is pre-existing
    (AiTokenLimiterPluginHandler has the same shape) and will be a separate small PR against
    shenyu-infra/shenyu-infra-redis.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions