New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

otm-detector

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

otm-detector - npm Package Compare versions

Comparing version 1.0.3 to 1.1.0

CHANGELOG.md

18

index.js

@@ -5,3 +5,7 @@ import dns from "node:dns/promises";

"mail.onetimemail.org",
"mx.mail-data.net",
])
const OTM_IPS = new Set([
"167.172.1.68"
])
export const isOneTimeMail = async (domain, options = {}) => {

@@ -11,3 +15,15 @@ const otmDns = options.dns || dns;

const records = await otmDns.resolveMx(domain)
return records.some((record) => OTM_HOSTS.has(record.exchange))
if (records.length === 0) { // this email is invalid, but we are not a validator
return false
}
if (records.some((record) => OTM_HOSTS.has(record.exchange))) {
return true
}
// check first record for new
const mxHost = records[0].exchange
const mxAddresses = await otmDns.resolve4(mxHost)
if (mxAddresses.some((address) => OTM_IPS.has(address))) {
return true
}
return false;
} catch (e) {

@@ -14,0 +30,0 @@ if (e.code === "ENOTFOUND") {

@@ -12,2 +12,3 @@ import test from "node:test";

mx: ["smtp.google.com"],
a: ["64.233.180.26", "142.251.163.27"],
result: false,

@@ -25,6 +26,12 @@ },

},
{
domain: "bad-ip.com",
mx: ["mail.bad-ip.com"],
result: true,
a: ["167.172.1.68"],
}
];
for (const domain of domains) {
test(`Check if ${domain.domain} has ${domain.mx} as MX`, async (t) => {
test(`Check if ${domain.domain} has ${domain.mx}`, async (t) => {
assert.equal(

@@ -39,2 +46,8 @@ await isOneTimeMail(domain.domain, {

},
resolve4: async (host) => {
if (domain.a instanceof Error) {
throw domain.a;
}
return domain.a;
}
},

@@ -41,0 +54,0 @@ }),

2

package.json
{
"name": "otm-detector",
"version": "1.0.3",
"version": "1.1.0",
"description": "Detect one-time mail services, the new way",

@@ -5,0 +5,0 @@ "main": "index.js",

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