mailauth 4.8.2 → 4.8.4

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 CHANGED
@@ -1,15 +1,12 @@
1
1
  module.exports = {
2
2
  upgrade: true,
3
3
  reject: [
4
- 'marked',
5
- 'marked-man',
6
4
  // only works as ESM
7
5
  'chai',
8
-
9
- // Fails in Node 16
10
- 'undici',
6
+ 'fast-xml-parser',
11
7
 
12
8
  // fix later
13
- 'eslint'
9
+ 'eslint',
10
+ 'eslint-config-prettier'
14
11
  ]
15
12
  };
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.8.4](https://github.com/postalsys/mailauth/compare/v4.8.3...v4.8.4) (2025-04-21)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **bimi:** Bumped VMC module to add support for GLobalSign VMC root ([d0e9ecf](https://github.com/postalsys/mailauth/commit/d0e9ecf89b699aae8ad9953445f052b558250f5a))
9
+
10
+ ## [4.8.3](https://github.com/postalsys/mailauth/compare/v4.8.2...v4.8.3) (2025-04-20)
11
+
12
+
13
+ ### Bug Fixes
14
+
15
+ * protect against prototype pollution ([3b7515d](https://github.com/postalsys/mailauth/commit/3b7515df768ce1d2e4e02858fdfca8efca6243fb))
16
+
3
17
  ## [4.8.2](https://github.com/postalsys/mailauth/compare/v4.8.1...v4.8.2) (2024-12-19)
4
18
 
5
19
 
Binary file
package/lib/bimi/index.js CHANGED
@@ -13,7 +13,9 @@ const httpsSchema = Joi.string().uri({
13
13
  const FETCH_TIMEOUT = 5 * 1000;
14
14
 
15
15
  const { fetch: fetchCmd, Agent } = require('undici');
16
- const fetchAgent = new Agent({ connect: { timeout: FETCH_TIMEOUT } });
16
+ const fetchAgent = new Agent({
17
+ connect: { timeout: FETCH_TIMEOUT }
18
+ });
17
19
 
18
20
  const { vmc } = require('@postalsys/vmc');
19
21
  const { validateSvg } = require('./validate-svg');
@@ -279,13 +279,15 @@ const headerParser = buf => {
279
279
  entry.comment = part.comment;
280
280
  }
281
281
 
282
- if (['arc-authentication-results', 'authentication-results'].includes(headerKey) && part.key === 'dkim') {
283
- if (!result[part.key]) {
284
- result[part.key] = [];
282
+ if (part.key && !['__proto__', 'constructor'].includes(part.key)) {
283
+ if (['arc-authentication-results', 'authentication-results'].includes(headerKey) && part.key === 'dkim') {
284
+ if (!result[part.key]) {
285
+ result[part.key] = [];
286
+ }
287
+ result[part.key].push(entry);
288
+ } else {
289
+ result[part.key] = entry;
285
290
  }
286
- result[part.key].push(entry);
287
- } else {
288
- result[part.key] = entry;
289
291
  }
290
292
  });
291
293
 
package/package.json CHANGED
@@ -1,14 +1,13 @@
1
1
  {
2
2
  "name": "mailauth",
3
- "version": "4.8.2",
3
+ "version": "4.8.4",
4
4
  "description": "Email authentication library for Node.js",
5
5
  "main": "lib/mailauth.js",
6
6
  "scripts": {
7
7
  "test": "eslint \"lib/**/*.js\" \"test/**/*.js\" && mocha --recursive \"./test/**/*.js\" --reporter spec",
8
- "prepublish": "npm run man || true",
9
- "man": "cd man && marked-man --version `node -e \"console.log('v'+require('../package.json').version)\"` --manual 'Mailauth Help' --section 1 man.md > mailauth.1",
10
- "build-source": "rm -rf node_modules package-lock.json && npm install && npm run man && npm run licenses && rm -rf node_modules package-lock.json && npm install --production && rm -rf package-lock.json",
11
- "build-dist": "npx pkg --compress Brotli package.json && rm -rf package-lock.json && npm install",
8
+ "build-source": "rm -rf node_modules package-lock.json && npm install && npm run licenses && rm -rf node_modules package-lock.json && npm install --production && rm -rf package-lock.json",
9
+ "build-dist": "npx pkg --compress Brotli package.json && rm -rf package-lock.json && npm install && node winconf.js",
10
+ "build-dist-fast": "pkg --debug package.json && npm install && node winconf.js",
12
11
  "licenses": "license-report --only=prod --output=table --config license-report-config.json > licenses.txt",
13
12
  "update": "rm -rf node_modules package-lock.json && npx ncu -u && npm install"
14
13
  },
@@ -38,36 +37,31 @@
38
37
  "eslint-config-nodemailer": "1.2.0",
39
38
  "eslint-config-prettier": "9.1.0",
40
39
  "js-yaml": "4.1.0",
41
- "license-report": "6.7.1",
42
- "marked": "0.7.0",
43
- "marked-man": "0.7.0",
40
+ "license-report": "6.7.2",
44
41
  "mbox-reader": "1.2.0",
45
- "mocha": "11.0.1"
42
+ "mocha": "11.1.0",
43
+ "resedit": "^2.0.3"
46
44
  },
47
45
  "dependencies": {
48
- "@postalsys/vmc": "1.1.0",
49
- "fast-xml-parser": "4.5.1",
46
+ "@postalsys/vmc": "1.1.1",
47
+ "fast-xml-parser": "4.5.2",
50
48
  "ipaddr.js": "2.2.0",
51
49
  "joi": "17.13.3",
52
50
  "libmime": "5.3.6",
53
- "nodemailer": "6.9.16",
51
+ "nodemailer": "6.10.1",
54
52
  "punycode.js": "2.3.1",
55
- "tldts": "6.1.68",
56
- "undici": "5.28.4",
53
+ "tldts": "7.0.1",
54
+ "undici": "7.8.0",
57
55
  "yargs": "17.7.2"
58
56
  },
59
57
  "engines": {
60
- "node": ">=16.0.0"
58
+ "node": ">=18.0.0"
61
59
  },
62
60
  "bin": {
63
61
  "mailauth": "bin/mailauth.js"
64
62
  },
65
- "man": [
66
- "man/mailauth.1"
67
- ],
68
63
  "pkg": {
69
64
  "assets": [
70
- "man/**/*",
71
65
  "licenses.txt",
72
66
  "LICENSE.txt"
73
67
  ],
package/winconf.js ADDED
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ const { load } = require('resedit/cjs');
4
+ const PackageData = require('./package.json');
5
+
6
+ const { readFileSync, writeFileSync } = require('fs');
7
+
8
+ const options = {
9
+ in: './ee-dist/mailauth-win-x64.exe',
10
+ out: './ee-dist/mailauth-win-x64.exe',
11
+ version: PackageData.version,
12
+ properties: {
13
+ LegalCopyright: 'Postal Systems OÜ',
14
+ FileDescription: 'mailauth provides a command-line utility for email authentication',
15
+ ProductName: 'mailauth'
16
+ },
17
+ icon: 'assets/mailauth.ico'
18
+ };
19
+
20
+ const language = {
21
+ lang: 1033,
22
+ codepage: 1200
23
+ };
24
+
25
+ load().then(ResEdit => {
26
+ // Modify .exe w/ ResEdit
27
+ const data = readFileSync(options.in);
28
+ const executable = ResEdit.NtExecutable.from(data);
29
+ const res = ResEdit.NtExecutableResource.from(executable);
30
+ const vi = ResEdit.Resource.VersionInfo.fromEntries(res.entries)[0];
31
+
32
+ // Remove original filename
33
+ vi.removeStringValue(language, 'OriginalFilename');
34
+ vi.removeStringValue(language, 'InternalName');
35
+
36
+ // Product version
37
+ if (options.version) {
38
+ // Convert version to tuple of 3 numbers
39
+ const version = options.version
40
+ .split('.')
41
+ .map(v => Number(v) || 0)
42
+ .slice(0, 3);
43
+
44
+ // Update versions
45
+ vi.setProductVersion(...version, 0, language.lang);
46
+ vi.setFileVersion(...version, 0, language.lang);
47
+ }
48
+
49
+ // Add additional user specified properties
50
+ if (options.properties) {
51
+ vi.setStringValues(language, options.properties);
52
+ }
53
+
54
+ vi.outputToResourceEntries(res.entries);
55
+
56
+ // Add icon
57
+ if (options.icon) {
58
+ const iconFile = ResEdit.Data.IconFile.from(readFileSync(options.icon));
59
+ ResEdit.Resource.IconGroupEntry.replaceIconsForResource(
60
+ res.entries,
61
+ 1,
62
+ language.lang,
63
+ iconFile.icons.map(item => item.data)
64
+ );
65
+ }
66
+
67
+ // Regenerate and write to .exe
68
+ res.outputResource(executable);
69
+ writeFileSync(options.out, Buffer.from(executable.generate()));
70
+ });
package/man/mailauth.1 DELETED
@@ -1,145 +0,0 @@
1
- .TH "MAILAUTH" "1" "December 2024" "v4.8.2" "Mailauth Help"
2
- .SH "NAME"
3
- \fBmailauth\fR
4
- .QP
5
- .P
6
- mailauth \- authenticate, sign and seal emails
7
-
8
- .
9
- .SH SYNOPSIS
10
- .P
11
- \fBmailauth\fP \fIcommand\fR [ \fIcommand_opts\fR ] [ \fIemail\fR ]
12
- .P
13
- \fBmailauth help\fP
14
- .P
15
- \fBmailauth\fP \fIcommand\fR \fBhelp\fP
16
- .SH DESCRIPTION
17
- .P
18
- Mailauth is an email authentication application to validate SPF, DKIM, DMARC, and ARC\. You can also sign emails with DKIM digital signatures and seal messages with ARC\.
19
- .SH COMMANDS
20
- .P
21
- \fBreport\fR
22
- .br
23
- Validate an email message and return a report in JSON format
24
- .P
25
- \fBsign\fR
26
- .br
27
- Sign an email with a DKIM digital signature
28
- .P
29
- \fBseal\fR
30
- .br
31
- Authenticates an email and seals it with an ARC digital signature
32
- .P
33
- \fBspf\fR
34
- .br
35
- Authenticates SPF for an IP address and email address
36
- .P
37
- \fBlicense\fR
38
- .br
39
- Display licenses for mailauth and included modules
40
- .SH Website
41
- .P
42
- \fIhttps://github\.com/postalsys/mailauth\fR
43
- .SH EXAMPLES
44
- .P
45
- \fBnpm install mailauth \-g\fP
46
- .P
47
- \fBmailauth report /path/to/email\.eml\fP
48
- .P
49
- \fBcat /path/to/email\.eml | mailauth report\fP
50
- .P
51
- \fBmailauth sign /path/to/email\.eml \-d kreata\.ee \-s test \-k /path/to/key\fP
52
- .P
53
- \fBmailauth spf \-f andris@wildduck\.email \-i 217\.146\.76\.20\fP
54
- .SH EMAIL ARGUMENT
55
- .P
56
- Email argument defines the path to the email message file in EML format\. If not specified, then
57
- content is read from standard input\.
58
- .SH OPTIONS
59
- .RS 0
60
- .IP \(bu 2
61
- \fB\-\-verbose\fP, \fB\-v\fP
62
- Enable silly verbose mode
63
- .IP \(bu 2
64
- \fB\-\-version\fP
65
- Print application version
66
- .IP \(bu 2
67
- \fB\-\-client\-ip\fP, \fB\-i <ip>\fP
68
- Client IP used for SPF checks\. If not set, then parsed from the latest Received header\. (\fBreport\fP, \fBseal\fP, \fBspf\fP)
69
- .IP \(bu 2
70
- \fB\-\-mta\fP, \fB\-m <hostname>\fP
71
- The hostname of this machine, used in the \fBAuthentication\-Results\fP header\. (\fBreport\fP, \fBseal\fP, \fBspf\fP)
72
- .IP \(bu 2
73
- \fB\-\-helo\fP, \fB\-e <hostname>\fP
74
- Client hostname from the EHLO/HELO command, used in some specific SPF checks\. (\fBreport\fP, \fBseal\fP, \fBspf\fP)
75
- .IP \(bu 2
76
- \fB\-\-sender\fP, \fB\-f <address>\fP
77
- The email address from the \fBMAIL FROM\fP command\. If not set, the address from the latest \fIReturn\-Path\fR header is used instead\. (\fBreport\fP, \fBseal\fP, \fBspf\fP)
78
- .IP \(bu 2
79
- \fB\-\-dns\-cache\fP, \fB\-n <file>\fP
80
- Path to a JSON file with cached DNS responses\. If this file is given, then no actual DNS requests are performed\. Anything that is not listed returns an \fBENOTFOUND\fP error\. (\fBreport\fP, \fBseal\fP, \fBspf\fP)
81
- .IP \(bu 2
82
- \fB\-\-private\-key\fP, \fB\-k <file>\fP
83
- Path to a private key for signing\. Allowed key types are RSA and Ed25519 (\fBsign\fP, \fBseal\fP)
84
- .IP \(bu 2
85
- \fB\-\-domain\fP, \fB\-d <domain>\fP
86
- Domain name for signing\. (\fBsign\fP, \fBseal\fP)
87
- .IP \(bu 2
88
- \fB\-\-selector\fP, \fB\-s <selector>\fP
89
- Key selector for signing\. (\fBsign\fP, \fBseal\fP)
90
- .IP \(bu 2
91
- \fB\-\-algo\fP, \fB\-a <algo>\fP
92
- Signing algorithm\. Defaults either to \fIrsa\-sha256\fR or \fIed25519\-sha256\fR depending on the private key format\. (\fBsign\fP, \fBseal\fP)
93
- .IP \(bu 2
94
- \fB\-\-canonicalization\fP, \fB\-c <algo>\fP
95
- Canonicalization algorithm\. Defaults to \fIrelaxed/relaxed\fR\|\. (\fBsign\fP)
96
- .IP \(bu 2
97
- \fB\-\-body\-length\fP, \fB\-l <number>\fP
98
- The maximum length of the canonicalized body to sign\. (\fBsign\fP)
99
- .IP \(bu 2
100
- \fB\-\-time\fP, \fB\-t <number>\fP
101
- Signing time as a Unix timestamp\. (\fBsign\fP, \fBseal\fP)
102
- .IP \(bu 2
103
- \fB\-\-header\-fields\fP, \fB\-h <list>\fP
104
- Colon separated list of header field names to sign\. (\fBsign\fP, \fBseal\fP)
105
- .IP \(bu 2
106
- \fB\-\-headers\-only\fP, \fB\-o\fP
107
- Return signing headers only\. By default, the entire message is printed to the console\. (\fBsign\fP, \fBseal\fP, \fBspf\fP)
108
- .IP \(bu 2
109
- \fB\-\-max\-lookups\fP, \fB\-x\fP
110
- How many DNS lookups allowed for SPF validation\. Defaults to 10\. (\fBreport\fP, \fBspf\fP)
111
- .IP \(bu 2
112
- \fB\-\-max\-void\-lookups\fP, \fB\-z\fP
113
- How many empty DNS lookups allowed for SPF validation\. Defaults to 2\. (\fBreport\fP, \fBspf\fP)
114
-
115
- .RE
116
- .SH DNS CACHE
117
- .P
118
- For cached DNS requests, use the following JSON object structure: primary keys are domain names, and subkeys are resource record types\.
119
- .P
120
- .RS 2
121
- .nf
122
- {
123
- "selector\._domainkey\.example\.com": {
124
- "TXT": [
125
- [
126
- "v=DKIM1;k=rsa;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQ\.\.\.",
127
- "\.\.\.sOLccRAmVAOmacHmayjDROTw/XilzErJj+uVAicGYfs10Nz+EUuwIDAQAB"
128
- ]
129
- ]
130
- }
131
- }
132
- .fi
133
- .RE
134
- .P
135
- You can split longer TXT strings into multiple strings\. There is no length limit, unlike in actual DNS so you can put the entire public key into a single string\.
136
- .SH BUGS
137
- .P
138
- Please report any bugs to https://github\.com/postalsys/mailauth/issues\.
139
- .SH LICENSE
140
- .P
141
- Copyright (c) 2020\-2024, Postal Systems (MIT)\.
142
- .SH SEE ALSO
143
- .P
144
- node\.js(1)
145
-
package/man/man.md DELETED
@@ -1,140 +0,0 @@
1
- # mailauth(1)
2
-
3
- > mailauth - authenticate, sign and seal emails
4
-
5
- ## SYNOPSIS
6
-
7
- `mailauth` _command_ [ _command_opts_ ] [ _email_ ]
8
-
9
- `mailauth help`
10
-
11
- `mailauth` _command_ `help`
12
-
13
- ## DESCRIPTION
14
-
15
- Mailauth is an email authentication application to validate SPF, DKIM, DMARC, and ARC. You can also sign emails with DKIM digital signatures and seal messages with ARC.
16
-
17
- ## COMMANDS
18
-
19
- **report**\
20
- Validate an email message and return a report in JSON format
21
-
22
- **sign**\
23
- Sign an email with a DKIM digital signature
24
-
25
- **seal**\
26
- Authenticates an email and seals it with an ARC digital signature
27
-
28
- **spf**\
29
- Authenticates SPF for an IP address and email address
30
-
31
- **license**\
32
- Display licenses for mailauth and included modules
33
-
34
- ## Website
35
-
36
- [](https://github.com/postalsys/mailauth)
37
-
38
- ## EXAMPLES
39
-
40
- `npm install mailauth -g`
41
-
42
- `mailauth report /path/to/email.eml`
43
-
44
- `cat /path/to/email.eml | mailauth report`
45
-
46
- `mailauth sign /path/to/email.eml -d kreata.ee -s test -k /path/to/key`
47
-
48
- `mailauth spf -f andris@wildduck.email -i 217.146.76.20`
49
-
50
- ## EMAIL ARGUMENT
51
-
52
- Email argument defines the path to the email message file in EML format. If not specified, then
53
- content is read from standard input.
54
-
55
- ## OPTIONS
56
-
57
- - `--verbose`, `-v`
58
- Enable silly verbose mode
59
-
60
- - `--version`
61
- Print application version
62
-
63
- - `--client-ip`, `-i <ip>`
64
- Client IP used for SPF checks. If not set, then parsed from the latest Received header. (`report`, `seal`, `spf`)
65
-
66
- - `--mta`, `-m <hostname>`
67
- The hostname of this machine, used in the `Authentication-Results` header. (`report`, `seal`, `spf`)
68
-
69
- - `--helo`, `-e <hostname>`
70
- Client hostname from the EHLO/HELO command, used in some specific SPF checks. (`report`, `seal`, `spf`)
71
-
72
- - `--sender`, `-f <address>`
73
- The email address from the `MAIL FROM` command. If not set, the address from the latest _Return-Path_ header is used instead. (`report`, `seal`, `spf`)
74
-
75
- - `--dns-cache`, `-n <file>`
76
- Path to a JSON file with cached DNS responses. If this file is given, then no actual DNS requests are performed. Anything that is not listed returns an `ENOTFOUND` error. (`report`, `seal`, `spf`)
77
-
78
- - `--private-key`, `-k <file>`
79
- Path to a private key for signing. Allowed key types are RSA and Ed25519 (`sign`, `seal`)
80
-
81
- - `--domain`, `-d <domain>`
82
- Domain name for signing. (`sign`, `seal`)
83
-
84
- - `--selector`, `-s <selector>`
85
- Key selector for signing. (`sign`, `seal`)
86
-
87
- - `--algo`, `-a <algo>`
88
- Signing algorithm. Defaults either to _rsa-sha256_ or _ed25519-sha256_ depending on the private key format. (`sign`, `seal`)
89
-
90
- - `--canonicalization`, `-c <algo>`
91
- Canonicalization algorithm. Defaults to _relaxed/relaxed_. (`sign`)
92
-
93
- - `--body-length`, `-l <number>`
94
- The maximum length of the canonicalized body to sign. (`sign`)
95
-
96
- - `--time`, `-t <number>`
97
- Signing time as a Unix timestamp. (`sign`, `seal`)
98
-
99
- - `--header-fields`, `-h <list>`
100
- Colon separated list of header field names to sign. (`sign`, `seal`)
101
-
102
- - `--headers-only`, `-o`
103
- Return signing headers only. By default, the entire message is printed to the console. (`sign`, `seal`, `spf`)
104
-
105
- - `--max-lookups`, `-x`
106
- How many DNS lookups allowed for SPF validation. Defaults to 10. (`report`, `spf`)
107
-
108
- - `--max-void-lookups`, `-z`
109
- How many empty DNS lookups allowed for SPF validation. Defaults to 2. (`report`, `spf`)
110
-
111
- ## DNS CACHE
112
-
113
- For cached DNS requests, use the following JSON object structure: primary keys are domain names, and subkeys are resource record types.
114
-
115
- ```
116
- {
117
- "selector._domainkey.example.com": {
118
- "TXT": [
119
- [
120
- "v=DKIM1;k=rsa;p=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQ...",
121
- "...sOLccRAmVAOmacHmayjDROTw/XilzErJj+uVAicGYfs10Nz+EUuwIDAQAB"
122
- ]
123
- ]
124
- }
125
- }
126
- ```
127
-
128
- You can split longer TXT strings into multiple strings. There is no length limit, unlike in actual DNS so you can put the entire public key into a single string.
129
-
130
- ## BUGS
131
-
132
- Please report any bugs to https://github.com/postalsys/mailauth/issues.
133
-
134
- ## LICENSE
135
-
136
- Copyright (c) 2020-2024, Postal Systems (MIT).
137
-
138
- ## SEE ALSO
139
-
140
- node.js(1)