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 2.3.0 to 2.3.1

6

cli.md

@@ -26,2 +26,8 @@ # CLI USAGE

Alternatively you can install `mailauth` from [npm](https://npmjs.com/package/mailauth).
```
npm install -g mailauth
```
## Help

@@ -28,0 +34,0 @@

6

lib/tools.js

@@ -276,3 +276,7 @@ /* eslint no-control-regex: 0 */

const publicKeyPem = Buffer.from(`-----BEGIN PUBLIC KEY-----\n${publicKeyValue.replace(/.{64}/g, '$&\r\n')}\n-----END PUBLIC KEY-----`);
let paddingNeeded = publicKeyValue.length % 4 ? 4 - (publicKeyValue.length % 4) : 0;
const publicKeyPem = Buffer.from(
`-----BEGIN PUBLIC KEY-----\n${(publicKeyValue + '='.repeat(paddingNeeded)).replace(/.{64}/g, '$&\n')}\n-----END PUBLIC KEY-----`
);
const publicKeyObj = crypto.createPublicKey({

@@ -279,0 +283,0 @@ key: publicKeyPem,

22

man/man.md

@@ -15,3 +15,3 @@ # mailauth(1)

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.
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.

@@ -53,3 +53,3 @@ ## COMMANDS

Email argument defines path to the email message file in EML format. If not specified then
Email argument defines the path to the email message file in EML format. If not specified, then
content is read from standard input.

@@ -66,6 +66,6 @@

- `--client-ip`, `-i <ip>`
Client IP used for SPF checks. If not set then parsed from the latest Received header. (`report`, `seal`, `spf`)
Client IP used for SPF checks. If not set, then parsed from the latest Received header. (`report`, `seal`, `spf`)
- `--mta`, `-m <hostname>`
Hostname of this machine, used in the Authentication-Results header. (`report`, `seal`, `spf`)
The hostname of this machine, used in the `Authentication-Results` header. (`report`, `seal`, `spf`)

@@ -76,6 +76,6 @@ - `--helo`, `-e <hostname>`

- `--sender`, `-f <address>`
Email address from the `MAIL FROM` command. If not set then the address from the latest _Return-Path_ header is used instead. (`report`, `seal`, `spf`)
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`)
- `--dns-cache`, `-n <file>`
Path to a JSON file with cached DNS responses. If this file is given then no actual DNS requests are performed. (`report`, `seal`, `spf`)
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`)

@@ -98,6 +98,6 @@ - `--private-key`, `-k <file>`

- `--body-length`, `-l <number>`
'Maximum length of canonicalizated body to sign. (`sign`)
The maximum length of the canonicalized body to sign. (`sign`)
- `--time`, `-t <number>`
Signing time as a unix timestamp. (`sign`, `seal`)
Signing time as a Unix timestamp. (`sign`, `seal`)

@@ -108,3 +108,3 @@ - `--header-fields`, `-h <list>`

- `--headers-only`, `-o`
Return signing headers only. By default the entire message is printed to console. (`sign`, `seal`, `spf`)
Return signing headers only. By default, the entire message is printed to the console. (`sign`, `seal`, `spf`)

@@ -116,3 +116,3 @@ - `--max-lookups`, `-x`

For cached DNS requests use the following JSON structure where main keys are domain names and subkeys are rr types.
For cached DNS requests, use the following JSON object structure: primary keys are domain names, and subkeys are resource record types.

@@ -132,3 +132,3 @@ ```

Longer TXT strings can be split into multiple strings. Unlike in real DNS there is no length limit, so you can put the entire public key into a single string.
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.

@@ -135,0 +135,0 @@ ## BUGS

{
"name": "mailauth",
"version": "2.3.0",
"version": "2.3.1",
"description": "Email authentication library for Node.js",

@@ -10,3 +10,3 @@ "main": "lib/mailauth.js",

"man": "cd man && marked-man --version `node -e \"console.log('v'+require('../package.json').version)\"` --manual 'Mailauth Help' --section 1 man.md > mailauth.1",
"build-dist": "npm run man && npm run licenses && pkg package.json",
"build-dist": "npm run man && npm run licenses && pkg --compress Brotli package.json",
"licenses": "license-report --only=prod --output=table --config license-report-config.json > licenses.txt"

@@ -64,5 +64,5 @@ },

},
"directories": {
"man": "man"
},
"man": [
"man/mailauth.1"
],
"pkg": {

@@ -69,0 +69,0 @@ "scripts": [

@@ -16,3 +16,3 @@ ![](https://github.com/postalsys/mailauth/raw/master/assets/mailauth.png)

Pure JavaScript implementation, no external applications or compilation needed. Runs on any server/device that has Node 14+ installed.
Pure JavaScript implementation, no external applications or compilation needed. It runs on any server/device that has Node 14+ installed.

@@ -27,3 +27,3 @@ ## Command line usage

Validate DKIM signatures, SPF, DMARC, ARC and BIMI for an email.
Validate DKIM signatures, SPF, DMARC, ARC, and BIMI for an email.

@@ -37,19 +37,19 @@ ```js

- **message** is either a String, a Buffer or a Readable stream that represents an email message
- **message** is either a String, a Buffer, or a Readable stream that represents an email message
- **options** (_object_) is an optional options object
- **sender** (_string_) is the email address from MAIL FROM command. If not set then it is parsed from the `Return-Path` header
- **ip** (_string_) is the IP of remote client that sent this message
- **sender** (_string_) is the email address from MAIL FROM command. If not set, then it is parsed from the `Return-Path` header
- **ip** (_string_) is the IP of the remote client that sent this message
- **helo** (_string_) is the hostname value from HELO/EHLO command
- **trustReceived** (_boolean_) if true then parses values for `ip` and `helo` from the latest `Received` header if you have not set these values yourself. Defaults to `false`
- **trustReceived** (_boolean_) if true, then parses values for `ip` and `helo` from the latest `Received` header if you have not set these values yourself. Defaults to `false`.
- **mta** (_string_) is the hostname of the server performing the authentication (defaults to `os.hostname()`)
- **minBitLength** (_number_) is the minimum allowed bits of RSA public keys (defaults to 1024). If a DKIM or ARC key has less bits, then validation is considered as failed
- **minBitLength** (_number_) is the minimum allowed bits of RSA public keys (defaults to 1024). If a DKIM or ARC key has fewer bits, then validation is considered as failed
- **disableArc** (_boolean_) if true then skip ARC checks
- **disableDmarc** (_boolean_) if true then skip DMARC checks. This also disables checks that are dependent on DMARC (eg. BIMI)
- **disableBimi** (_boolean_) if true then skip BIMI checks
- **disableDmarc** (_boolean_) if true then skip DMARC checks. It also disables checks that are dependent on DMARC (e.g., BIMI)
- **disableBimi** (_boolean_) if true, then skip BIMI checks
- **seal** (_object_) if set and message does not have a broken ARC chain, then seals the message using these values
- **signingDomain** (_string_) ARC key domain name
- **selector** (_string_) ARC key selector
- **privateKey** (_string_ or _buffer_) Private key for signing. Can be a RSA or an Ed25519 key
- **privateKey** (_string_ or _buffer_) Private key for signing. Either an RSA or an Ed25519 key
- **resolver** (_async function_) is an optional async function for DNS requests. Defaults to [dns.promises.resolve](https://nodejs.org/api/dns.html#dns_dnspromises_resolve_hostname_rrtype)
- **maxResolveCount** (_number_ defaults to _50_) is the DNS lookup limit for SPF. [RFC7208](https://datatracker.ietf.org/doc/html/rfc7208#section-4.6.4) requires this limit to be 10, mailauth is less strict and defaults to 50.
- **maxResolveCount** (_number_ defaults to _50_) is the DNS lookup limit for SPF. [RFC7208](https://datatracker.ietf.org/doc/html/rfc7208#section-4.6.4) requires this limit to be 10. Mailauth is less strict and defaults to 50.

@@ -96,7 +96,7 @@ **Example**

You can see full output (structured data for DKIM, SPF, DMARC and ARC) from [this example](https://gist.github.com/andris9/6514b5e7c59154a5b08636f99052ce37).
You can see the full output (structured data for DKIM, SPF, DMARC, and ARC) from [this example](https://gist.github.com/andris9/6514b5e7c59154a5b08636f99052ce37).
### receivedChain
`receivedChain` property is an array of parsed representations of the `Received:` headers
`receivedChain` property is an array of parsed representations of the `Received:` headers.

@@ -139,3 +139,3 @@ ## DKIM

// Maximum number of canonicalizated body bytes to sign (eg. the "l=" tag).
// Maximum number of canonicalized body bytes to sign (eg. the "l=" tag).
// Do not use though. This is available only for compatibility testing.

@@ -224,3 +224,3 @@ // maxBodyLength: 12345

Output being something like this:
The output is something like this:

@@ -242,3 +242,3 @@ ```

You can seal messages with ARC automatically in the authentication step by providing the sealing key. In this case you can not modify the message anymore as this would break the seal.
You can seal messages with ARC automatically in the authentication step by providing the sealing key. In this case, you can not modify the message any more as this would break the seal.

@@ -268,3 +268,3 @@ ```js

If you want to modify the message before sealing then you have to authenticate the message first and then use authentication results as input for the sealing step.
If you want to modify the message before sealing, you have to authenticate the message first and then use authentication results as input for the sealing step.

@@ -308,3 +308,3 @@ ```js

BIMI information is resolved in the authentication step and the results can be found from the `bimi` property. Message must pass DMARC validation in order to be processed for BIMI. DMARC policy can not be "none" for BIMI to pass.
BIMI information is resolved in the authentication step, and the results can be found from the `bimi` property. The message must pass DMARC validation to be processed for BIMI. DMARC policy can not be "none" for BIMI to pass.

@@ -326,3 +326,3 @@ ```js

`BIMI-Location` header is ignored by `mailauth`, it is not checked for and it is not modified in any way if it is present. `BIMI-Selector` is used for selector selection (if available).
`BIMI-Location` header is ignored by `mailauth`, it is not checked for, and it is not modified in any way if it is present. `BIMI-Selector` is used for selector selection (if available).

@@ -340,3 +340,3 @@ ### Verified Mark Certificate

You can parse logos from these certificate files by using the `parseLogoFromX509` function
You can parse logos from these certificate files using the `parseLogoFromX509` function.

@@ -348,3 +348,3 @@ ```js

> **NB!** `parseLogoFromX509` does not verify the validity of the VMC certificate. It could be self signed or expired and still be processed.
> **NB!** `parseLogoFromX509` does not verify the validity of the VMC certificate. It could be self-signed or expired and still be processed.

@@ -387,6 +387,6 @@ ## MTA-STS

- **domain** is the domain to check for (eg. "gmail.com")
- **knownPolicy** (optional) is the policy object from last check for this domain. This is used to check if the policy is still valid or it was updated.
- **domain** is the domain to check for (e.g. "gmail.com")
- **knownPolicy** (optional) is the policy object from the last check for this domain. This is used to check if the policy is still valid or it was updated.
Function returns an object with the following properties:
The function returns an object with the following properties:

@@ -403,7 +403,7 @@ - **policy** (object)

- _"renew"_ existing policy is still valid, renew cached version until _policy.expires_
- _"errored"_ policy discovery failed for some temporary error (eg. failing DNS queries). See _policy.error_ for details
- _"errored"_ policy discovery failed for some temporary error (e.g., failing DNS queries). See _policy.error_ for details
### Validate MX hostname
Check if a resolved MX hostname is valid by MTA-STS policy or not
Check if a resolved MX hostname is valid by MTA-STS policy or not.

@@ -419,3 +419,3 @@ ```

Function returns a boolean. If it is `true` then MX hostname is allowed to use.
The function returns a boolean. If it is `true`, then MX hostname is allowed to use.

@@ -430,7 +430,7 @@ ## Testing

- No PTR support in `mailauth`, all PTR related tests are ignored
- Less strict whitespace checks (`mailauth` accepts multiple spaces between tags etc)
- No PTR support in `mailauth`. All PTR related tests are ignored
- Less strict whitespace checks (`mailauth` accepts multiple spaces between tags etc.)
- Some macro tests are skipped (macro expansion is supported _in most parts_)
- Some tests where invalid component is listed after a matching part (mailauth processes from left to right and returns on first match found)
- Other than that all tests pass
- Some tests where the invalid component is listed after a matching part (mailauth processes from left to right and returns on the first match found)
- Other than that, all tests pass

@@ -441,9 +441,9 @@ ### ARC test suite from ValiMail

- `mailauth` is less strict on header tags and casing, for example uppercase `S=` for a selector passes in `mailauth` but fails in ValiMail.
- Signing test suite is used for input only. All listed messages are signed using provided keys but signatures are not matched against reference. Instead `mailauth` validates the signatures itself and looks for the same cv= output that the ARC-Seal header in the test suite has
- Other than that all tests pass
- `mailauth` is less strict on header tags and casing. For example, uppercase `S=` for a selector passes in `mailauth` but fails in ValiMail.
- Signing test suite is used for input only. All listed messages are signed using provided keys, but signatures are not matched against the reference. Instead, `mailauth` validates the signatures itself and looks for the same cv= output that the ARC-Seal header in the test suite has
- Other than that, all tests pass
## Setup
First install the module from npm:
First, install the module from npm:

@@ -450,0 +450,0 @@ ```

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