@astrofoundry/pi-astro 0.40.75 → 0.40.77

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.
@@ -235,17 +235,17 @@ export class SecurityMonitor {
235
235
  for (const e of events.slice(0, MAX_ORIGIN_CALLS)) {
236
236
  const args = originArgs(e);
237
237
  if (!args) {
238
- out.set(e.id, { verdict: "unchecked", reason: "Wazuh sent no SHA-256 for the new content" });
238
+ out.set(e.id, { verdict: "unchecked", reason: "Wazuh sent no SHA-256" });
239
239
  continue;
240
240
  }
241
241
  try {
242
242
  const verdict = parseOrigin(await this.entryJson("arcane", caller, args, 3 * MINUTE));
243
- out.set(e.id, verdict ?? { error: "change-origin returned an unexpected answer" });
243
+ out.set(e.id, verdict ?? { error: "unexpected change-origin answer" });
244
244
  } catch (err) {
245
245
  out.set(e.id, { error: reason(err) });
246
246
  }
247
247
  }
248
- for (const e of events.slice(MAX_ORIGIN_CALLS)) out.set(e.id, { error: "too many changes in one check; retried next time" });
248
+ for (const e of events.slice(MAX_ORIGIN_CALLS)) out.set(e.id, { error: "too many changes this check; retried next time" });
249
249
  return out;
250
250
  }
251
251
 
@@ -277,7 +277,7 @@ export class SecurityMonitor {
277
277
  state.origins[e.id] = { ...r, at: e.timestamp };
278
278
  ready.push(e);
279
279
  } else if (now - Date.parse(since) >= ORIGIN_RETRY_MS) {
280
- state.origins[e.id] = { verdict: "unchecked", reason: `the origin check kept failing: ${r?.error ?? "no answer"}`, at: e.timestamp };
280
+ state.origins[e.id] = { verdict: "unchecked", reason: `origin check kept failing: ${r?.error ?? "no answer"}`, at: e.timestamp };
281
281
  ready.push(e);
282
282
  } else {
283
283
  pending.push({ event: e, since, error: r?.error ?? "not checked yet" });
@@ -336,7 +336,7 @@ export class SecurityMonitor {
336
336
  failed.push(...group);
337
337
  }
338
338
  }
339
- if (overflow > 0) await this.post(s.channelId, { content: `🚨 ${overflow} more urgent event(s) in this check were not posted one by one; the next Security Daily Report lists them.` });
339
+ if (overflow > 0) await this.post(s.channelId, { content: `🚨 ${overflow} more urgent event(s) this check not posted; the next Security Daily Report lists them.` });
340
340
  for (const e of notices) {
341
341
  if (!(await this.post(s.channelId, { content: noticeText(e, s.timeZone) }))) failed.push(e);
342
342
  }
@@ -380,11 +380,11 @@ export class SecurityMonitor {
380
380
  this.deps.log(`security: attention failed: ${why}`);
381
381
  state.health.failures++;
382
382
  if (state.health.failures >= HEALTH_FAILS_TO_WARN && !state.health.warned) {
383
- state.health.warned = await this.post(s.channelId, { content: `${checksFailingText("the observability VM's health status", (state.health.failures * HEALTH_MS) / MINUTE, why)}\n${tag}`, mentionUsers: owners });
383
+ state.health.warned = await this.post(s.channelId, { content: `${checksFailingText("observability VM health", (state.health.failures * HEALTH_MS) / MINUTE, why)}\n${tag}`, mentionUsers: owners });
384
384
  }
385
385
  return;
386
386
  }
387
- if (state.health.warned) await this.post(s.channelId, { content: checksRecoveredText("the health status") });
387
+ if (state.health.warned) await this.post(s.channelId, { content: checksRecoveredText("health") });
388
388
  state.health.failures = 0;
389
389
  state.health.warned = false;
390
390
  const change = healthChange(state.health.codes, attention.issues);
@@ -425,7 +425,7 @@ export class SecurityMonitor {
425
425
  await this.update((state) => {
426
426
  for (const e of missing) {
427
427
  const r = checks.get(e.id);
428
- state.origins[e.id] = r && !("error" in r) ? { ...r, at: e.timestamp } : { verdict: "unchecked", reason: `the origin check failed: ${r && "error" in r ? r.error : "no answer"}`, at: e.timestamp };
428
+ state.origins[e.id] = r && !("error" in r) ? { ...r, at: e.timestamp } : { verdict: "unchecked", reason: `origin check failed: ${r && "error" in r ? r.error : "no answer"}`, at: e.timestamp };
429
429
  }
430
430
  });
431
431
  }
@@ -559,13 +559,13 @@ export class SecurityMonitor {
559
559
  async onButton(click: SecurityClick): Promise<void> {
560
560
  const kind = parseSecurityButton(click.customId);
561
561
  const reply = (text: string) => this.deps.rest.ephemeralReply(click.interactionId, click.token, text);
562
- if (!kind) return reply("This button is no longer active.");
563
- if (!isOwner(this.deps.config(), click.userId)) return reply("Only owners investigate or acknowledge security alerts.");
564
- if (this.deps.stopping()) return reply("The bridge is restarting; try again in a minute.");
562
+ if (!kind) return reply("Button no longer active.");
563
+ if (!isOwner(this.deps.config(), click.userId)) return reply("Owners only.");
564
+ if (this.deps.stopping()) return reply("Bridge restarting; retry in a minute.");
565
565
  const found = readSecurityState().alerts.find((a) => a.messageId === click.messageId);
566
- if (!found) return reply("This alert is no longer tracked (older than 14 days); ask the security specialist in the channel.");
566
+ if (!found) return reply("Alert no longer tracked (over 14 days old); ask the security specialist in the channel.");
567
567
  if (kind === "ack") return this.onAcknowledge(click, found);
568
- if (found.investigation === "running") return reply("An investigation of this alert is already running; its thread gets the answer.");
568
+ if (found.investigation === "running") return reply("Investigation already running; its thread gets the answer.");
569
569
  await this.deps.rest.deferUpdate(click.interactionId, click.token);
570
570
  await this.runInvestigation(click, found);
571
571
  }
@@ -605,14 +605,14 @@ export class SecurityMonitor {
605
605
  threadId = (await this.deps.rest.startThread(alert.channelId, alert.messageId, `Rule ${alert.event.rule} on ${alert.event.agent}`)).id;
606
606
  } catch (err) {
607
607
  this.deps.log(`security: thread for ${alert.key} failed: ${reason(err)}`);
608
- await this.post(alert.channelId, { content: `❌ Could not open a thread for this alert (${reason(err)}); ask the security specialist in the channel.`, replyTo: alert.messageId });
608
+ await this.post(alert.channelId, { content: `❌ Thread failed to open (${reason(err)}); ask the security specialist in the channel.`, replyTo: alert.messageId });
609
609
  await this.setInvestigation(alert.messageId, "failed");
610
610
  return;
611
611
  }
612
612
  }
613
613
  let ok = false;
614
614
  try {
615
- const starter = await this.deps.rest.createMessage(threadId, { content: `🔎 Investigation requested by <@${click.userId}>. The security specialist reads only and may ask other specialists; a risky read still asks an owner here.` });
615
+ const starter = await this.deps.rest.createMessage(threadId, { content: `🔎 Requested by <@${click.userId}>. The security specialist reads only and may ask other specialists; a risky read asks an owner here.` });
616
616
  await this.setInvestigation(alert.messageId, "running", threadId);
617
617
  ok = await this.deps.investigate({ threadId, starterId: starter.id, userId: click.userId, task: investigationTask(alert) });
618
618
  } catch (err) {
@@ -75,7 +75,7 @@ function texts(components: readonly MessageComponent[]): string[] {
75
75
  }
76
76
 
77
77
  function posted(over: Partial<PostedAlert> = {}): PostedAlert {
78
- return { messageId: "m1", channelId: "c1", key: alertKey(deploy), event: deploy, count: 1, repeat: "first time this week", postedAt: "2026-10-20T12:51:00Z", investigation: "none", ...over };
78
+ return { messageId: "m1", channelId: "c1", key: alertKey(deploy), event: deploy, count: 1, repeat: "first this week", postedAt: "2026-10-20T12:51:00Z", investigation: "none", ...over };
79
79
  }
80
80
 
81
81
  describe("security classification", () => {
@@ -123,7 +123,7 @@ describe("urgent alert message", () => {
123
123
  [
124
124
  "🚨 **Security alert** · level 10 · arcane · rule 100020",
125
125
  "Deployment file changed: /opt/docker/grimoire/compose.yaml. Check against the approved GitOps change.",
126
- "Seen 20 Oct 14:50 CEST · first time this week",
126
+ "Seen 20 Oct 14:50 CEST · first this week",
127
127
  "-# file modified · origin unknown: no GitOps commit has this content",
128
128
  `<@${OWNER}>`,
129
129
  ].join("\n"),
@@ -136,7 +136,7 @@ describe("urgent alert message", () => {
136
136
 
137
137
  it("shows acknowledgement and investigation state on the buttons", () => {
138
138
  const acked = alertComponents(posted({ ack: { by: OWNER, until: "2026-10-27T12:51:00Z" }, investigation: "running" }), [OWNER], TZ);
139
- expect(acked[0].content).toContain(`-# ✅ Acknowledged by <@${OWNER}>; repeats stay quiet until 27 Oct`);
139
+ expect(acked[0].content).toContain(`-# ✅ Acknowledged by <@${OWNER}>; repeats muted until 27 Oct`);
140
140
  expect(acked[1].components?.map((c) => [c.label, c.disabled ?? false])).toEqual([
141
141
  ["Investigating…", true],
142
142
  ["Acknowledged", true],
@@ -154,14 +154,14 @@ describe("urgent alert message", () => {
154
154
 
155
155
  it("counts earlier pages of the same key this week", () => {
156
156
  const now = Date.parse("2026-10-20T12:50:00Z");
157
- expect(repeatText([], "k", now, 1, TZ)).toBe("first time this week");
158
- expect(repeatText([], "k", now, 3, TZ)).toBe("first time this week · × 3 in this check");
157
+ expect(repeatText([], "k", now, 1, TZ)).toBe("first this week");
158
+ expect(repeatText([], "k", now, 3, TZ)).toBe("first this week · × 3 this check");
159
159
  const earlier = [
160
160
  { key: "k", at: "2026-10-12T10:00:00Z" },
161
161
  { key: "k", at: "2026-10-19T10:00:00Z" },
162
162
  { key: "other", at: "2026-10-20T10:00:00Z" },
163
163
  ];
164
- expect(repeatText(earlier, "k", now, 1, TZ)).toBe("seen 2 times this week, last 19 Oct 12:00 CEST");
164
+ expect(repeatText(earlier, "k", now, 1, TZ)).toBe("2 times this week, last 19 Oct 12:00 CEST");
165
165
  });
166
166
 
167
167
  it("accepts only its own button ids", () => {
@@ -227,7 +227,7 @@ describe("health", () => {
227
227
  expect(parseAttention({ bouncer: {} })).toBeNull();
228
228
  expect(healthLine(parseAttention({ ...attention, health_issues: [] }))).toBe("Health · 7/8 Wazuh agents active · bouncer pulled 4 s ago");
229
229
  expect(healthLine(parseAttention(attention))).toBe("Health · 1 issue · Wazuh agent dmz is Disconnected");
230
- expect(healthLine(null)).toBe("Health · the check failed");
230
+ expect(healthLine(null)).toBe("Health · check failed");
231
231
  });
232
232
 
233
233
  it("tags only a new problem and reports recovery without a tag", () => {
@@ -238,7 +238,7 @@ describe("health", () => {
238
238
  expect(healthChange(["wazuh-agent:dmz"], [dmz])).toBeNull();
239
239
  expect(healthChange(["wazuh-agent:dmz"], [dmz, bouncer])?.mention).toBe(true);
240
240
  expect(healthChange(["bouncer-stale:fd", "wazuh-agent:dmz"], [dmz])).toEqual({ text: "⚠️ **Security health changed:**\n- Wazuh agent dmz is Disconnected.", mention: false });
241
- expect(healthChange(["wazuh-agent:dmz"], [])).toEqual({ text: "✅ **Security health recovered:** every check is clear again.", mention: false });
241
+ expect(healthChange(["wazuh-agent:dmz"], [])).toEqual({ text: "✅ **Security health recovered:** all checks clear.", mention: false });
242
242
  });
243
243
  });
244
244
 
@@ -275,10 +275,10 @@ function summary(over: Partial<AlertSummary> = {}): AlertSummary {
275
275
  describe("CrowdSec lines", () => {
276
276
  it("summarises a day: bans, scenario, escalations, sources", () => {
277
277
  expect(crowdsecDailyLine(summary())).toBe(
278
- "CrowdSec · 19 bans, all front door SNI scanning · 2 repeat offenders now banned longer: 1 × 7 days, 1 × 24 h · top sources: US 12, BE 3, BG 2; AS396982 GOOGLE-CLOUD-PLATFORM 8",
278
+ "CrowdSec · 19 bans, all front door SNI scanning · 2 repeat offenders banned longer: 1 × 7 days, 1 × 24 h · top sources: US 12, BE 3, BG 2; AS396982 GOOGLE-CLOUD-PLATFORM 8",
279
279
  );
280
280
  expect(crowdsecDailyLine(summary({ count: 0 }))).toBe("CrowdSec · no bans");
281
- expect(crowdsecDailyLine(null)).toBe("CrowdSec · the check failed");
281
+ expect(crowdsecDailyLine(null)).toBe("CrowdSec · check failed");
282
282
  expect(crowdsecDailyLine(summary({ scenarios: [{ scenario: "37pla/frontdoor-sni-scanning", count: 15 }, { scenario: "crowdsecurity/ssh-bf", count: 4 }], escalated: [], countries: [], networks: [] }))).toBe("CrowdSec · 19 bans, front door SNI scanning 15, ssh-bf 4");
283
283
  });
284
284
 
@@ -286,7 +286,7 @@ describe("CrowdSec lines", () => {
286
286
  expect(weekChange(121, 132)).toBe("−8 % vs last week");
287
287
  expect(weekChange(132, 121)).toBe("+9 % vs last week");
288
288
  expect(weekChange(10, 10)).toBe("±0 % vs last week");
289
- expect(weekChange(5, null)).toBe("no earlier week on record");
289
+ expect(weekChange(5, null)).toBe("no earlier week");
290
290
  expect(weekChange(5, 0)).toBe("none last week");
291
291
  expect(crowdsecWeeklyLine(summary({ count: 121, uniqueIps: 118, scenarios: [{ scenario: "37pla/frontdoor-sni-scanning", count: 121 }] }), 132)).toBe(
292
292
  "CrowdSec · 121 bans (−8 % vs last week) · 118 IPs · longest: 1 × 7 days · scenarios: front door SNI scanning 100 % · top sources: US 12, BE 3, BG 2; AS396982 GOOGLE-CLOUD-PLATFORM 8",
@@ -311,7 +311,7 @@ describe("Wazuh digest", () => {
311
311
  expect(digest.unacknowledged.map((e) => e.id)).toEqual(["d3"]);
312
312
  expect(wazuhDigest([deploy, { ...deploy, id: "d2" }], origins, () => false).line).toBe("Wazuh · 2 alerts at level 10+, none urgent · deployment file changed on arcane × 2, both matched GitOps");
313
313
  expect(wazuhDigest([], {}, () => false).line).toBe("Wazuh · no alerts at level 10+");
314
- expect(wazuhDigest(null, {}, () => false)).toMatchObject({ line: "Wazuh · the check failed", failed: true });
314
+ expect(wazuhDigest(null, {}, () => false)).toMatchObject({ line: "Wazuh · check failed", failed: true });
315
315
  });
316
316
  });
317
317
 
@@ -359,11 +359,11 @@ describe("vulnerabilities", () => {
359
359
  vuln({ cve: "CVE-2025-68745", package: "linux-image-cloud-amd64", agent: "dmz", severity: "-", score: -1, condition: "Package default status" }),
360
360
  vuln({ cve: "CVE-2025-68745", package: "linux-image-cloud-amd64", agent: "identity", severity: "-", score: -1, condition: "Package default status" }),
361
361
  ];
362
- expect(vulnLine(found)).toBe("Host packages · 1 new CVE on 2 hosts, no fixed version yet · CVE-2025-68745 (linux-image-cloud-amd64) on dmz, identity");
362
+ expect(vulnLine(found)).toBe("Host packages · 1 new CVE on 2 hosts, no fix yet · CVE-2025-68745 (linux-image-cloud-amd64) on dmz, identity");
363
363
  expect(vulnLine([])).toBe("Host packages · no new CVEs");
364
- expect(vulnLine(null)).toBe("Host packages · the check failed");
364
+ expect(vulnLine(null)).toBe("Host packages · check failed");
365
365
  const many = ["A", "B", "C", "D"].map((c, i) => vuln({ cve: `CVE-${c}`, score: 5 + i }));
366
- expect(vulnLine(many)).toBe("Host packages · 4 new CVEs on 1 host, fixed versions exist · CVE-D (libfoo, High 8.0) on arcane · CVE-C (libfoo, High 7.0) on arcane · CVE-B (libfoo, High 6.0) on arcane · +1 more CVEs");
366
+ expect(vulnLine(many)).toBe("Host packages · 4 new CVEs on 1 host, all fixable · CVE-D (libfoo, High 8.0) on arcane · CVE-C (libfoo, High 7.0) on arcane · CVE-B (libfoo, High 6.0) on arcane · +1 more CVEs");
367
367
  const closed = [
368
368
  vuln({ agent: "frontdoor-1337", cve: "CVE-2026-50252", package: "libunbound8", version: "1.26.0-1", status: "Solved", severity: "Critical", score: 9.8 }),
369
369
  vuln({ agent: "dmz", cve: "CVE-X", package: "openssl", version: "3.5.1", status: "Solved", score: 5 }),
@@ -430,15 +430,15 @@ describe("Arcane image scans", () => {
430
430
  ],
431
431
  };
432
432
  expect(imageVulnLine(facts, offers, "1549873938140499999")).toBe(
433
- "Arcane images · 5 critical CVEs whose package has a fix, in 3 images · update offered in <#1549873938140499999>: mealie 3 (mealie) · held: postgres:15.8.1.085 1 (supabase: coordinated release: review first) · waiting on the publisher: nginx 1",
433
+ "Arcane images · 5 fixable critical CVEs in 3 images · update offered in <#1549873938140499999>: mealie 3 (mealie) · held: postgres:15.8.1.085 1 (supabase: coordinated release: review first) · waiting on publisher: nginx 1",
434
434
  );
435
435
  expect(offeredImages(facts, offers)).toEqual(["mealie"]);
436
436
  expect(offeredImages(null, offers)).toEqual([]);
437
- expect(imageVulnLine(null, offers)).toBe("Arcane images · the check failed");
437
+ expect(imageVulnLine(null, offers)).toBe("Arcane images · check failed");
438
438
  expect(imageVulnLine({ scanned: 0, total: 57, critical: [] }, offers)).toBe("Arcane images · no Trivy scan yet (57 images)");
439
- expect(imageVulnLine({ ...facts, critical: facts.critical.slice(4) }, new Map(), undefined, 1)).toBe("Arcane images · 1 critical CVE whose package has a fix, in 1 image · waiting on the publisher: nginx 1");
439
+ expect(imageVulnLine({ ...facts, critical: facts.critical.slice(4) }, new Map(), undefined, 1)).toBe("Arcane images · 1 fixable critical CVE in 1 image · waiting on publisher: nginx 1");
440
440
  expect(imageVulnLine(facts, offers, undefined, 0)).toBe(
441
- "Arcane images · 5 critical CVEs whose package has a fix, in 3 images · update offered in the Arcane Daily Report: mealie 3 (mealie) · held: postgres:15.8.1.085 1 (supabase: coordinated release: review first)",
441
+ "Arcane images · 5 fixable critical CVEs in 3 images · update offered in the Arcane Daily Report: mealie 3 (mealie) · held: postgres:15.8.1.085 1 (supabase: coordinated release: review first)",
442
442
  );
443
443
  });
444
444
 
@@ -466,7 +466,7 @@ describe("Arcane image scans", () => {
466
466
  builds,
467
467
  };
468
468
  expect(imageVulnLine(facts, new Map(), undefined, 1)).toBe(
469
- "Arcane images · 6 critical CVEs whose package has a fix, in 5 images · ours to rebuild: arcane-graphile-worker 2 (built 7 Sept, a newer build waits in the registry), bigcapital-redis:astrofoundry 1 (build date unknown), grimoire-server:v0.27.57 1 (built 21 Sept) · waiting on the publisher: lidarr:pr-plugins 1, +1 more",
469
+ "Arcane images · 6 fixable critical CVEs in 5 images · ours to rebuild: arcane-graphile-worker 2 (built 7 Sept, newer build in registry), bigcapital-redis:astrofoundry 1 (build date unknown), grimoire-server:v0.27.57 1 (built 21 Sept) · waiting on publisher: lidarr:pr-plugins 1, +1 more",
470
470
  );
471
471
  expect(shortImageName("postgres:18.6")).toBe("postgres:18.6");
472
472
  });
@@ -496,11 +496,11 @@ describe("daily report", () => {
496
496
  components: [
497
497
  { type: 10, content: "## 🛡️ Security Daily Report\n🟢 quiet day · 24 h to 06:00 CEST" },
498
498
  { type: 14, divider: true, spacing: 1 },
499
- { type: 10, content: "🚫 **CrowdSec** · 19 bans, all front door SNI scanning\n- 2 repeat offenders now banned longer: 1 × 7 days, 1 × 24 h\n- top sources: US 12, BE 3, BG 2; AS396982 GOOGLE-CLOUD-PLATFORM 8" },
499
+ { type: 10, content: "🚫 **CrowdSec** · 19 bans, all front door SNI scanning\n- 2 repeat offenders banned longer: 1 × 7 days, 1 × 24 h\n- top sources: US 12, BE 3, BG 2; AS396982 GOOGLE-CLOUD-PLATFORM 8" },
500
500
  { type: 10, content: "👁️ **Wazuh** · no alerts at level 10+" },
501
501
  { type: 10, content: "📦 **Host packages** · no new CVEs" },
502
502
  { type: 10, content: "🩹 **Patches** · none" },
503
- { type: 10, content: "🐳 **Arcane images** · no critical CVE with a fix (57 of 57 images scanned)" },
503
+ { type: 10, content: "🐳 **Arcane images** · no fixable critical CVE (57 of 57 images scanned)" },
504
504
  { type: 10, content: "🩺 **Health** · 8/8 Wazuh agents active\n- bouncer pulled 6 s ago" },
505
505
  ],
506
506
  },
@@ -514,12 +514,12 @@ describe("daily report", () => {
514
514
  const data = { until: "06:00 CEST", timeZone: TZ, crowdsec: null, wazuh, found: [], closed: [], attention, images: { scanned: 57, total: 57, critical: [] }, offers: new Map(), alerts: [{ key: alertKey(event({ rule: "5712" })), channelId: "c9" }] };
515
515
  const report = dailyCard(data, [OWNER]);
516
516
  expect(report.headline).toBe("1 urgent alert, 1 check failed (24 h to 06:00 CEST)");
517
- expect(report.needs).toEqual(["urgent alert not acknowledged: brute force on arcane, 20 Oct 14:50 CEST; Acknowledge it in <#c9>", "1 check of this report failed; the bridge log on Cortex has the reason"]);
517
+ expect(report.needs).toEqual(["unacknowledged urgent alert: brute force on arcane, 20 Oct 14:50 CEST; Acknowledge in <#c9>", "1 check failed; reason in the bridge log on Cortex"]);
518
518
  expect(report.mention).toBe(true);
519
519
  expect(report.components[0].accent_color).toBe(0xe67e22);
520
520
  expect(texts(report.components).slice(0, 2)).toEqual([
521
521
  "## 🛡️ Security Daily Report\n🟠 1 urgent alert, 1 check failed · 24 h to 06:00 CEST",
522
- "### Needs you\n1. urgent alert not acknowledged: brute force on arcane, 20 Oct 14:50 CEST; Acknowledge it in <#c9>\n2. 1 check of this report failed; the bridge log on Cortex has the reason",
522
+ "### Needs you\n1. unacknowledged urgent alert: brute force on arcane, 20 Oct 14:50 CEST; Acknowledge in <#c9>\n2. 1 check failed; reason in the bridge log on Cortex",
523
523
  ]);
524
524
  expect(report.components[1]).toEqual({ type: 10, content: `<@${OWNER}>` });
525
525
  });
@@ -539,10 +539,10 @@ describe("daily report", () => {
539
539
  { id: "CVE-4", pkg: "d", image: "docker.io/library/redis:7", os: true },
540
540
  ];
541
541
  const data = { until: "06:00 CEST", timeZone: TZ, crowdsec: summary(), wazuh, found: [], closed: [], attention, images: { scanned: 57, total: 57, critical, builds }, offers: new Map(), alerts: [{ key: alertKey(oom), channelId: "c9" }] };
542
- expect(dailyNeeds(data)).toEqual(["urgent alert not acknowledged: System running out of memory. Availability of the system is in risk on space-x, 20 Oct 08:24 CEST; Acknowledge it in <#c9>"]);
542
+ expect(dailyNeeds(data)).toEqual(["unacknowledged urgent alert: System running out of memory. Availability of the system is in risk on space-x, 20 Oct 08:24 CEST; Acknowledge in <#c9>"]);
543
543
  const linked = { ...data, guildId: "g1", alerts: [{ key: alertKey(oom), channelId: "c9", messageId: "m1" }, { key: alertKey(oom), channelId: "c9", messageId: "m2" }] };
544
- expect(dailyNeeds(linked)).toEqual(["urgent alert not acknowledged: System running out of memory. Availability of the system is in risk on space-x, 20 Oct 08:24 CEST; Acknowledge it on [the alert](https://discord.com/channels/g1/c9/m2)"]);
545
- expect(rebuildItems(data.images)).toEqual(["rebuild app:1 (2): their base image packages have critical CVEs with a fixed version"]);
544
+ expect(dailyNeeds(linked)).toEqual(["unacknowledged urgent alert: System running out of memory. Availability of the system is in risk on space-x, 20 Oct 08:24 CEST; Acknowledge on [the alert](https://discord.com/channels/g1/c9/m2)"]);
545
+ expect(rebuildItems(data.images)).toEqual(["rebuild app:1 (2): fixable critical CVEs in base image packages"]);
546
546
  expect(dailyCard(data, [OWNER]).components[0].accent_color).toBe(0xe67e22);
547
547
  });
548
548
  });
@@ -579,10 +579,10 @@ describe("weekly report", () => {
579
579
  "## 🛡️ Security Weekly Report · 13–19 Oct 2026\n🟢 no incident · nothing needs you",
580
580
  "🚫 **CrowdSec** · 121 bans (−8 % vs last week)\n- 118 IPs\n- longest: 1 × 7 days\n- scenarios: front door SNI scanning 16 %\n- top sources: US 12, BE 3, BG 2; AS396982 GOOGLE-CLOUD-PLATFORM 8",
581
581
  "👁️ **Wazuh** · no alerts at level 10+",
582
- "📦 **Host packages** · 0 new CVEs\n- 0 closed by patches\n- 0 open with a fixed version",
582
+ "📦 **Host packages** · 0 new CVEs\n- 0 closed by patches\n- 0 open with a fix",
583
583
  "🩹 **Patching** · 14 package installs on 2 hosts\n- 0 CVEs closed\n- agent restarts: frontdoor-1337 19 Oct\n- reboot pending: none",
584
- "🐳 **Arcane images** · no critical CVE with a fix (57 of 57 images scanned)",
585
- "🩺 **Health** · 8/8 Wazuh agents active\n- bouncer pulled 4 s ago\n- RADIUS CRL: no renewal warning (it warns 30 days ahead)",
584
+ "🐳 **Arcane images** · no fixable critical CVE (57 of 57 images scanned)",
585
+ "🩺 **Health** · 8/8 Wazuh agents active\n- bouncer pulled 4 s ago\n- RADIUS CRL: no renewal warning (warns 30 days ahead)",
586
586
  "💾 **Backups** · Proxmox: the only guest backed up within 48 h, last 20 Oct 02:30 CEST\n- restic check: success 18 Oct 04:00",
587
587
  "-# Last 24 h · 16 bans · 0 Wazuh alerts at level 10+ · 0 new CVEs · 2 CVEs closed · health ok",
588
588
  ]);
@@ -599,15 +599,15 @@ describe("weekly report", () => {
599
599
  const shown = texts(out.components);
600
600
  expect(shown[0]).toBe("## 🛡️ Security Weekly Report · 13–19 Oct 2026\n🟠 1 urgent alert · 6 items need you");
601
601
  expect(shown[1]).toBe(
602
- "### Needs you\n1. 1 unexplained deployment change this week; Investigate on the alert\n2. reboot dmz to load installed updates\n3. 1 CVE with a fixed version still open after 3 days (dmz); unattended-upgrades may be stuck\n4. renew the RADIUS CRL (wifi-device.sh renew-crl), 23 days left\n5. no Proxmox backup within 48 h for observability\n6. the restic check ended with exit-code",
602
+ "### Needs you\n1. 1 unexplained deployment change this week; Investigate on the alert\n2. reboot dmz for installed updates\n3. 1 fixable CVE open over 3 days (dmz); unattended-upgrades may be stuck\n4. renew the RADIUS CRL (`wifi-device.sh renew-crl`), 23 days left\n5. no Proxmox backup within 48 h for observability\n6. restic check ended with exit-code",
603
603
  );
604
604
  expect(out.components[0].components?.map((c) => c.type).slice(0, 5)).toEqual([10, 14, 10, 14, 10]);
605
605
  expect(shown.join("\n")).toContain("- RADIUS CRL: renew within 23 days (warned 19 Oct)");
606
606
  expect(out.components.at(-1)).toEqual({ type: 10, content: `<@${OWNER}>` });
607
607
  const offers = imageOffers([{ stack: "mealie", lines: [{ ref: "ghcr.io/mealie-recipes/mealie:latest" }], actionable: true, state: "offered" }]);
608
608
  const withImages = weeklyCard({ ...base, offers, images: { scanned: 57, total: 57, critical: [{ id: "CVE-9", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:1", os: true }] } }, [OWNER]);
609
- expect(texts(withImages.components)[1]).toBe("### Needs you\n1. update mealie in the Arcane Daily Report: the newer image replaces one with a critical CVE");
610
- expect(needsYou({ ...base, images: null })).toEqual(["1 check of this report failed; the bridge log on Cortex has the reason"]);
609
+ expect(texts(withImages.components)[1]).toBe("### Needs you\n1. update mealie in the Arcane Daily Report: replaces an image with a critical CVE");
610
+ expect(needsYou({ ...base, images: null })).toEqual(["1 check failed; reason in the bridge log on Cortex"]);
611
611
  });
612
612
 
613
613
  it("tells base-image rebuilds from dependency updates, and Mac CVEs from stuck unattended-upgrades", () => {
@@ -625,9 +625,9 @@ describe("weekly report", () => {
625
625
  ];
626
626
  const mac: ReportedVuln = { agent: "CORTEX", cve: "CVE-10", package: "macOS", version: "26.7.2", severity: "High", score: 7, fix: true, since: "2026-10-10T00:00:00Z" };
627
627
  expect(needsYou({ ...base, images: { scanned: 57, total: 57, critical }, openWithFix: [mac, { ...mac, agent: "NEXUS", cve: "CVE-11" }] })).toEqual([
628
- "2 macOS CVEs open after 3 days on CORTEX, NEXUS: install the waiting macOS update",
629
- "rebuild webapp:1 (1): their base image packages have critical CVEs with a fixed version",
630
- "update dependencies of server:1 (6: form-data, handlebars, proxy-addr, tar +1), grimoire-server:v1 (1: certifi) in their repositories: their language packages have critical CVEs with a fixed version",
628
+ "2 macOS CVEs open over 3 days on CORTEX, NEXUS: install the waiting macOS update",
629
+ "rebuild webapp:1 (1): fixable critical CVEs in base image packages",
630
+ "update dependencies of server:1 (6: form-data, handlebars, proxy-addr, tar +1), grimoire-server:v1 (1: certifi) in their repositories: fixable critical CVEs in language packages",
631
631
  ]);
632
632
  expect(rebuildItems(null)).toEqual([]);
633
633
  });
@@ -639,10 +639,10 @@ describe("weekly report", () => {
639
639
  const brute = event({ id: "b1", rule: "5712", level: 12, description: "sshd: brute force trying to get access to the system." });
640
640
  const wazuh = wazuhDigest([setup, test1, test2, brute], {}, (e) => e.id === "b1");
641
641
  expect(needsYou({ ...base, wazuh, alerts: [{ key: alertKey(test1), channelId: "c9" }] })).toEqual([
642
- "urgent alert never posted, so it has no Acknowledge button: `/etc/sudoers.d/spc-arcane` added on arcane, 19 Oct 23:31 CEST; check that it was expected",
643
- "urgent alert not acknowledged: `/etc/sudoers.d/zz-alert-test` deleted on arcane × 2, last 21 Oct 23:48 CEST; Acknowledge it in <#c9>",
642
+ "urgent alert never posted (no Acknowledge button): `/etc/sudoers.d/spc-arcane` added on arcane, 19 Oct 23:31 CEST; check it was expected",
643
+ "unacknowledged urgent alert: `/etc/sudoers.d/zz-alert-test` deleted on arcane × 2, last 21 Oct 23:48 CEST; Acknowledge in <#c9>",
644
644
  ]);
645
- expect(needsYou({ ...base, wazuh: wazuhDigest([brute], {}, () => false) })).toEqual(["urgent alert never posted, so it has no Acknowledge button: sshd: brute force trying to get access to the system on arcane, 20 Oct 14:50 CEST; check that it was expected"]);
645
+ expect(needsYou({ ...base, wazuh: wazuhDigest([brute], {}, () => false) })).toEqual(["urgent alert never posted (no Acknowledge button): sshd: brute force trying to get access to the system on arcane, 20 Oct 14:50 CEST; check it was expected"]);
646
646
  });
647
647
 
648
648
  it("names the week before the Monday it is posted on", () => {
@@ -664,7 +664,7 @@ describe("weekly report", () => {
664
664
  expect(resticStatus(`Result=success\nExecMainStartTimestamp=\nExecMainExitTimestamp=\n${timer}`)).toEqual({ result: "success", at: "8 Nov 02:25" });
665
665
  expect(resticStatus("Result=success\nExecMainStartTimestamp=\n- - - - restic-check.timer restic-check.service\n")).toEqual({ result: "success", at: "never ran" });
666
666
  expect(resticStatus("Result=success\nExecMainStartTimestamp=\nSun 2026-11-15 02:25:00 CET 5 days - - restic-check.timer restic-check.service\n")).toEqual({ result: "success", at: "never ran" });
667
- expect(backupLine(null, 0, TZ)).toBe("Backups · the check failed");
667
+ expect(backupLine(null, 0, TZ)).toBe("Backups · check failed");
668
668
  const crl = event({ rule: "100011", level: 10, timestamp: "2026-10-12T04:00:00.000+0000", log: "radius-crl-alert: days_remaining=30 threshold=30" });
669
669
  expect(crlFromEvents([crl], Date.parse("2026-10-20T04:00:00Z"))).toEqual({ days: 22, warned: crl.timestamp });
670
670
  expect(crlFromEvents([], 0)).toBeNull();