New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

haraka-plugin-rspamd

Package Overview
Dependencies
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haraka-plugin-rspamd - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

3

Changes.md

@@ -0,2 +1,5 @@

## 1.1.2 - 2018-11-03
- add check.local_ip config option
## 1.1.1 - 2018-05-10

@@ -3,0 +6,0 @@

34

index.js

@@ -21,2 +21,3 @@ 'use strict';

'-check.private_ip',
'-check.local_ip',
'+reject.spam',

@@ -191,3 +192,3 @@ '-reject.authenticated',

if (!connection.transaction) return next();
if (plugin.wants_skip(connection)) return next();
if (!plugin.should_check(connection)) return next();

@@ -260,10 +261,24 @@ let timer;

exports.wants_skip = function (connection) {
exports.should_check = function (connection) {
const plugin = this;
if (!plugin.cfg.check.authenticated && connection.notes.auth_user) return true;
if (plugin.cfg.check.authenticated == false && connection.notes.auth_user) {
connection.transaction.results.add(plugin, { skip: 'authed'});
return false;
}
if (!plugin.cfg.check.private_ip && connection.remote.is_private) return true;
// necessary because local IPs are included in private IPs
if (plugin.cfg.check.local_ip == true && connection.remote.is_local) return true;
return false;
if (plugin.cfg.check.local_ip == false && connection.remote.is_local) {
connection.transaction.results.add(plugin, { skip: 'local_ip'});
return false;
}
if (plugin.cfg.check.private_ip == false && connection.remote.is_private) {
connection.transaction.results.add(plugin, { skip: 'private_ip'});
return false;
}
return true;
}

@@ -275,5 +290,10 @@

if (data.action !== 'reject') return false;
if (!connection.notes.auth_user && !plugin.cfg.reject.spam) return false;
if (connection.notes.auth_user && !plugin.cfg.reject.authenticated) return false;
if (connection.notes.auth_user) {
if (plugin.cfg.reject.authenticated == false) return false;
}
else {
if (plugin.cfg.reject.spam == false) return false;
}
return true;

@@ -280,0 +300,0 @@ }

{
"name": "haraka-plugin-rspamd",
"version": "1.1.1",
"version": "1.1.2",
"description": "Haraka plugin for rspamd",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -71,2 +71,9 @@ [![Build Status][ci-img]][ci-url]

- check.local\_ip
Default: false
If false, messages from localhost will not be scanned by Rspamd.
If true, messages from localhost will be scanned by Rspamd.
- dkim.enabled

@@ -73,0 +80,0 @@

@@ -147,1 +147,99 @@ 'use strict';

}
function _check_setup (done) {
this.plugin = new fixtures.plugin('rspamd');
this.plugin.register();
this.connection = connection.createConnection();
this.connection.init_transaction();
// init defaults
this.plugin.cfg.check.local_ip = false;
this.plugin.cfg.check.private_ip = false;
this.plugin.cfg.check.authenticated = false;
this.connection.remote.is_local = false;
this.connection.remote.is_private = false;
this.connection.notes.auth_user = undefined;
done()
}
exports.should_check = {
setUp : _check_setup,
'checks authenticated': function (test) {
this.connection.notes.auth_user = "username";
this.plugin.cfg.check.authenticated = true;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), true);
test.done();
},
'skips authenticated': function (test) {
this.connection.notes.auth_user = "username";
this.plugin.cfg.check.authenticated = false;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), false);
test.done();
},
'checks local IP': function (test) {
this.connection.remote.is_local = true;
this.plugin.cfg.check.local_ip = true;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), true);
test.done();
},
'skips local IP': function (test) {
this.connection.remote.is_local = true;
this.plugin.cfg.check.local_ip = false;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), false);
test.done();
},
'checks private IP': function (test) {
this.connection.remote.is_private = true;
this.plugin.cfg.check.private_ip = true;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), true);
test.done();
},
'skips private IP': function (test) {
this.connection.remote.is_private = true;
this.plugin.cfg.check.private_ip = false;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), false);
test.done();
},
'checks public ip': function (test) {
test.expect(1);
test.equal(this.plugin.should_check(this.connection), true);
test.done();
},
'skip localhost if check.local_ip = false and check.private_ip = true': function (test) {
this.connection.remote.is_local = true;
this.connection.remote.is_private = true;
this.plugin.cfg.check.local_ip = false;
this.plugin.cfg.check.private_ip = true;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), false);
test.done();
},
'checks localhost if check.local_ip = true and check.private_ip = false': function (test) {
this.connection.remote.is_local = true;
this.connection.remote.is_private = true;
this.plugin.cfg.check.local_ip = true;
this.plugin.cfg.check.private_ip = false;
test.expect(1);
test.equal(this.plugin.should_check(this.connection), true);
test.done();
},
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc