mailery 0.19.0 → 0.19.1

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/dist/index.cjs CHANGED
@@ -3912,7 +3912,7 @@ async function runDnsblChecks(ctx, opts = {}) {
3912
3912
  let listedCount = 0;
3913
3913
  async function processPair(p) {
3914
3914
  const queryName = buildQueryName(p.target, p.targetKind, spamhausQueryHost(p.list.host, cfg.spamhausDqsKey));
3915
- const lookup2 = queryName ? await queryDnsbl(resolver, queryName) : { result: "error", returnCodes: [], errorMessage: "unsupported target format" };
3915
+ const lookup2 = queryName ? await queryDnsbl(resolver, queryName, p.list.host) : { result: "error", returnCodes: [], errorMessage: "unsupported target format" };
3916
3916
  if (lookup2.transient) return;
3917
3917
  if (lookup2.result === "listed") listedCount++;
3918
3918
  await ctx.collections.dnsblChecks.updateOne(
@@ -3973,10 +3973,10 @@ function buildQueryName(target, kind, listHost) {
3973
3973
  return `${domain}.${listHost}`;
3974
3974
  }
3975
3975
  var TRANSIENT_DNS_CODES = /* @__PURE__ */ new Set(["ESERVFAIL", "EREFUSED", "ETIMEOUT", "ETIMEDOUT", "ECONNRESET", "ECONNREFUSED"]);
3976
- async function queryDnsbl(resolver, query) {
3976
+ async function queryDnsbl(resolver, query, listHost) {
3977
3977
  try {
3978
3978
  const records = await resolver.resolve4(query);
3979
- return interpretRecords(records);
3979
+ return interpretRecords(records, listHost);
3980
3980
  } catch (err) {
3981
3981
  const code = err?.code;
3982
3982
  if (code === "ENOTFOUND" || code === "ENODATA") {
@@ -4002,10 +4002,17 @@ var REFUSAL_REASONS = {
4002
4002
  "127.255.255.254": "queried through a public or shared DNS resolver, which Spamhaus blocks. Set dnsbl.spamhausDqsKey (free Spamhaus DQS key) or use a private resolver",
4003
4003
  "127.255.255.255": "this resolver has exceeded the free query limit"
4004
4004
  };
4005
- function interpretRecords(records) {
4005
+ function interpretRecords(records, listHost) {
4006
4006
  if (!records || records.length === 0) {
4007
4007
  return { result: "clean", returnCodes: [], errorMessage: null };
4008
4008
  }
4009
+ if (listHost && REGISTRABLE_ONLY_LISTS.has(listHost) && records.every((r) => r === "127.0.0.1")) {
4010
+ return {
4011
+ result: "error",
4012
+ returnCodes: records,
4013
+ errorMessage: `${listHost} refused the query (127.0.0.1): queried through a public or shared DNS resolver, or over the free query limit. Use a private resolver`
4014
+ };
4015
+ }
4009
4016
  const errorish = records.filter((r) => r.startsWith("127.255.255."));
4010
4017
  if (errorish.length === records.length) {
4011
4018
  const reasons = [...new Set(records.map((r) => REFUSAL_REASONS[r] ?? "unrecognised refusal code"))];
@@ -9572,7 +9579,7 @@ function unitToMs2(value, unit) {
9572
9579
  }
9573
9580
 
9574
9581
  // src/server/api/agent.ts
9575
- var VERSION = "0.19.0" ;
9582
+ var VERSION = "0.19.1" ;
9576
9583
  var broadcastCountSchema = zod.z.object({
9577
9584
  recipientCap: zod.z.number().int().positive().max(1e7).nullable().optional()
9578
9585
  });
@@ -11639,7 +11646,7 @@ var DEDUPE_POLICIES = [
11639
11646
  ];
11640
11647
 
11641
11648
  // src/server/index.ts
11642
- var VERSION2 = "0.19.0" ;
11649
+ var VERSION2 = "0.19.1" ;
11643
11650
 
11644
11651
  exports.DEDUPE_POLICIES = DEDUPE_POLICIES;
11645
11652
  exports.DEFAULT_BOT_UA_RE = DEFAULT_BOT_UA_RE;