]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Test] RBL: test more URL extraction scenarios
authorAndrew Lewis <nerf@judo.za.org>
Mon, 20 Jan 2025 11:22:43 +0000 (13:22 +0200)
committerAndrew Lewis <nerf@judo.za.org>
Mon, 20 Jan 2025 11:22:43 +0000 (13:22 +0200)
test/functional/cases/001_merged/300_rbl.robot
test/functional/configs/merged-local.conf
test/functional/configs/merged-override.conf
test/functional/lib/rspamd.robot

index 8b19fae0685f840845a7fb8ed3f336d620e5ae8b..f71c18f57070df9594f641ebba9bf3c825e7839b 100644 (file)
@@ -96,3 +96,29 @@ NUMERIC URLS WITH EVERYTHING
   ...  IP=127.0.0.1
   ...  Settings={symbols_enabled = [URIBL_NUMERIC_EVERYTHING]}
   Expect Symbol With Exact Options  URIBL_NUMERIC_EVERYTHING  12.11.10.9:url  4.3.2.1:url  8.7.6.5:url
+
+NONNUMERIC URLS VANILLA
+  Scan File  ${RSPAMD_TESTDIR}/messages/numeric_urls.eml
+  ...  Settings={symbols_enabled = [URIBL_NONNUMERIC_VANILLA]}
+  # Content
+  Do Not Expect Symbol With Option  URIBL_NONNUMERIC_VANILLA  example.com:url
+  # Image
+  Do Not Expect Symbol With Option  URIBL_NONNUMERIC_VANILLA  judo.za.org:url
+  # URL
+  Expect Symbol With Option  URIBL_NONNUMERIC_VANILLA  example.org:url
+  # Numeric
+  Do Not Expect Symbol With Option  URIBL_NONNUMERIC_VANILLA  4.3.2.1:url
+  Do Not Expect Symbol With Option  URIBL_NONNUMERIC_VANILLA  1.2.3.4:url
+
+NONNUMERIC URLS WITH EVERYTHING
+  Scan File  ${RSPAMD_TESTDIR}/messages/numeric_urls.eml
+  ...  Settings={symbols_enabled = [URIBL_NONNUMERIC_EVERYTHING]}
+  # Content
+  Expect Symbol With Option  URIBL_NONNUMERIC_EVERYTHING  example.com:url
+  # Image
+  Expect Symbol With Option  URIBL_NONNUMERIC_EVERYTHING  judo.za.org:url
+  # URL
+  Expect Symbol With Option  URIBL_NONNUMERIC_EVERYTHING  example.org:url
+  # Numeric
+  Do Not Expect Symbol With Option  URIBL_NONNUMERIC_EVERYTHING  4.3.2.1:url
+  Do Not Expect Symbol With Option  URIBL_NONNUMERIC_EVERYTHING  1.2.3.4:url
index 2aef274c212861538be94e5025220607e95aee49..f70c4f865077cd4f6264ef4f5ee217c2365b1c1d 100644 (file)
@@ -905,6 +905,31 @@ options = {
           type = a;
           replies = ["127.0.0.2"];
         },
+        {
+          name = "1.2.3.4.test10.uribl";
+          type = a;
+          replies = ["127.0.0.2"];
+        },
+        {
+          name = "4.3.2.1.test10.uribl";
+          type = a;
+          replies = ["127.0.0.2"];
+        },
+        {
+          name = "judo.za.org.test10.uribl";
+          type = a;
+          replies = ["127.0.0.2"];
+        },
+        {
+          name = "example.com.test10.uribl";
+          type = a;
+          replies = ["127.0.0.2"];
+        },
+        {
+          name = "example.org.test10.uribl";
+          type = a;
+          replies = ["127.0.0.2"];
+        },
         {
           name = "site.resolveme",
           type = "a";
index 32d3df7fee28ced69794dcd416d8ae50cf756ce7..344e307864970b1838480eb63b3e8aaec4ea0996 100644 (file)
@@ -327,6 +327,18 @@ rbl {
         URIBL_NUMERIC_CONTENT = "*.*.*.*";
       }
     }
+    URIBL_NONNUMERIC_VANILLA {
+      checks = ["urls"];
+      rbl = "test10.uribl";
+      exclude_local = false;
+      no_ip = true;
+    }
+    URIBL_NONNUMERIC_EVERYTHING {
+      checks = ["urls", "content_urls", "images"];
+      rbl = "test10.uribl";
+      exclude_local = false;
+      no_ip = true;
+    }
     URIBL_NUMERIC_EVERYTHING {
       checks = ["numeric_urls"];
       images = true;
index 68bcb66fb6e9cf0b3933e507a58f6041c48dfb07..9c30a97dba0680318b5e7b6a932360c550db1e35 100644 (file)
@@ -87,6 +87,15 @@ Do Not Expect Symbol
   Dictionary Should Not Contain Key  ${SCAN_RESULT}[symbols]  ${symbol}
   ...  msg=Symbol ${symbol} was not expected to be found in result
 
+Do Not Expect Symbol With Option
+  [Arguments]  ${symbol}  ${option}
+  IF  '${symbol}' not in ${SCAN_RESULT}[symbols]
+    RETURN
+  END
+  ${have_options} =  Convert To List  ${SCAN_RESULT}[symbols][${symbol}][options]
+  Should Not Contain  ${have_options}  ${option}
+  ...  msg="Options for symbol ${symbol} ${SCAN_RESULT}[symbols][${symbol}][options] doesn't contain ${option}"
+
 Do Not Expect Symbols
   [Arguments]  @{symbols}
   FOR  ${symbol}  IN  @{symbols}