This is an automated email from the ASF dual-hosted git repository.
nic-6443 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new d55f6d310 fix(ua-restriction): return false when UA matches the
deny_list (#13869)
d55f6d310 is described below
commit d55f6d310d3b6451d08d0074505e9d2a08e0cc1e
Author: Arjen10 <[email protected]>
AuthorDate: Wed Aug 26 14:46:12 2026 +0800
fix(ua-restriction): return false when UA matches the deny_list (#13869)
---
apisix/plugins/ua-restriction.lua | 3 ++-
t/plugin/ua-restriction.t | 24 ++++++++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/apisix/plugins/ua-restriction.lua
b/apisix/plugins/ua-restriction.lua
index bf28685dd..9a5149d63 100644
--- a/apisix/plugins/ua-restriction.lua
+++ b/apisix/plugins/ua-restriction.lua
@@ -109,7 +109,8 @@ local function check_with_deny_list(user_agents, denylist)
if type(user_agents) == "table" then
for _, v in ipairs(user_agents) do
- if lrucache_deny(v, denylist, check, v) then
+ -- check function return false when UA matches the deny_list
+ if not lrucache_deny(v, denylist, check, v) then
return false
end
end
diff --git a/t/plugin/ua-restriction.t b/t/plugin/ua-restriction.t
index 56f07b39b..f4831cd55 100644
--- a/t/plugin/ua-restriction.t
+++ b/t/plugin/ua-restriction.t
@@ -759,3 +759,27 @@ passed
GET /hello
--- response_body
hello world
+
+
+
+=== TEST 34: hit route and multiple user-agents not in denylist
+--- request
+GET /hello
+--- more_headers
+User-Agent:foo/bar
+User-Agent:baz/qux
+--- error_code: 200
+--- response_body
+hello world
+
+
+
+=== TEST 35: hit route and multiple user-agents all in denylist
+--- request
+GET /hello
+--- more_headers
+User-Agent:my-bot1
+User-Agent:my-bot1-extra
+--- error_code: 403
+--- response_body
+{"message":"Not allowed"}