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

spamassassin: strip useless WS from tests #2624

Merged
merged 3 commits into from
May 18, 2019

Conversation

msimerson
Copy link
Member

before

[spamassassin] status=No, score=-7.7, required=5.0, reject=0, tests="BAYES_99,BAYES_999,DCC_CHECK,DKIMWL_WL_HIGH,DKIM_SIGNED,\r DKIM_VALID,DKIM_VALID_AU,HTML_MESSAGE,LOW_PRICE,RCVD_IN_DNSWL_NONE,\r SPF_PASS,URI_HEX,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL"

note the silly "\r " plus invisible whitespace which doesn't wrap in the console/logs anyway.

after

[spamassassin] status=No, score=-4.4, required=5.0, reject=0, tests="BAYES_00,DCC_CHECK,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FROM_EXCESS_BASE64,HTML_IMAGE_RATIO_04,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_RP_CERTIFIED,RCVD_IN_RP_SAFE,SPF_PASS"

@codecov

This comment has been minimized.

@@ -105,7 +105,7 @@ exports.hook_data_post = function (next, connection) {
if (!connection.transaction) return next();

if (spamd_response.headers && spamd_response.headers.Tests) {
spamd_response.tests = spamd_response.headers.Tests;
spamd_response.tests = spamd_response.headers.Tests.replace(/\s/g, '');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
spamd_response.tests = spamd_response.headers.Tests.replace(/\s/g, '');
spamd_response.tests = spamd_response.headers.Tests.replace(/\s+/g, ' ');

There might be a good reason this isn't a good fix, but the one included here looks odd to me.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not looking to replace multiples of WS (your suggestion) with a single space (your suggestion). There's currently some SMTP line folding included in the string. My goal is to strip out all the WS chars (in this case, sets of \r\n\t and/or \r\n\s+).

@msimerson msimerson merged commit 1afaa53 into haraka:master May 18, 2019
@msimerson msimerson deleted the spamassassin-header-clean branch May 18, 2019 15:06
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

Successfully merging this pull request may close these issues.

2 participants