otm-detector
Advanced tools
+9
-2
@@ -8,4 +8,11 @@ import dns from "node:dns/promises"; | ||
| const otmDns = options.dns || dns; | ||
| const records = await otmDns.resolveMx(domain) | ||
| return records.some((record) => OTM_HOSTS.has(record.exchange)) | ||
| try { | ||
| const records = await otmDns.resolveMx(domain) | ||
| return records.some((record) => OTM_HOSTS.has(record.exchange)) | ||
| } catch (e) { | ||
| if (e.code === "ENOTFOUND") { | ||
| return false | ||
| } | ||
| throw e | ||
| } | ||
| }; |
+19
-4
@@ -5,2 +5,5 @@ import test from "node:test"; | ||
| const ENOTFOUND = new Error("ENOTFOUND"); | ||
| ENOTFOUND.code = "ENOTFOUND"; | ||
| const domains = [ | ||
@@ -17,10 +20,22 @@ { | ||
| }, | ||
| { | ||
| domain: "uentiheunsthieunst.com", | ||
| mx: ENOTFOUND, | ||
| result: false, | ||
| }, | ||
| ]; | ||
| for (const domain of domains) { | ||
| test(`Check if ${domain.domain} has ${domain.mx.join(", ")} as MX`, async (t) => { | ||
| test(`Check if ${domain.domain} has ${domain.mx} as MX`, async (t) => { | ||
| assert.equal( | ||
| await isOneTimeMail(domain.domain, { dns: { | ||
| resolveMx: async () => domain.mx.map((exchange) => ({ exchange })), | ||
| }}), | ||
| await isOneTimeMail(domain.domain, { | ||
| dns: { | ||
| resolveMx: async () => { | ||
| if (domain.mx instanceof Error) { | ||
| throw domain.mx; | ||
| } | ||
| return domain.mx.map((exchange) => ({ exchange })); | ||
| }, | ||
| }, | ||
| }), | ||
| domain.result | ||
@@ -27,0 +42,0 @@ ); |
+1
-1
| { | ||
| "name": "otm-detector", | ||
| "version": "1.0.1", | ||
| "version": "1.0.3", | ||
| "description": "Detect one-time mail services, the new way", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
4657
9.99%59
55.26%