diff --git a/sdk/kong/kong-safeline-1.0.3-1.rockspec b/sdk/kong/kong-safeline-1.0.3-1.rockspec new file mode 100644 index 0000000..8431810 --- /dev/null +++ b/sdk/kong/kong-safeline-1.0.3-1.rockspec @@ -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 " +} +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" + } +} diff --git a/sdk/kong/kong/plugins/safeline/handler.lua b/sdk/kong/kong/plugins/safeline/handler.lua index dad3805..06da7bf 100644 --- a/sdk/kong/kong/plugins/safeline/handler.lua +++ b/sdk/kong/kong/plugins/safeline/handler.lua @@ -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