@meffecta/agent 1.0.16 → 1.1.0
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/engine.json +2 -2
- package/lib/doctor.js +26 -0
- package/package.json +1 -1
package/engine.json
CHANGED
package/lib/doctor.js
CHANGED
|
@@ -76,6 +76,7 @@ export function readLocalJobs(dir) {
|
|
|
76
76
|
cron: meta.cron,
|
|
77
77
|
webhook: meta.webhook,
|
|
78
78
|
inbox: meta.inbox,
|
|
79
|
+
requireAuth: meta.requireAuth,
|
|
79
80
|
systems: meta.systems,
|
|
80
81
|
disabled: meta.disabled === "true",
|
|
81
82
|
});
|
|
@@ -332,6 +333,31 @@ export async function doctor() {
|
|
|
332
333
|
r.ok("Content repo", `${local.length} job(s) on disk, all registered`);
|
|
333
334
|
}
|
|
334
335
|
|
|
336
|
+
// --- what inbound mail has to prove ------------------------------------------
|
|
337
|
+
// allowFrom: matches the From: header, which is free text. Without an authentication
|
|
338
|
+
// requirement it is a list of names anyone can put on a message.
|
|
339
|
+
const inboxJobs = local.filter((j) => j.inbox);
|
|
340
|
+
const badAuth = inboxJobs.filter(
|
|
341
|
+
(j) =>
|
|
342
|
+
j.requireAuth &&
|
|
343
|
+
(!j.inbox.startsWith("gmail:") ||
|
|
344
|
+
j.requireAuth.split(",").some((v) => !["dmarc", "dkim"].includes(v.trim().toLowerCase()))),
|
|
345
|
+
);
|
|
346
|
+
const unauthenticated = inboxJobs.filter((j) => j.inbox.startsWith("gmail:") && !j.requireAuth);
|
|
347
|
+
if (badAuth.length) {
|
|
348
|
+
r.fail(
|
|
349
|
+
"An inbox job has a requireAuth: it cannot honor",
|
|
350
|
+
`${badAuth.map((j) => `${j.name}: ${j.requireAuth}`).join("; ")}. Known values are dmarc and dkim, and only on a gmail: inbox — AgentMail authenticates mail itself and reports no verdict to check. Such a job refuses every message.`,
|
|
351
|
+
"Fix the value, or remove the line",
|
|
352
|
+
);
|
|
353
|
+
} else if (unauthenticated.length) {
|
|
354
|
+
r.warn(
|
|
355
|
+
`${unauthenticated.length} inbox job(s) accept an unverified From address`,
|
|
356
|
+
`${unauthenticated.map((j) => j.name).join(", ")} — allowFrom: matches a header anyone can forge. The verdict is recorded on every message either way, so look at what real mail scores before switching this on.`,
|
|
357
|
+
"Add requireAuth: dmarc to the job",
|
|
358
|
+
);
|
|
359
|
+
}
|
|
360
|
+
|
|
335
361
|
// --- what each job may reach ------------------------------------------------
|
|
336
362
|
const register = readLocalSystems(`${process.cwd()}/systems`);
|
|
337
363
|
if (register) {
|