From: Vsevolod Stakhov Date: Wed, 10 Jan 2018 19:17:10 +0000 (+0000) Subject: [Fix] Sanitize IP in history redis X-Git-Tag: 1.7.0~296 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4eb85b3b6ab7d039a71b53f4f1a972ee33d5ed2d;p=rspamd.git [Fix] Sanitize IP in history redis --- diff --git a/src/plugins/lua/history_redis.lua b/src/plugins/lua/history_redis.lua index 6e26bc06f..abeadc801 100644 --- a/src/plugins/lua/history_redis.lua +++ b/src/plugins/lua/history_redis.lua @@ -75,7 +75,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