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

mailauth

Package Overview
Dependencies
Maintainers
1
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mailauth - npm Package Compare versions

Comparing version 4.6.4 to 4.6.5

lib/dkim/mime-structure-start-finder.js

7

CHANGELOG.md
# Changelog
## [4.6.5](https://github.com/postalsys/mailauth/compare/v4.6.4...v4.6.5) (2024-02-12)
### Bug Fixes
* **dkim:** Added new output property mimeStructureStart ([8f25353](https://github.com/postalsys/mailauth/commit/8f25353fa6a67ba3e1f0c5091325007b2434a29d))
## [4.6.4](https://github.com/postalsys/mailauth/compare/v4.6.3...v4.6.4) (2024-02-05)

@@ -4,0 +11,0 @@

@@ -6,2 +6,3 @@ /* eslint no-control-regex: 0 */

const crypto = require('crypto');
const { MimeStructureStartFinder } = require('../mime-structure-start-finder');

@@ -43,5 +44,16 @@ const CHAR_CR = 0x0d;

this.emptyLinesQueue = [];
this.mimeStructureStartFinder = new MimeStructureStartFinder();
}
setContentType(contentTypeObj) {
if (/^multipart\//i.test(contentTypeObj.value) && contentTypeObj.params.boundary) {
this.mimeStructureStartFinder.setBoundary(contentTypeObj.params.boundary);
}
}
_updateBodyHash(chunk) {
// serach through the entire document, not just signed part
this.mimeStructureStartFinder.update(chunk);
this.canonicalizedLength += chunk.length;

@@ -275,4 +287,8 @@

}
getMimeStructureStart() {
return this.mimeStructureStartFinder.getMimeStructureStart();
}
}
module.exports = { RelaxedHash };
'use strict';
const crypto = require('crypto');
const { MimeStructureStartFinder } = require('../mime-structure-start-finder');

@@ -33,5 +34,16 @@ /**

this.lastNewline = false;
this.mimeStructureStartFinder = new MimeStructureStartFinder();
}
setContentType(contentTypeObj) {
if (/^multipart\//i.test(contentTypeObj.value) && contentTypeObj.params.boundary) {
this.mimeStructureStartFinder.setBoundary(contentTypeObj.params.boundary);
}
}
_updateBodyHash(chunk) {
// serach through the entire document, not just signed part
this.mimeStructureStartFinder.update(chunk);
this.canonicalizedLength += chunk.length;

@@ -119,4 +131,8 @@

}
getMimeStructureStart() {
return this.mimeStructureStartFinder.getMimeStructureStart();
}
}
module.exports = { SimpleHash };

27

lib/dkim/dkim-verifier.js

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

const { v4: uuidv4 } = require('uuid');
const libmime = require('libmime');

@@ -151,2 +152,19 @@ class DkimVerifier extends MessageParser {

}
let headersArray = this.headers.parsed;
const findLastMethod = typeof headersArray.findLast === 'function' ? headersArray.findLast : headersArray.find;
if (typeof headersArray.findLast !== 'function') {
headersArray = [].concat(headersArray).reverse();
}
const contentTypeHeader = findLastMethod.call(headersArray, header => header.key === 'content-type');
if (contentTypeHeader) {
let line = contentTypeHeader.line.toString();
if (line.indexOf(':') >= 0) {
line = line.substring(line.indexOf(':') + 1).trim();
}
const parsedContentType = libmime.parseHeaderValue(line);
for (let hasher of this.bodyHashes.values()) {
hasher.setContentType(parsedContentType);
}
}
}

@@ -170,2 +188,3 @@ }

this.bodyHashes.get(key).hash = bodyHash.digest('base64');
this.bodyHashes.get(key).mimeStructureStart = bodyHash.getMimeStructureStart();
}

@@ -216,3 +235,5 @@

let bodyHash = this.bodyHashes.get(signatureHeader.bodyHashKey)?.hash;
const bodyHash = this.bodyHashes.get(signatureHeader.bodyHashKey)?.hash;
const mimeStructureStart = this.bodyHashes.get(signatureHeader.bodyHashKey)?.mimeStructureStart;
if (signatureHeader.parsed?.bh?.value !== bodyHash) {

@@ -351,2 +372,6 @@ status.result = 'neutral';

if (typeof mimeStructureStart === 'number') {
result.mimeStructureStart = mimeStructureStart;
}
if (publicKey) {

@@ -353,0 +378,0 @@ result.publicKey = publicKey.toString();

2

package.json
{
"name": "mailauth",
"version": "4.6.4",
"version": "4.6.5",
"description": "Email authentication library for Node.js",

@@ -5,0 +5,0 @@ "main": "lib/mailauth.js",

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