fix: tonumber

This commit is contained in:
xiaobing.wang
2025-01-20 18:16:53 +08:00
parent c0dfa51925
commit 41888dcff7
2 changed files with 23 additions and 2 deletions

View File

@@ -0,0 +1,21 @@
package = "kong-safeline"
version = "1.0.3-1"
source = {
url = "git://github.com/xbingW/kong-safeline.git"
}
description = {
summary = "Kong plugin for Chaitin SafeLine Web Application Firewall",
homepage = "https://github.com/xbingW/kong-safeline",
license = "Apache License 2.0",
maintainer = "Xiaobing Wang <xiaobing.wang@chaitin.com>"
}
dependencies = {
"lua-resty-t1k >= 1.1.5"
}
build = {
type = "builtin",
modules = {
["kong.plugins.safeline.handler"] = "kong/plugins/safeline/handler.lua",
["kong.plugins.safeline.schema"] = "kong/plugins/safeline/schema.lua"
}
}

View File

@@ -34,11 +34,11 @@ function SafelineHandler:access(conf)
if not ok then
kong.log.err("failed to detector req: ", err)
end
if result then
if result and result.status then
if result.action == t1k_constants.ACTION_BLOCKED then
local msg = fmt(blocked_message, result.status, result.event_id)
kong.log.debug("blocked by safeline: ",msg)
return kong.response.exit(result.status, msg)
return kong.response.exit(tonumber(result.status), msg)
end
end
end