Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

haraka-plugin-wildduck

Package Overview
Dependencies
Maintainers
1
Versions
213
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

haraka-plugin-wildduck - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

44

index.js

@@ -10,2 +10,3 @@ /* eslint-env es6 */

const punycode = require('punycode');
const SRS = require('srs.js');

@@ -35,2 +36,6 @@ exports.register = function() {

plugin.srsRewriter = new SRS({
secret: plugin.cfg.srs.secret
});
MongoClient.connect(plugin.cfg.mongo.url, (err, database) => {

@@ -48,2 +53,16 @@ if (err) {

exports.normalize_address = function(address) {
let domain = address.host.toLowerCase().trim();
if (/^SRS\d+=/i.test(address.user)) {
// Try to fix case-mangled addresses where the intermediate MTA converts user part to lower case
// and thus breaks hash verification
let localAddress = address.user
// ensure that address starts with uppercase SRS
.replace(/^SRS\d+=/i, val => val.toUpperCase())
// ensure that the first entity that looks like timestamp is uppercase
.replace(/([-=+][0-9a-f]{4})(=[A-Z2-7]{2}=)/i, (str, sig, ts) => sig + ts.toUpperCase());
return localAddress + '@' + punycode.toUnicode(domain);
}
let user = address.user

@@ -57,4 +76,2 @@ // just in case it is an unicode username

let domain = address.host.toLowerCase().trim();
return user + '@' + punycode.toUnicode(domain);

@@ -83,2 +100,25 @@ };

if (/^SRS\d+=/.test(address)) {
let reversed = false;
try {
reversed = plugin.srsRewriter.reverse(address);
let toDomain = punycode.toASCII((reversed[1] || '').toString().toLowerCase().trim());
if (!toDomain) {
plugin.logerror('SRS check failed for ' + address + '. Missing domain');
return next(DENY, DSN.no_such_user());
}
reversed = reversed.join('@');
} catch (E) {
plugin.logerror('SRS check failed for ' + address + '. ' + E.message);
return next(DENY, DSN.no_such_user());
}
if (reversed) {
// accept SRS rewritten address
return next(OK);
}
}
// check if address exists

@@ -85,0 +125,0 @@ plugin.usersdb.collection('addresses').findOne({

17

package.json
{
"name": "haraka-plugin-wildduck",
"version": "1.0.4",
"version": "1.0.5",
"description": "Haraka plugin for processing incoming messages for Wild Duck IMAP server",

@@ -13,3 +13,11 @@ "main": "index.js",

},
"keywords": ["MX", "SMTP", "Haraka", "Wild", "Duck", "IMAP", "LMTP"],
"keywords": [
"MX",
"SMTP",
"Haraka",
"Wild",
"Duck",
"IMAP",
"LMTP"
],
"author": "Andris Reinman",

@@ -22,3 +30,3 @@ "license": "EUPL-1.1",

"devDependencies": {
"eslint": "^4.3.0",
"eslint": "^4.5.0",
"eslint-config-nodemailer": "^1.2.0",

@@ -30,4 +38,5 @@ "grunt": "^1.0.1",

"dependencies": {
"mongodb": "^2.2.30"
"mongodb": "^2.2.31",
"srs.js": "^0.1.0"
}
}

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