mailauth 4.3.3 → 4.4.0

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/README.md CHANGED
@@ -342,7 +342,9 @@ const { bimi } = await authenticate(
342
342
  ip: '217.146.67.33', // SMTP client IP
343
343
  helo: 'uvn-67-33.tll01.zonevs.eu', // EHLO/HELO hostname
344
344
  mta: 'mx.ethereal.email', // server processing this message, defaults to os.hostname()
345
- sender: 'andris@ekiri.ee' // MAIL FROM address
345
+ sender: 'andris@ekiri.ee', // MAIL FROM address
346
+
347
+ bimiWithAlignedDkim: false // If true then ignores SPF in DMARC and requires a valid DKIM signature
346
348
  }
347
349
  );
348
350
  if (bimi?.location) {
package/lib/bimi/index.js CHANGED
@@ -15,7 +15,7 @@ const { vmc } = require('@postalsys/vmc');
15
15
  const { validateSvg } = require('./validate-svg');
16
16
 
17
17
  const lookup = async data => {
18
- let { dmarc, headers, resolver } = data;
18
+ let { dmarc, headers, resolver, bimiWithAlignedDkim } = data;
19
19
  let headerRows = (headers && headers.parsed) || [];
20
20
 
21
21
  resolver = resolver || dns.promises.resolve;
@@ -41,6 +41,13 @@ const lookup = async data => {
41
41
  return response;
42
42
  }
43
43
 
44
+ if (!dmarc.alignment?.dkim?.result && bimiWithAlignedDkim) {
45
+ response.status.result = 'skipped';
46
+ response.status.comment = 'Aligned DKIM signature required';
47
+ response.info = formatAuthHeaderRow('bimi', response.status);
48
+ return response;
49
+ }
50
+
44
51
  const authorDomain = dmarc.status?.header?.from;
45
52
  const orgDomain = dmarc.domain;
46
53
 
package/lib/mailauth.js CHANGED
@@ -133,6 +133,7 @@ const authenticate = async (input, opts) => {
133
133
  bimiResult = await bimi({
134
134
  dmarc: dmarcResult,
135
135
  headers: dkimResult.headers,
136
+ bimiWithAlignedDkim: opts.bimiWithAlignedDkim,
136
137
  resolver: opts.resolver
137
138
  });
138
139
  }
package/lib/mta-sts.js CHANGED
@@ -295,11 +295,6 @@ const fetchPolicy = async (domain, opts) => {
295
295
  * @returns {Object|Boolean} Policy information or false
296
296
  */
297
297
  const getPolicy = async (domain, knownPolicy, opts) => {
298
- if (knownPolicy?.expires && new Date(knownPolicy?.expires) > new Date()) {
299
- // no need to check
300
- return { policy: knownPolicy, status: 'cached' };
301
- }
302
-
303
298
  let policyId;
304
299
  try {
305
300
  policyId = await resolvePolicy(domain, opts);
@@ -312,8 +307,8 @@ const getPolicy = async (domain, knownPolicy, opts) => {
312
307
  return { policy: { id: false, mode: 'none' }, status: 'not_found' };
313
308
  }
314
309
 
315
- if (knownPolicy && knownPolicy.id === policyId) {
316
- // no changes
310
+ if (knownPolicy && knownPolicy.id === policyId && !(knownPolicy?.expires && new Date(knownPolicy?.expires) > new Date())) {
311
+ // no changes, not expired
317
312
  return {
318
313
  policy: Object.assign({}, knownPolicy, {
319
314
  expires: new Date(Date.now() + knownPolicy.maxAge * 1000).toISOString()
package/licenses.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  name license type link installed version author
2
2
  ---- ------------ ---- ----------------- ------
3
3
  @postalsys/vmc MIT https://registry.npmjs.org/@postalsys/vmc/-/vmc-1.0.6.tgz 1.0.6 Postal Systems OÜ
4
- fast-xml-parser MIT git+https://github.com/NaturalIntelligence/fast-xml-parser.git 4.1.3 Amit Gupta (https://amitkumargupta.work/)
4
+ fast-xml-parser MIT git+https://github.com/NaturalIntelligence/fast-xml-parser.git 4.2.0 Amit Gupta (https://amitkumargupta.work/)
5
5
  ipaddr.js MIT git://github.com/whitequark/ipaddr.js.git 2.0.1 whitequark <whitequark@whitequark.org>
6
6
  joi BSD-3-Clause git://github.com/hapijs/joi.git 17.9.1 n/a
7
7
  libmime MIT git://github.com/andris9/libmime.git 5.2.1 Andris Reinman <andris@kreata.ee>
package/man/mailauth.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH "MAILAUTH" "1" "April 2023" "v4.3.3" "Mailauth Help"
1
+ .TH "MAILAUTH" "1" "June 2023" "v4.3.4" "Mailauth Help"
2
2
  .SH "NAME"
3
3
  \fBmailauth\fR
4
4
  .QP
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mailauth",
3
- "version": "4.3.3",
3
+ "version": "4.4.0",
4
4
  "description": "Email authentication library for Node.js",
5
5
  "main": "lib/mailauth.js",
6
6
  "scripts": {
@@ -33,11 +33,11 @@
33
33
  "homepage": "https://github.com/postalsys/mailauth",
34
34
  "devDependencies": {
35
35
  "chai": "4.3.7",
36
- "eslint": "8.38.0",
36
+ "eslint": "8.42.0",
37
37
  "eslint-config-nodemailer": "1.2.0",
38
38
  "eslint-config-prettier": "8.8.0",
39
39
  "js-yaml": "4.1.0",
40
- "license-report": "6.3.0",
40
+ "license-report": "6.4.0",
41
41
  "marked": "0.7.0",
42
42
  "marked-man": "0.7.0",
43
43
  "mbox-reader": "1.1.5",
@@ -46,14 +46,14 @@
46
46
  },
47
47
  "dependencies": {
48
48
  "@postalsys/vmc": "1.0.6",
49
- "fast-xml-parser": "4.2.0",
50
- "ipaddr.js": "2.0.1",
51
- "joi": "17.9.1",
49
+ "fast-xml-parser": "4.2.4",
50
+ "ipaddr.js": "2.1.0",
51
+ "joi": "17.9.2",
52
52
  "libmime": "5.2.1",
53
- "nodemailer": "6.9.1",
53
+ "nodemailer": "6.9.3",
54
54
  "psl": "1.9.0",
55
55
  "punycode": "2.3.0",
56
- "yargs": "17.7.1"
56
+ "yargs": "17.7.2"
57
57
  },
58
58
  "engines": {
59
59
  "node": ">=16.0.0"