Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headers set in request not being parsed by SpamAssassin #2

Open
mithunatri opened this issue May 3, 2021 · 0 comments
Open

Headers set in request not being parsed by SpamAssassin #2

mithunatri opened this issue May 3, 2021 · 0 comments

Comments

@mithunatri
Copy link

I am trying to send a REPORT request to SA with message body and some headers. I am interested in the spam score and upon looking at the detailed analysis report from SA it appears that SA is not parsing the headers which are set on the request.

Here is a sample output --

Spam Report: Spam detection software, running on the system "xxxxxxxx",
has identified this incoming email as possible spam.  The original
message has been attached to this so you can view it or label
similar future email.  If you have any questions, see
the administrator of that system for details.

Content preview:  XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X
   

Content analysis details:   (1005.5 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
 1.2 MISSING_HEADERS        Missing To: header
-0.0 NO_RELAYS              Informational: message was not relayed via SMTP
1000 GTUBE                  BODY: Generic Test for Unsolicited Bulk Email
-0.0 NO_RECEIVED            Informational: message has no Received headers
 1.8 MISSING_SUBJECT        Missing Subject: header
 0.1 MISSING_MID            Missing Message-Id: header
 1.0 MISSING_FROM           Missing From: header
 0.0 TVD_SPACE_RATIO        No description available.
 1.4 MISSING_DATE           Missing Date: header
 0.0 NO_HEADERS_MESSAGE     Message appears to be missing most RFC-822
                            headers

As you can see, the report says that the To, Subject, From, Date, and Message-Id headers are missing despite it being set on the SARequest object (using request.addHeader()).

I dug a little further and noticed that if the headers are explicitly included in the message body then SA is able to parse them properly. For example -

SARequest request = new SARequest();
    // GTUBE message string
    request.setMessage(
        "To: to-header" + SARequest.NEW_LINE
            + "From: from-header" + SARequest.NEW_LINE
            + "Message-Id: <"+ UUID.randomUUID()+ "@example.com>" + SARequest.NEW_LINE
            + "XJS*C4JDBQADN1.NSBN3*2IDNEN*GTUBE-STANDARD-ANTI-UBE-TEST-EMAIL*C.34X");

This is very strange as the SARequest.getRequestByteArray invoked from SAClient.sendRequest is essentially doing the same thing.

Also, if there is no new line character in front of the actual message, SA thinks that the message content is empty (despite a NEW_LINE being added in SARequest.getRequestByteArray)

Could this be a bug or am I using it incorrectly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant