This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git


The following commit(s) were added to refs/heads/master by this push:
     new 42891ce8b5 JAMES-3775 Phishing test for Rspamd (#2339)
42891ce8b5 is described below

commit 42891ce8b5a0faa4b380b3092f73c569e08711c9
Author: Trần Hồng Quân <[email protected]>
AuthorDate: Fri Jul 5 21:01:18 2024 +0700

    JAMES-3775 Phishing test for Rspamd (#2339)
    
    Phishing is enabled by default.
---
 .../james/rspamd/DockerRspamdExtensionTest.java       | 14 ++++++++++++++
 .../rspamd/src/test/resources/mail/spam/phishing.eml  | 19 +++++++++++++++++++
 2 files changed, 33 insertions(+)

diff --git 
a/third-party/rspamd/src/test/java/org/apache/james/rspamd/DockerRspamdExtensionTest.java
 
b/third-party/rspamd/src/test/java/org/apache/james/rspamd/DockerRspamdExtensionTest.java
index f4166db072..d8e77b76b7 100644
--- 
a/third-party/rspamd/src/test/java/org/apache/james/rspamd/DockerRspamdExtensionTest.java
+++ 
b/third-party/rspamd/src/test/java/org/apache/james/rspamd/DockerRspamdExtensionTest.java
@@ -21,6 +21,7 @@ package org.apache.james.rspamd;
 
 import static org.apache.james.rspamd.RspamdExtension.PASSWORD;
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.hamcrest.Matchers.equalTo;
 import static org.hamcrest.core.Is.is;
 
 import org.apache.james.junit.categories.Unstable;
@@ -84,6 +85,19 @@ class DockerRspamdExtensionTest {
             .body("action", is("no action"));
     }
 
+    @Test
+    void checkPhishingEmailShouldWorkByDefaultRspamdConfig() {
+        RequestSpecification rspamdApi = 
WebAdminUtils.spec(Port.of(rspamdExtension.rspamdPort()));
+
+        rspamdApi
+            .header(new Header("Password", PASSWORD))
+            
.body(ClassLoader.getSystemResourceAsStream("mail/spam/phishing.eml"))
+            .post("checkv2")
+        .then()
+            .statusCode(HttpStatus.OK_200)
+            .body("symbols.PHISHING.name", equalTo("PHISHING"));
+    }
+
     @Test
     void learnSpamEmailWithExactPasswordHeaderShouldWork() {
         RequestSpecification rspamdApi = 
WebAdminUtils.spec(Port.of(rspamdExtension.rspamdPort()));
diff --git a/third-party/rspamd/src/test/resources/mail/spam/phishing.eml 
b/third-party/rspamd/src/test/resources/mail/spam/phishing.eml
new file mode 100644
index 0000000000..df808e8082
--- /dev/null
+++ b/third-party/rspamd/src/test/resources/mail/spam/phishing.eml
@@ -0,0 +1,19 @@
+From: [email protected]
+To: [email protected]
+Subject: Urgent: Verify Your Account
+
+Date: Thu, 04 Jul 2024 10:00:00 +0000
+Message-ID: <[email protected]>
+MIME-Version: 1.0
+Content-Type: text/html; charset=UTF-8
+
+<html>
+  <body>
+    <p>Dear Valued Customer,</p>
+    <p>We regret to inform you that your account has been temporarily 
suspended due to suspicious activity. To restore your account access, please 
verify your identity by clicking on the link below:</p>
+    <p><a href="http://evil.yourbankk.com";>yourbank.com</a></p>
+    <p>Failure to verify your account within 24 hours will result in permanent 
suspension. We apologize for any inconvenience this may cause and appreciate 
your prompt attention to this matter.</p>
+    <p>Thank you for your cooperation.</p>
+    <p>Sincerely,<br>Customer Support Team<br>Your Bank</p>
+  </body>
+</html>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to