diff mod_firewall/conditions.lib.lua @ 2362:c065ab67d807

mod_firewall: INSPECT: Emit compilation error when the given stanza path is used for comparison but doesn't return a string
author Matthew Wild <mwild1@gmail.com>
date Tue, 15 Nov 2016 14:57:40 +0000
parents 6848297cf40a
children 12b78170b76c
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua	Tue Nov 15 09:01:03 2016 +0100
+++ b/mod_firewall/conditions.lib.lua	Tue Nov 15 14:57:40 2016 +0000
@@ -112,6 +112,9 @@
 function condition_handlers.INSPECT(path)
 	if path:find("=") then
 		local query, is_pattern_match, value = path:match("(.-)(~?)=(.*)");
+		if not(query:match("#$") or query:match("@[^/]+")) then
+			error("Stanza path does not return a string (append # for text content or @name for value of named attribute)", 0);
+		end
 		if is_pattern_match ~= "" then
 			return ("stanza:find(%q):match(%q)"):format(path:match("(.-)~=(.*)"));
 		else