-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add ai-prompt-guard plugin #12008
base: master
Are you sure you want to change the base?
Conversation
apisix/plugins/ai-prompt-guard.lua
Outdated
} | ||
|
||
function _M.check_schema(conf) | ||
return core.schema.check(schema, conf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to confirm the items in allow_patterns[]
and deny_patterns[]
, they should be a valid regex
you can call this function: https://github.com/openresty/lua-resty-core/blob/master/lib/resty/core/regex.lua#L639
apisix/plugins/ai-prompt-guard.lua
Outdated
if #conf.allow_patterns > 0 then | ||
local any_allowed = false | ||
for _, pattern in ipairs(conf.allow_patterns) do | ||
if ngx.re.find(content_to_check, pattern, "jou") then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the pattern
is not a plain text, it is a regex
the current way is wrong
@membphis Made changes |
Description
Fixes # (issue)
Checklist