summaryrefslogtreecommitdiffstats
path: root/test/functional
diff options
context:
space:
mode:
authorCarsten Rosenberg <c.rosenberg@heinlein-support.de>2019-01-29 20:22:41 +0100
committerCarsten Rosenberg <c.rosenberg@heinlein-support.de>2019-01-29 20:22:41 +0100
commit4e00e9f13988ad1fb7d9868810f8c04fb2834b9c (patch)
treeb5606b8839e54d30fbc4cd399d2a8bb50da2051a /test/functional
parent69ee9cf38003ca9acf5436b3a8d678387cae57fe (diff)
downloadrspamd-4e00e9f13988ad1fb7d9868810f8c04fb2834b9c.tar.gz
rspamd-4e00e9f13988ad1fb7d9868810f8c04fb2834b9c.zip
[Minor] mime_types - add filename whitelist
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/cases/105_mimetypes.robot6
-rw-r--r--test/functional/configs/maps/mime_types.wl1
-rw-r--r--test/functional/configs/mime_types.conf1
-rw-r--r--test/functional/messages/exe_attm.eml22
4 files changed, 30 insertions, 0 deletions
diff --git a/test/functional/cases/105_mimetypes.robot b/test/functional/cases/105_mimetypes.robot
index 54a9cb4bb..b9efd3e3c 100644
--- a/test/functional/cases/105_mimetypes.robot
+++ b/test/functional/cases/105_mimetypes.robot
@@ -55,6 +55,12 @@ Multipart Archive Extension
${result} = Scan Message With Rspamc ${TESTDIR}/messages/f.zip.001.eml
Should Not Contain ${result.stdout} MIME_ARCHIVE_IN_ARCHIVE
+Exe file, but name in filename_whitelist
+ ${result} = Scan Message With Rspamc ${TESTDIR}/messages/exe_attm.eml
+ Should Not Contain ${result.stdout} MIME_BAD_EXTENSION
+ Should Not Contain ${result.stdout} MIME_BAD_ATTACHMENT
+ Should Not Contain ${result.stdout} MIME_DOUBLE_BAD_EXTENSION
+
Empty text part should not be treat as html
${result} = Scan Message With Rspamc ${TESTDIR}/messages/empty-plain-text.eml
Should Not Contain ${result.stdout} FORGED_OUTLOOK_HTML
diff --git a/test/functional/configs/maps/mime_types.wl b/test/functional/configs/maps/mime_types.wl
new file mode 100644
index 000000000..eca07bddc
--- /dev/null
+++ b/test/functional/configs/maps/mime_types.wl
@@ -0,0 +1 @@
+/^hello_world\.exe$/
diff --git a/test/functional/configs/mime_types.conf b/test/functional/configs/mime_types.conf
index a16434b6a..e28feba98 100644
--- a/test/functional/configs/mime_types.conf
+++ b/test/functional/configs/mime_types.conf
@@ -15,4 +15,5 @@ mime_types {
"application/pdf",
]
}
+ filename_whitelist = "${TESTDIR}/configs/maps/mime_types.wl";
}
diff --git a/test/functional/messages/exe_attm.eml b/test/functional/messages/exe_attm.eml
new file mode 100644
index 000000000..2ab0e9420
--- /dev/null
+++ b/test/functional/messages/exe_attm.eml
@@ -0,0 +1,22 @@
+Return-Path: <root@srv.example.com>
+To: test@example.com
+From: root@srv.example.com
+Subject: test Sat, 26 Jan 2019 12:04:58 +0100
+Message-Id: <20190126120458.015328@srv.example.com>
+Date: Sat, 26 Jan 2019 12:04:58 +0100
+MIME-Version: 1.0
+Content-Type: multipart/mixed; boundary="----=_MIME_BOUNDARY_000_15328"
+
+------=_MIME_BOUNDARY_000_15328
+Content-Type: text/plain
+
+This is a test mailing
+------=_MIME_BOUNDARY_000_15328
+Content-Type: application/octet-stream; name="hello_world.exe"
+Content-Description: hello_world.exe
+Content-Disposition: attachment; filename="hello_world.exe"
+Content-Transfer-Encoding: BASE64
+
+f0VMRgIBAQAAAAAAAAAAAAMAPgABAAAAUBAAAAAAAABAAAAAAAAAAGA5AAAAAAAAAAAAAEAAOAAL
+
+------=_MIME_BOUNDARY_000_15328--