comparison mod_firewall/actions.lib.lua @ 5538:40f8b9cc2065

mod_firewall: Improve error when mark name contains invalid characters
author Matthew Wild <mwild1@gmail.com>
date Thu, 08 Jun 2023 16:59:22 +0100
parents 4b9a7684ae02
children 1249ab2f797c
comparison
equal deleted inserted replaced
5537:4b9a7684ae02 5538:40f8b9cc2065
223 return ([[fire_event("firewall/marked/user", { 223 return ([[fire_event("firewall/marked/user", {
224 username = session.username; 224 username = session.username;
225 mark = %q; 225 mark = %q;
226 timestamp = current_timestamp; 226 timestamp = current_timestamp;
227 }); 227 });
228 ]]):format(idsafe(name)), { "timestamp" }; 228 ]]):format(assert(idsafe(name), "Invalid characters in mark name: "..name)), { "timestamp" };
229 end 229 end
230 230
231 function action_handlers.UNMARK_USER(name) 231 function action_handlers.UNMARK_USER(name)
232 return ([[fire_event("firewall/unmarked/user", { 232 return ([[fire_event("firewall/unmarked/user", {
233 username = session.username; 233 username = session.username;
234 mark = %q; 234 mark = %q;
235 }); 235 });
236 ]]):format(idsafe(name)); 236 ]]):format(assert(idsafe(name), "Invalid characters in mark name: "..name));
237 end 237 end
238 238
239 function action_handlers.ADD_TO(spec) 239 function action_handlers.ADD_TO(spec)
240 local list_name, value = spec:match("(%S+) (.+)"); 240 local list_name, value = spec:match("(%S+) (.+)");
241 local meta_deps = {}; 241 local meta_deps = {};