mailauth 4.6.7 → 4.6.8

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.6.8](https://github.com/postalsys/mailauth/compare/v4.6.7...v4.6.8) (2024-06-04)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **dmarc-alignment:** Fixed tldts usage to allow private domains ([cc7dfa8](https://github.com/postalsys/mailauth/commit/cc7dfa8d820c1a4112602340192010354d51cd52))
9
+
3
10
  ## [4.6.7](https://github.com/postalsys/mailauth/compare/v4.6.6...v4.6.7) (2024-05-30)
4
11
 
5
12
 
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
- const tldts = require('tldts');
4
3
  const dns = require('node:dns').promises;
4
+ const tldts = require('tldts');
5
+ const { TLDTS_OPTS } = require('../tools');
5
6
 
6
7
  const resolveTxt = async (domain, resolver) => {
7
8
  try {
@@ -33,7 +34,7 @@ const getDmarcRecord = async (domain, resolver) => {
33
34
  let isOrgRecord = false;
34
35
 
35
36
  if (!txt) {
36
- let orgDomain = tldts.getDomain(domain);
37
+ let orgDomain = tldts.getDomain(domain, TLDTS_OPTS);
37
38
  if (orgDomain !== domain) {
38
39
  // try org domain as well
39
40
  txt = await resolveTxt(orgDomain, resolver);
@@ -3,7 +3,7 @@
3
3
  const dns = require('node:dns').promises;
4
4
  const punycode = require('punycode.js');
5
5
  const tldts = require('tldts');
6
- const { formatAuthHeaderRow, getAlignment } = require('../tools');
6
+ const { formatAuthHeaderRow, getAlignment, TLDTS_OPTS } = require('../tools');
7
7
  const getDmarcRecord = require('./get-dmarc-record');
8
8
 
9
9
  const verifyDmarc = async opts => {
@@ -41,7 +41,7 @@ const verifyDmarc = async opts => {
41
41
  return response;
42
42
  };
43
43
 
44
- let orgDomain = tldts.getDomain(domain);
44
+ let orgDomain = tldts.getDomain(domain, TLDTS_OPTS);
45
45
 
46
46
  let status = {
47
47
  result: 'neutral',
package/lib/tools.js CHANGED
@@ -29,6 +29,11 @@ const keyOrderingDKIM = ['v', 'a', 'c', 'd', 'h', 'i', 'l', 'q', 's', 't', 'x',
29
29
  const keyOrderingARC = ['i', 'a', 'c', 'd', 'h', 'l', 'q', 's', 't', 'x', 'z', 'bh', 'b'];
30
30
  const keyOrderingAS = ['i', 'a', 't', 'cv', 'd', 's', 'b'];
31
31
 
32
+ const TLDTS_OPTS = {
33
+ allowIcannDomains: true,
34
+ allowPrivateDomains: true
35
+ };
36
+
32
37
  const writeToStream = async (stream, input, chunkSize) => {
33
38
  chunkSize = chunkSize || 64 * 1024;
34
39
 
@@ -483,7 +488,7 @@ const getAlignment = (fromDomain, domainList, strict) => {
483
488
  if (strict) {
484
489
  fromDomain = formatDomain(fromDomain);
485
490
  for (let entry of domainList) {
486
- let domain = formatDomain(tldts.getDomain(entry.domain) || entry.domain);
491
+ let domain = formatDomain(tldts.getDomain(entry.domain, TLDTS_OPTS) || entry.domain);
487
492
  if (formatDomain(domain) === fromDomain) {
488
493
  return entry;
489
494
  }
@@ -491,9 +496,9 @@ const getAlignment = (fromDomain, domainList, strict) => {
491
496
  }
492
497
 
493
498
  // match org domains
494
- fromDomain = formatDomain(tldts.getDomain(fromDomain) || fromDomain);
499
+ fromDomain = formatDomain(tldts.getDomain(fromDomain, TLDTS_OPTS) || fromDomain);
495
500
  for (let entry of domainList) {
496
- let domain = formatDomain(tldts.getDomain(entry.domain) || entry.domain);
501
+ let domain = formatDomain(tldts.getDomain(entry.domain, TLDTS_OPTS) || entry.domain);
497
502
  if (domain === fromDomain) {
498
503
  return entry;
499
504
  }
@@ -591,5 +596,7 @@ module.exports = {
591
596
 
592
597
  getPtrHostname,
593
598
 
594
- getCurTime
599
+ getCurTime,
600
+
601
+ TLDTS_OPTS
595
602
  };
package/man/mailauth.1 CHANGED
@@ -1,4 +1,4 @@
1
- .TH "MAILAUTH" "1" "May 2024" "v4.6.7" "Mailauth Help"
1
+ .TH "MAILAUTH" "1" "June 2024" "v4.6.8" "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.6.7",
3
+ "version": "4.6.8",
4
4
  "description": "Email authentication library for Node.js",
5
5
  "main": "lib/mailauth.js",
6
6
  "scripts": {
@@ -41,7 +41,7 @@
41
41
  "license-report": "6.5.0",
42
42
  "marked": "0.7.0",
43
43
  "marked-man": "0.7.0",
44
- "mbox-reader": "1.1.5",
44
+ "mbox-reader": "1.2.0",
45
45
  "mocha": "10.4.0"
46
46
  },
47
47
  "dependencies": {
@@ -52,7 +52,7 @@
52
52
  "libmime": "5.3.5",
53
53
  "nodemailer": "6.9.13",
54
54
  "punycode.js": "2.3.1",
55
- "tldts": "6.1.23",
55
+ "tldts": "6.1.24",
56
56
  "undici": "5.28.4",
57
57
  "uuid": "9.0.1",
58
58
  "yargs": "17.7.2"