aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorDmitriy Alekseev <1865999+dragoangel@users.noreply.github.com>2024-04-11 19:17:08 +0300
committerGitHub <noreply@github.com>2024-04-11 19:17:08 +0300
commit7d14e4af43ee1435b47a5d38b699b24bf598d4bf (patch)
tree8d208b815e3fdd8e5534ab1f86d9b64b6c46f072 /src/plugins
parent6b23b885eb56be6d3f6717a7c5e39f5da81c2d6d (diff)
downloadrspamd-7d14e4af43ee1435b47a5d38b699b24bf598d4bf.tar.gz
rspamd-7d14e4af43ee1435b47a5d38b699b24bf598d4bf.zip
[Enhancement] Exclude false positives of MIME_DOUBLE_BAD_EXTENSION
If we detected extension of the file and this extension is equal to the real extension then we should not pass second extension to check function as it will trigger false positive for MIME_DOUBLE_BAD_EXTENSION.
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/lua/mime_types.lua7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/plugins/lua/mime_types.lua b/src/plugins/lua/mime_types.lua
index 167ed38e2..71b6481d8 100644
--- a/src/plugins/lua/mime_types.lua
+++ b/src/plugins/lua/mime_types.lua
@@ -397,7 +397,12 @@ local function check_mime_type(task)
if ext2 then
local score1 = check_tables(ext)
local score2 = check_tables(ext2)
- check_extension(score1, score2)
+ -- Check if detected extension match real extension
+ if detected_ext and detected_ext == ext then
+ check_extension(score1, nil)
+ else
+ check_extension(score1, score2)
+ end
-- Check for archive cloaking like .zip.gz
if settings['archive_extensions'][ext2]
-- Exclude multipart archive extensions, e.g. .zip.001