diff options
author | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-01-07 14:46:56 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rspamd.com> | 2023-01-07 14:46:56 +0000 |
commit | 18030c9bbf8dec75709cba51781c074b2ba52268 (patch) | |
tree | 4706d1e60f9ba68632ee1bbc2de7f66386b2c49f /lualib/lua_verdict.lua | |
parent | ede28c7e6b5f6d1579ffdf29ec0d9e44ad2efa58 (diff) | |
download | rspamd-18030c9bbf8dec75709cba51781c074b2ba52268.tar.gz rspamd-18030c9bbf8dec75709cba51781c074b2ba52268.zip |
[Rework] Breaking: Do not report soft reject in history
We can have much more clear information if we store the real action in
case of `soft-reject`. In this case, we can just imply that a module
that has set this action is an action itself, such as:
* greylist
* ratelimit
* multimap
* antivirus rule name
This policy seems quite reasonable, as `soft reject` has no meaning on
its own.
Diffstat (limited to 'lualib/lua_verdict.lua')
-rw-r--r-- | lualib/lua_verdict.lua | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lualib/lua_verdict.lua b/lualib/lua_verdict.lua index 3ce7e0689..8f3f23ea9 100644 --- a/lualib/lua_verdict.lua +++ b/lualib/lua_verdict.lua @@ -186,4 +186,23 @@ exports.describe = function(verdict, what) return nil end +---[[[ +-- @function lua_verdict.adjust_passthrough_action(task) +-- If an action is `soft reject` then this function extracts a module that has set this action +-- and returns an adjusted action (e.g. 'greylist' or 'ratelimit'). +-- Otherwise an action is returned as is. +--]] +exports.adjust_passthrough_action = function(task) + local action = task:get_metric_action() + if action == 'soft reject' then + local has_pr,_,_,module = task:has_pre_result() + + if has_pr and module then + action = module + end + end + + return action +end + return exports
\ No newline at end of file |