mailauth 4.6.0 → 4.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.ncurc.js +12 -0
- package/CHANGELOG.md +7 -0
- package/lib/dkim/body/relaxed.js +8 -1
- package/lib/dkim/body/simple.js +7 -1
- package/lib/dkim/dkim-signer.js +3 -1
- package/lib/dkim/dkim-verifier.js +14 -1
- package/man/mailauth.1 +1 -1
- package/package.json +9 -8
- package/.ncurc.json +0 -4
package/.ncurc.js
ADDED
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [4.6.1](https://github.com/postalsys/mailauth/compare/v4.6.0...v4.6.1) (2024-01-24)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **dkim-verify:** Show the length of the source body in DKIM results ([d28663b](https://github.com/postalsys/mailauth/commit/d28663b30b0bfaf07d395e9d3eaea044c9085657))
|
|
9
|
+
|
|
3
10
|
## [4.6.0](https://github.com/postalsys/mailauth/compare/v4.5.2...v4.6.0) (2023-11-02)
|
|
4
11
|
|
|
5
12
|
|
package/lib/dkim/body/relaxed.js
CHANGED
|
@@ -26,9 +26,14 @@ class RelaxedHash {
|
|
|
26
26
|
this.bodyHash = crypto.createHash(algorithm);
|
|
27
27
|
|
|
28
28
|
this.remainder = false;
|
|
29
|
-
this.byteLength = 0;
|
|
30
29
|
|
|
30
|
+
// total body size
|
|
31
|
+
this.byteLength = 0;
|
|
32
|
+
// total canonicalized body size
|
|
33
|
+
this.canonicalizedLength = 0;
|
|
34
|
+
// hashed canonicalized body size (after l= tag)
|
|
31
35
|
this.bodyHashedBytes = 0;
|
|
36
|
+
|
|
32
37
|
this.maxBodyLength = maxBodyLength;
|
|
33
38
|
|
|
34
39
|
this.maxSizeReached = maxBodyLength === 0;
|
|
@@ -37,6 +42,8 @@ class RelaxedHash {
|
|
|
37
42
|
}
|
|
38
43
|
|
|
39
44
|
_updateBodyHash(chunk) {
|
|
45
|
+
this.canonicalizedLength += chunk.length;
|
|
46
|
+
|
|
40
47
|
if (this.maxSizeReached) {
|
|
41
48
|
return;
|
|
42
49
|
}
|
package/lib/dkim/body/simple.js
CHANGED
|
@@ -18,8 +18,12 @@ class SimpleHash {
|
|
|
18
18
|
this.bodyHash = crypto.createHash(algorithm);
|
|
19
19
|
|
|
20
20
|
this.remainder = [];
|
|
21
|
-
this.byteLength = 0;
|
|
22
21
|
|
|
22
|
+
// total body size
|
|
23
|
+
this.byteLength = 0;
|
|
24
|
+
// total canonicalized body size
|
|
25
|
+
this.canonicalizedLength = 0;
|
|
26
|
+
// hashed canonicalized body size (after l= tag)
|
|
23
27
|
this.bodyHashedBytes = 0;
|
|
24
28
|
|
|
25
29
|
this.maxBodyLength = maxBodyLength;
|
|
@@ -29,6 +33,8 @@ class SimpleHash {
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
_updateBodyHash(chunk) {
|
|
36
|
+
this.canonicalizedLength += chunk.length;
|
|
37
|
+
|
|
32
38
|
if (this.maxSizeReached) {
|
|
33
39
|
return;
|
|
34
40
|
}
|
package/lib/dkim/dkim-signer.js
CHANGED
|
@@ -259,7 +259,9 @@ class DkimSigner extends MessageParser {
|
|
|
259
259
|
// value for the l= tag (if needed)
|
|
260
260
|
typeof signatureData.maxBodyLength === 'number'
|
|
261
261
|
? {
|
|
262
|
-
bodyHashedBytes: this.bodyHashes.get(hashKey).hasher.bodyHashedBytes
|
|
262
|
+
bodyHashedBytes: this.bodyHashes.get(hashKey).hasher.bodyHashedBytes,
|
|
263
|
+
canonicalizedLength: this.bodyHashes.get(hashKey).hasher.canonicalizedLength,
|
|
264
|
+
sourceBodyLength: this.bodyHashes.get(hashKey).hasher.byteLength
|
|
263
265
|
}
|
|
264
266
|
: {}
|
|
265
267
|
)
|
|
@@ -296,6 +296,8 @@ class DkimVerifier extends MessageParser {
|
|
|
296
296
|
}
|
|
297
297
|
|
|
298
298
|
signatureHeader.bodyHashedBytes = this.bodyHashes.get(signatureHeader.bodyHashKey)?.bodyHashedBytes;
|
|
299
|
+
signatureHeader.canonicalizedLength = this.bodyHashes.get(signatureHeader.bodyHashKey)?.canonicalizedLength;
|
|
300
|
+
signatureHeader.sourceBodyLength = this.bodyHashes.get(signatureHeader.bodyHashKey)?.byteLength;
|
|
299
301
|
|
|
300
302
|
if (typeof signatureHeader.maxBodyLength === 'number' && signatureHeader.maxBodyLength !== signatureHeader.bodyHashedBytes) {
|
|
301
303
|
status.result = 'fail';
|
|
@@ -314,12 +316,23 @@ class DkimVerifier extends MessageParser {
|
|
|
314
316
|
status
|
|
315
317
|
};
|
|
316
318
|
|
|
319
|
+
if (typeof signatureHeader.sourceBodyLength === 'number') {
|
|
320
|
+
result.sourceBodyLength = signatureHeader.sourceBodyLength;
|
|
321
|
+
}
|
|
322
|
+
|
|
317
323
|
if (typeof signatureHeader.bodyHashedBytes === 'number') {
|
|
318
324
|
result.canonBodyLength = signatureHeader.bodyHashedBytes;
|
|
319
325
|
}
|
|
320
326
|
|
|
327
|
+
if (typeof signatureHeader.canonicalizedLength === 'number') {
|
|
328
|
+
result.canonBodyLengthTotal = signatureHeader.canonicalizedLength;
|
|
329
|
+
}
|
|
330
|
+
|
|
321
331
|
if (typeof signatureHeader.maxBodyLength === 'number') {
|
|
322
|
-
result.
|
|
332
|
+
result.canonBodyLengthLimited = true;
|
|
333
|
+
result.canonBodyLengthLimit = signatureHeader.maxBodyLength;
|
|
334
|
+
} else {
|
|
335
|
+
result.canonBodyLengthLimited = false;
|
|
323
336
|
}
|
|
324
337
|
|
|
325
338
|
if (publicKey) {
|
package/man/mailauth.1
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mailauth",
|
|
3
|
-
"version": "4.6.
|
|
3
|
+
"version": "4.6.1",
|
|
4
4
|
"description": "Email authentication library for Node.js",
|
|
5
5
|
"main": "lib/mailauth.js",
|
|
6
6
|
"scripts": {
|
|
@@ -33,28 +33,29 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/postalsys/mailauth",
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"chai": "4.
|
|
37
|
-
"eslint": "8.
|
|
36
|
+
"chai": "4.4.1",
|
|
37
|
+
"eslint": "8.56.0",
|
|
38
38
|
"eslint-config-nodemailer": "1.2.0",
|
|
39
|
-
"eslint-config-prettier": "9.
|
|
39
|
+
"eslint-config-prettier": "9.1.0",
|
|
40
40
|
"js-yaml": "4.1.0",
|
|
41
41
|
"license-report": "6.5.0",
|
|
42
42
|
"marked": "0.7.0",
|
|
43
43
|
"marked-man": "0.7.0",
|
|
44
44
|
"mbox-reader": "1.1.5",
|
|
45
45
|
"mocha": "10.2.0",
|
|
46
|
+
"npm-check-updates": "16.14.12",
|
|
46
47
|
"pkg": "5.8.1"
|
|
47
48
|
},
|
|
48
49
|
"dependencies": {
|
|
49
50
|
"@postalsys/vmc": "1.0.6",
|
|
50
|
-
"fast-xml-parser": "4.3.
|
|
51
|
+
"fast-xml-parser": "4.3.3",
|
|
51
52
|
"ipaddr.js": "2.1.0",
|
|
52
|
-
"joi": "17.
|
|
53
|
+
"joi": "17.12.0",
|
|
53
54
|
"libmime": "5.2.1",
|
|
54
|
-
"nodemailer": "6.9.
|
|
55
|
+
"nodemailer": "6.9.8",
|
|
55
56
|
"psl": "1.9.0",
|
|
56
57
|
"punycode": "2.3.1",
|
|
57
|
-
"undici": "5.
|
|
58
|
+
"undici": "5.28.2",
|
|
58
59
|
"yargs": "17.7.2"
|
|
59
60
|
},
|
|
60
61
|
"engines": {
|
package/.ncurc.json
DELETED