monkeyDluffy6017 commented on code in PR #9841:
URL: https://github.com/apache/apisix/pull/9841#discussion_r1264810166
##########
apisix/plugins/ua-restriction.lua:
##########
@@ -128,12 +130,13 @@ function _M.access(conf, ctx)
return 403, { message = conf.message }
end
end
- local match = MATCH_NONE
+ local match
+
if type(user_agent) == "table" then
for _, v in ipairs(user_agent) do
if type(v) == "string" then
match = lrucache_useragent(v, conf, match_user_agent, v, conf)
- if match > MATCH_ALLOW then
+ if not match then
Review Comment:
The logic should be:
1. If one of the user agent match the allowlist, pass, else if it doesn't
match, continue, if the whole user agent
don't match the allowlist, deny.
3. If one of the user agent match the denylist, deny, else if it doesn't
match, continue, if the whole user agent
don't match the denylist, pass.
--
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]