From ac7464b6a6eb52761043987c15a3e21bec510911 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 10 Jan 2018 19:17:10 +0000 Subject: [PATCH] [Fix] Sanitize IP in history redis --- src/plugins/lua/history_redis.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index ad65184b9..8489c26f0 100644 --- a/src/plugins/lua/history_redis.lua +++ b/src/plugins/lua/history_redis.lua @@ -73,7 +73,13 @@ local function normalise_results(tbl, task) tbl.subject = task:get_header('subject') or 'unknown' tbl.size = task:get_size() - tbl.ip = tostring(task:get_from_ip() or 'unknown') + local ip = task:get_from_ip() + if ip and ip:is_valid() then + tbl.ip = tostring(ip) + else + tbl.ip = 'unknown' + end + tbl.user = task:get_user() or 'unknown' end -- 2.39.5