@astrofoundry/pi-astro 0.40.6 → 0.40.8
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/agents/arcane.md +2 -1
- package/extensions/astro-discord/daily-run.test.ts +0 -5
- package/extensions/astro-discord/rest.ts +5 -0
- package/extensions/astro-discord/security-monitor.test.ts +9 -7
- package/extensions/astro-discord/security-monitor.ts +12 -23
- package/extensions/astro-discord/security.test.ts +96 -50
- package/extensions/astro-discord/security.ts +86 -32
- package/package.json +1 -1
package/agents/arcane.md
CHANGED
|
@@ -22,7 +22,8 @@ Rules:
|
|
|
22
22
|
- Updating Arcane itself is `manager-upgrade <version>` (owner approval), which runs the whole documented procedure and rolls back on failed checks; the owner's Upgrade button on the Arcane Daily Report runs the same. Never run `system upgrade`, `projects upgrade arcane`, or a manual sync of `arcane`, and never hand host commands to the caller.
|
|
23
23
|
- Host evidence (memory, logs, OOM, capacity, storage, audit) comes from `host <command>`, never from guesses; `host db-restore` only fills an empty database and needs approval.
|
|
24
24
|
- For update questions run `update-report` and answer with its table verbatim in a code block; never answer from `projects updates`, which is stored and paginated.
|
|
25
|
-
- Image updates
|
|
25
|
+
- Image updates that `update-report` offers go through `stack-update <stack>`, one stack at a time and only when asked; it edits, commits, redeploys, checks, and rolls back on its own. It refuses held stacks (`update-holds.json`) and `arcane`.
|
|
26
|
+
- Any other image change to one service the caller asks for (a tag switch, a pin, a digest) is a definition change: change only that `image:` line through the GitOps path (`git write`, `git diff`, `git commit`, `git push`, then the stack's `gitops sync`), as the skill describes. It is not a reason to refuse.
|
|
26
27
|
- Before a major version update, read its notes with `release-notes`, summarise breaking changes and manual steps, then ask for one go; only then run `stack-update <stack> --confirm`. Never ask the caller to read release notes for you.
|
|
27
28
|
- Report facts from the JSON output. Sensitive fields are already removed; never guess at what was removed.
|
|
28
29
|
- Delegate through `subagent` only to another specialist (`astro.identity`, `astro.network`, `astro.dns`, `astro.edge` (public route checks), `astro.security`, `astro.backup` (Restic restores), `astro.proxmox`, `astro.inference`, `astro.media`) and only for that specialist's own area.
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import type { ArcaneReport } from "./daily-report.ts";
|
|
3
|
-
import { headlineOf } from "./security-monitor.ts";
|
|
4
3
|
import type { ToolsReport } from "./tools-report.ts";
|
|
5
4
|
import { agoSeconds, arcaneSummary, backupStatus, dnsStatus, edgeStatus, identityStatus, inferenceStatus, mediaStatus, networkStatus, problemText, proxmoxStatus, summaryText, toolsSummary } from "./daily-run.ts";
|
|
6
5
|
|
|
@@ -160,8 +159,4 @@ describe("report summaries", () => {
|
|
|
160
159
|
messageId: "8",
|
|
161
160
|
});
|
|
162
161
|
});
|
|
163
|
-
|
|
164
|
-
it("takes the security report's headline without its name", () => {
|
|
165
|
-
expect(headlineOf("**Security Daily Report:** quiet day (24 h to 05:00 CET)\nCrowdSec · 19 bans")).toBe("quiet day (24 h to 05:00 CET)");
|
|
166
|
-
});
|
|
167
162
|
});
|
|
@@ -13,6 +13,11 @@ export interface MessageComponent {
|
|
|
13
13
|
label?: string;
|
|
14
14
|
custom_id?: string;
|
|
15
15
|
disabled?: boolean;
|
|
16
|
+
/** A Container's accent bar, RGB. */
|
|
17
|
+
accent_color?: number;
|
|
18
|
+
/** A Separator's visible line and its spacing (1 small, 2 large). */
|
|
19
|
+
divider?: boolean;
|
|
20
|
+
spacing?: number;
|
|
16
21
|
}
|
|
17
22
|
|
|
18
23
|
/** A message body for interaction webhooks: plain `content`, or `components` with the IS_COMPONENTS_V2 flag. */
|
|
@@ -297,15 +297,17 @@ describe("security monitor", () => {
|
|
|
297
297
|
);
|
|
298
298
|
h.answers.set("arcane images vulnerabilities summary", () => JSON.stringify({ totalImages: 57, scannedImages: 57, summary: { critical: 1 } }));
|
|
299
299
|
h.answers.set("arcane images vulnerabilities list", () => JSON.stringify({ data: [{ vulnerabilityId: "CVE-7", pkgName: "zlib", fixedVersion: "1.3.1", ignored: false, imageName: "nginx:latest" }] }));
|
|
300
|
-
await h.monitor.dailyReport(SCHEDULE, "2026-10-21");
|
|
301
|
-
|
|
302
|
-
|
|
300
|
+
const summary = await h.monitor.dailyReport(SCHEDULE, "2026-10-21");
|
|
301
|
+
expect(h.rest.messages).toEqual([]);
|
|
302
|
+
const text = JSON.stringify(h.rest.components[0].components);
|
|
303
|
+
expect(text).toContain("🐳 **Arcane images** · 1 critical CVE whose package has a fix, in 1 image\\n- waiting on the publisher: nginx 1");
|
|
303
304
|
expect(h.calls).toContainEqual(["arcane", "images", "list", "--all"]);
|
|
304
305
|
expect(h.calls).toContainEqual(["arcane", "images", "vulnerabilities", "list", "--severity", "critical", "--all"]);
|
|
305
|
-
expect(
|
|
306
|
-
expect(text).toContain("
|
|
307
|
-
expect(text).toContain("
|
|
308
|
-
expect(
|
|
306
|
+
expect(summary).toEqual({ headline: "quiet day (24 h to 06:05 CEST)", tagged: false, messageId: "100" });
|
|
307
|
+
expect(text).toContain("## 🛡️ Security Daily Report\\n🟢 quiet day · 24 h to 06:05 CEST");
|
|
308
|
+
expect(text).toContain("🚫 **CrowdSec** · 2 bans, all front door SNI scanning");
|
|
309
|
+
expect(text).toContain("📦 **Host packages** · 1 new CVE on 1 host, fixed versions exist\\n- CVE-1 (openssl, High 7.5) on dmz");
|
|
310
|
+
expect(h.rest.components[0].mentionUsers).toBeUndefined();
|
|
309
311
|
expect(readReportState("security")).toMatchObject({ date: "2026-10-21", status: "sent" });
|
|
310
312
|
expect(readSecurityState().vulns.reported["dmz|CVE-1"]).toMatchObject({ fix: true });
|
|
311
313
|
expect(h.calls.find((c) => c[1] === "wazuh-vuln-events")).toEqual(["security", "wazuh-vuln-events", "2"]);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { chunkMessage } from "./chunk.ts";
|
|
2
1
|
import { readPostedArcane } from "./daily-report.ts";
|
|
3
2
|
import { type DiscordConfig, isOwner, type ReportSchedule, reportSchedule } from "./config.ts";
|
|
4
3
|
import { KeyedQueue } from "./media.ts";
|
|
@@ -17,8 +16,7 @@ import {
|
|
|
17
16
|
classify,
|
|
18
17
|
clockText,
|
|
19
18
|
crlFromEvents,
|
|
20
|
-
|
|
21
|
-
dailyText,
|
|
19
|
+
dailyCard,
|
|
22
20
|
healthChange,
|
|
23
21
|
type ImageOffer,
|
|
24
22
|
imageOffers,
|
|
@@ -39,6 +37,7 @@ import {
|
|
|
39
37
|
parseSecurityButton,
|
|
40
38
|
type PatchingFacts,
|
|
41
39
|
type PostedAlert,
|
|
40
|
+
type ReportCard,
|
|
42
41
|
pruneState,
|
|
43
42
|
readSecurityState,
|
|
44
43
|
repeatText,
|
|
@@ -50,7 +49,7 @@ import {
|
|
|
50
49
|
type WazuhEvent,
|
|
51
50
|
wazuhDigest,
|
|
52
51
|
weekRange,
|
|
53
|
-
|
|
52
|
+
weeklyCard,
|
|
54
53
|
writeSecurityState,
|
|
55
54
|
} from "./security.ts";
|
|
56
55
|
|
|
@@ -98,11 +97,6 @@ export interface PostedSummary {
|
|
|
98
97
|
messageId: string;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
/** The report's first line without its bold name: `quiet day (24 h to 05:00 CET)`. */
|
|
102
|
-
export function headlineOf(text: string): string {
|
|
103
|
-
return text.split("\n")[0].replace(/^\*\*[^*]+\*\*\s*/, "");
|
|
104
|
-
}
|
|
105
|
-
|
|
106
100
|
const MINUTE = 60_000;
|
|
107
101
|
const DAY = 86_400_000;
|
|
108
102
|
export const POLL_MS = 2 * MINUTE;
|
|
@@ -461,14 +455,8 @@ export class SecurityMonitor {
|
|
|
461
455
|
return { images, offers: imageOffers(readPostedArcane()?.stacks ?? []), ...(arcaneChannelId ? { arcaneChannelId } : {}) };
|
|
462
456
|
}
|
|
463
457
|
|
|
464
|
-
private async postReport(channelId: string,
|
|
465
|
-
|
|
466
|
-
let first = "";
|
|
467
|
-
for (const chunk of chunkMessage(text)) {
|
|
468
|
-
const posted = await this.deps.rest.createMessage(channelId, { content: chunk, ...(mention ? { mentionUsers: owners } : {}) });
|
|
469
|
-
first ||= posted.id;
|
|
470
|
-
}
|
|
471
|
-
return first;
|
|
458
|
+
private async postReport(channelId: string, report: ReportCard): Promise<string> {
|
|
459
|
+
return (await this.deps.rest.createComponentsMessage(channelId, report.components, report.mention ? this.owners() : undefined)).id;
|
|
472
460
|
}
|
|
473
461
|
|
|
474
462
|
/** Posts the Security Daily Report; returns its headline and whether it tagged the owners, for the morning summary. */
|
|
@@ -491,11 +479,11 @@ export class SecurityMonitor {
|
|
|
491
479
|
if (this.deps.stopping()) return;
|
|
492
480
|
const data = { until: clockText(new Date(now).toISOString(), s.timeZone).replace(/^\d+ \w+ /, ""), crowdsec, wazuh, found: vulns?.found ?? null, closed: vulns?.closed ?? null, attention, ...images };
|
|
493
481
|
writeReportState("security", { date, status: "sending" });
|
|
494
|
-
const
|
|
495
|
-
const id = await this.postReport(s.channelId,
|
|
482
|
+
const report = dailyCard(data, this.owners());
|
|
483
|
+
const id = await this.postReport(s.channelId, report);
|
|
496
484
|
writeReportState("security", { date, status: "sent", messageId: id });
|
|
497
485
|
this.deps.log(`security report ${date}: posted`);
|
|
498
|
-
return { headline:
|
|
486
|
+
return { headline: report.headline, tagged: report.mention, messageId: id };
|
|
499
487
|
}
|
|
500
488
|
|
|
501
489
|
async weeklyReport(s: ReportSchedule, date: string): Promise<PostedSummary | undefined> {
|
|
@@ -538,6 +526,7 @@ export class SecurityMonitor {
|
|
|
538
526
|
crl: events ? crlFromEvents(events, now) : ("unknown" as const),
|
|
539
527
|
backups: archives ? { guests: archives, restic: resticText === null ? null : resticStatus(resticText) } : null,
|
|
540
528
|
...images,
|
|
529
|
+
alerts: state.alerts,
|
|
541
530
|
last24h: {
|
|
542
531
|
bans: lastDay?.count ?? null,
|
|
543
532
|
wazuh: lastDayEvents?.length ?? null,
|
|
@@ -548,12 +537,12 @@ export class SecurityMonitor {
|
|
|
548
537
|
},
|
|
549
538
|
};
|
|
550
539
|
if (this.deps.stopping()) return;
|
|
551
|
-
const report =
|
|
540
|
+
const report = weeklyCard(data, this.owners());
|
|
552
541
|
writeReportState("security-weekly", { date, status: "sending" });
|
|
553
|
-
const id = await this.postReport(s.channelId, report
|
|
542
|
+
const id = await this.postReport(s.channelId, report);
|
|
554
543
|
writeReportState("security-weekly", { date, status: "sent", messageId: id });
|
|
555
544
|
this.deps.log(`security weekly report ${date}: posted`);
|
|
556
|
-
return { headline:
|
|
545
|
+
return { headline: report.headline, tagged: report.mention, messageId: id };
|
|
557
546
|
}
|
|
558
547
|
|
|
559
548
|
// ------------------------------------------------------------ buttons
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { describe, expect, it } from "vitest";
|
|
2
2
|
import { validateConfig } from "./config.ts";
|
|
3
|
+
import type { MessageComponent } from "./rest.ts";
|
|
3
4
|
import { isDue, MONDAY, zonedWeekday } from "./reports.ts";
|
|
4
5
|
import {
|
|
5
6
|
ACK_ID,
|
|
@@ -15,8 +16,8 @@ import {
|
|
|
15
16
|
crlFromEvents,
|
|
16
17
|
crowdsecDailyLine,
|
|
17
18
|
crowdsecWeeklyLine,
|
|
19
|
+
dailyCard,
|
|
18
20
|
dailyNeedsOwner,
|
|
19
|
-
dailyText,
|
|
20
21
|
emptyState,
|
|
21
22
|
healthChange,
|
|
22
23
|
healthLine,
|
|
@@ -42,16 +43,18 @@ import {
|
|
|
42
43
|
offeredImages,
|
|
43
44
|
parseImageVulns,
|
|
44
45
|
nasOutage,
|
|
46
|
+
needsYou,
|
|
45
47
|
noteNas,
|
|
46
48
|
repeatText,
|
|
47
49
|
resticStatus,
|
|
50
|
+
section,
|
|
48
51
|
type VulnEvent,
|
|
49
52
|
vulnLine,
|
|
50
53
|
vulnWindow,
|
|
51
54
|
type WazuhEvent,
|
|
52
55
|
wazuhDigest,
|
|
53
56
|
weekChange,
|
|
54
|
-
|
|
57
|
+
weeklyCard,
|
|
55
58
|
weekRange,
|
|
56
59
|
} from "./security.ts";
|
|
57
60
|
|
|
@@ -64,6 +67,11 @@ function event(over: Partial<WazuhEvent> = {}): WazuhEvent {
|
|
|
64
67
|
|
|
65
68
|
const deploy = event({ id: "d1", rule: "100020", level: 10, description: "Deployment file changed: /opt/docker/grimoire/compose.yaml. Check against the approved GitOps change.", path: "/opt/docker/grimoire/compose.yaml", event: "modified", sha256: "a".repeat(64) });
|
|
66
69
|
|
|
70
|
+
/** Every Text Display of a card, in order. */
|
|
71
|
+
function texts(components: readonly MessageComponent[]): string[] {
|
|
72
|
+
return components.flatMap((c) => [...(c.content === undefined ? [] : [c.content]), ...texts(c.components ?? [])]);
|
|
73
|
+
}
|
|
74
|
+
|
|
67
75
|
function posted(over: Partial<PostedAlert> = {}): PostedAlert {
|
|
68
76
|
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 };
|
|
69
77
|
}
|
|
@@ -216,7 +224,7 @@ describe("health", () => {
|
|
|
216
224
|
expect(parseAttention(attention)).toMatchObject({ bouncers: 1, oldestPullSeconds: 4, agentsTotal: 8, agentsActive: 7, issues: [{ code: "wazuh-agent:dmz" }] });
|
|
217
225
|
expect(parseAttention({ bouncer: {} })).toBeNull();
|
|
218
226
|
expect(healthLine(parseAttention({ ...attention, health_issues: [] }))).toBe("Health · 7/8 Wazuh agents active · bouncer pulled 4 s ago");
|
|
219
|
-
expect(healthLine(parseAttention(attention))).toBe("Health · Wazuh agent dmz is Disconnected");
|
|
227
|
+
expect(healthLine(parseAttention(attention))).toBe("Health · 1 issue · Wazuh agent dmz is Disconnected");
|
|
220
228
|
expect(healthLine(null)).toBe("Health · the check failed");
|
|
221
229
|
});
|
|
222
230
|
|
|
@@ -349,11 +357,11 @@ describe("vulnerabilities", () => {
|
|
|
349
357
|
vuln({ cve: "CVE-2025-68745", package: "linux-image-cloud-amd64", agent: "dmz", severity: "-", score: -1, condition: "Package default status" }),
|
|
350
358
|
vuln({ cve: "CVE-2025-68745", package: "linux-image-cloud-amd64", agent: "identity", severity: "-", score: -1, condition: "Package default status" }),
|
|
351
359
|
];
|
|
352
|
-
expect(vulnLine(found)).toBe("
|
|
353
|
-
expect(vulnLine([])).toBe("
|
|
354
|
-
expect(vulnLine(null)).toBe("
|
|
360
|
+
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");
|
|
361
|
+
expect(vulnLine([])).toBe("Host packages · no new CVEs");
|
|
362
|
+
expect(vulnLine(null)).toBe("Host packages · the check failed");
|
|
355
363
|
const many = ["A", "B", "C", "D"].map((c, i) => vuln({ cve: `CVE-${c}`, score: 5 + i }));
|
|
356
|
-
expect(vulnLine(many)).toBe("
|
|
364
|
+
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");
|
|
357
365
|
const closed = [
|
|
358
366
|
vuln({ agent: "frontdoor-1337", cve: "CVE-2026-50252", package: "libunbound8", version: "1.26.0-1", status: "Solved", severity: "Critical", score: 9.8 }),
|
|
359
367
|
vuln({ agent: "dmz", cve: "CVE-X", package: "openssl", version: "3.5.1", status: "Solved", score: 5 }),
|
|
@@ -361,7 +369,7 @@ describe("vulnerabilities", () => {
|
|
|
361
369
|
vuln({ agent: "dmz", cve: "CVE-Z", package: "openssl", version: "3.5.1", status: "Solved", score: 6 }),
|
|
362
370
|
];
|
|
363
371
|
expect(patchLine(closed)).toBe(
|
|
364
|
-
"Patches · frontdoor-1337: libunbound8 replaced 1.26.0-1, closes CVE-2026-50252 (Critical 9.8) · dmz: openssl replaced 3.5.1, closes 3 CVEs: CVE-Y (High 7.0), CVE-Z (High 6.0), +1 more",
|
|
372
|
+
"Patches · 4 CVEs closed by 2 package updates · frontdoor-1337: libunbound8 replaced 1.26.0-1, closes CVE-2026-50252 (Critical 9.8) · dmz: openssl replaced 3.5.1, closes 3 CVEs: CVE-Y (High 7.0), CVE-Z (High 6.0), +1 more",
|
|
365
373
|
);
|
|
366
374
|
expect(patchLine([])).toBe("Patches · none");
|
|
367
375
|
});
|
|
@@ -458,32 +466,51 @@ describe("Arcane image scans", () => {
|
|
|
458
466
|
});
|
|
459
467
|
});
|
|
460
468
|
|
|
469
|
+
describe("report cards", () => {
|
|
470
|
+
it("puts a line's label in bold with its summary and one bullet per detail", () => {
|
|
471
|
+
expect(section("🚫", "CrowdSec · 3 bans · 2 IPs · top sources: US 2")).toBe("🚫 **CrowdSec** · 3 bans\n- 2 IPs\n- top sources: US 2");
|
|
472
|
+
expect(section("👁️", "Wazuh · no alerts at level 10+")).toBe("👁️ **Wazuh** · no alerts at level 10+");
|
|
473
|
+
expect(section("📦", "Host packages")).toBe("📦 **Host packages**");
|
|
474
|
+
});
|
|
475
|
+
});
|
|
476
|
+
|
|
461
477
|
describe("daily report", () => {
|
|
462
478
|
const attention = parseAttention({ checked_at: "x", bouncer: { count: 1, oldest_pull_seconds: 6 }, wazuh_agents: { total: 8, active: 8 }, health_issues: [] });
|
|
463
479
|
|
|
464
|
-
it("reads quiet day and tags nobody when nothing is open", () => {
|
|
480
|
+
it("reads quiet day in a green card and tags nobody when nothing is open", () => {
|
|
465
481
|
const data = { until: "06:00 CEST", crowdsec: summary(), wazuh: wazuhDigest([], {}, () => false), found: [], closed: [], attention, images: { scanned: 57, total: 57, critical: [] }, offers: new Map() };
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
482
|
+
const report = dailyCard(data, [OWNER]);
|
|
483
|
+
expect(report.headline).toBe("quiet day (24 h to 06:00 CEST)");
|
|
484
|
+
expect(report.mention).toBe(false);
|
|
485
|
+
expect(report.components).toEqual([
|
|
486
|
+
{
|
|
487
|
+
type: 17,
|
|
488
|
+
accent_color: 0x57f287,
|
|
489
|
+
components: [
|
|
490
|
+
{ type: 10, content: "## 🛡️ Security Daily Report\n🟢 quiet day · 24 h to 06:00 CEST" },
|
|
491
|
+
{ type: 14, divider: true, spacing: 1 },
|
|
492
|
+
{ 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" },
|
|
493
|
+
{ type: 10, content: "👁️ **Wazuh** · no alerts at level 10+" },
|
|
494
|
+
{ type: 10, content: "📦 **Host packages** · no new CVEs" },
|
|
495
|
+
{ type: 10, content: "🩹 **Patches** · none" },
|
|
496
|
+
{ type: 10, content: "🐳 **Arcane images** · no critical CVE with a fix (57 of 57 images scanned)" },
|
|
497
|
+
{ type: 10, content: "🩺 **Health** · 8/8 Wazuh agents active\n- bouncer pulled 6 s ago" },
|
|
498
|
+
],
|
|
499
|
+
},
|
|
500
|
+
]);
|
|
477
501
|
expect(dailyNeedsOwner(data)).toBe(false);
|
|
478
502
|
expect(dailyNeedsOwner({ ...data, images: null })).toBe(true);
|
|
479
503
|
});
|
|
480
504
|
|
|
481
|
-
it("names urgent alerts and failed checks in
|
|
505
|
+
it("names urgent alerts and failed checks in an orange card and tags the owner while something is open", () => {
|
|
482
506
|
const wazuh = wazuhDigest([event({ rule: "5712", level: 12, description: "brute force" })], {}, () => false);
|
|
483
507
|
const data = { until: "06:00 CEST", crowdsec: null, wazuh, found: [], closed: [], attention, images: { scanned: 57, total: 57, critical: [] }, offers: new Map() };
|
|
484
|
-
const
|
|
485
|
-
expect(
|
|
486
|
-
expect(
|
|
508
|
+
const report = dailyCard(data, [OWNER]);
|
|
509
|
+
expect(report.headline).toBe("1 urgent alert, 1 check failed (24 h to 06:00 CEST)");
|
|
510
|
+
expect(report.mention).toBe(true);
|
|
511
|
+
expect(report.components[0].accent_color).toBe(0xe67e22);
|
|
512
|
+
expect(texts(report.components)[0]).toBe("## 🛡️ Security Daily Report\n🟠 1 urgent alert, 1 check failed · 24 h to 06:00 CEST");
|
|
513
|
+
expect(report.components[1]).toEqual({ type: 10, content: `<@${OWNER}>` });
|
|
487
514
|
});
|
|
488
515
|
});
|
|
489
516
|
|
|
@@ -506,42 +533,61 @@ describe("weekly report", () => {
|
|
|
506
533
|
last24h: { bans: 16, wazuh: 0, urgent: 0, found: 0, closed: 2, health: 0 },
|
|
507
534
|
images: { scanned: 57, total: 57, critical: [] } as ImageVulnFacts | null,
|
|
508
535
|
offers: new Map<string, ImageOffer>(),
|
|
536
|
+
alerts: [],
|
|
509
537
|
};
|
|
510
538
|
|
|
511
|
-
it("
|
|
512
|
-
const out =
|
|
539
|
+
it("lays out a green card with one section per area when nothing needs the owner", () => {
|
|
540
|
+
const out = weeklyCard(base, [OWNER]);
|
|
513
541
|
expect(out.mention).toBe(false);
|
|
514
|
-
expect(out.
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
);
|
|
542
|
+
expect(out.headline).toBe("13–19 Oct 2026 · 🟢 no incident · nothing needs you");
|
|
543
|
+
expect(out.components).toHaveLength(1);
|
|
544
|
+
expect(out.components[0].accent_color).toBe(0x57f287);
|
|
545
|
+
expect(texts(out.components)).toEqual([
|
|
546
|
+
"## 🛡️ Security Weekly Report · 13–19 Oct 2026\n🟢 no incident · nothing needs you",
|
|
547
|
+
"🚫 **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",
|
|
548
|
+
"👁️ **Wazuh** · no alerts at level 10+",
|
|
549
|
+
"📦 **Host packages** · 0 new CVEs\n- 0 closed by patches\n- 0 open with a fixed version",
|
|
550
|
+
"🩹 **Patching** · 14 package installs on 2 hosts\n- 0 CVEs closed\n- agent restarts: frontdoor-1337 19 Oct\n- reboot pending: none",
|
|
551
|
+
"🐳 **Arcane images** · no critical CVE with a fix (57 of 57 images scanned)",
|
|
552
|
+
"🩺 **Health** · 8/8 Wazuh agents active\n- bouncer pulled 4 s ago\n- RADIUS CRL: no renewal warning (it warns 30 days ahead)",
|
|
553
|
+
"💾 **Backups** · Proxmox: the only guest backed up within 48 h, last 20 Oct 02:30 CEST\n- restic check: success 18 Oct 04:00",
|
|
554
|
+
"-# Last 24 h · 16 bans · 0 Wazuh alerts at level 10+ · 0 new CVEs · 2 CVEs closed · health ok",
|
|
555
|
+
]);
|
|
556
|
+
const one = weeklyCard({ ...base, last24h: { bans: 1, wazuh: 1, urgent: 1, found: 1, closed: 1, health: 1 } }, [OWNER]);
|
|
557
|
+
expect(texts(one.components).at(-1)).toBe("-# Last 24 h · 1 ban · 1 Wazuh alert at level 10+ (1 urgent) · 1 new CVE · 1 CVE closed · 1 health issue");
|
|
528
558
|
});
|
|
529
559
|
|
|
530
|
-
it("lists what needs the owner and tags them", () => {
|
|
560
|
+
it("lists what needs the owner first and tags them", () => {
|
|
531
561
|
const stale = { ...base.backups, guests: [{ vmid: "106", name: "observability", last: Date.parse("2026-10-15T00:30:00Z") / 1000 }], restic: { result: "exit-code", at: "18 Oct 04:00" } };
|
|
532
562
|
const fix: ReportedVuln = { agent: "dmz", cve: "CVE-1", package: "openssl", version: "1", severity: "High", score: 7, fix: true, since: "2026-10-10T00:00:00Z" };
|
|
533
|
-
const out =
|
|
563
|
+
const out = weeklyCard({ ...base, backups: stale, openWithFix: [fix], crl: { days: 23, warned: "2026-10-19T04:00:00Z" }, patching: { ...base.patching, rebootPending: ["dmz"] }, wazuh: wazuhDigest([{ ...deploy, id: "u1" }], {}, () => false) }, [OWNER]);
|
|
534
564
|
expect(out.mention).toBe(true);
|
|
535
|
-
expect(out.
|
|
536
|
-
|
|
537
|
-
|
|
565
|
+
expect(out.components[0].accent_color).toBe(0xe67e22);
|
|
566
|
+
const shown = texts(out.components);
|
|
567
|
+
expect(shown[0]).toBe("## 🛡️ Security Weekly Report · 13–19 Oct 2026\n🟠 1 urgent alert · 6 items need you");
|
|
568
|
+
expect(shown[1]).toBe(
|
|
569
|
+
"### 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",
|
|
538
570
|
);
|
|
539
|
-
expect(out.
|
|
571
|
+
expect(out.components[0].components?.map((c) => c.type).slice(0, 5)).toEqual([10, 14, 10, 14, 10]);
|
|
572
|
+
expect(shown.join("\n")).toContain("- RADIUS CRL: renew within 23 days (warned 19 Oct)");
|
|
573
|
+
expect(out.components.at(-1)).toEqual({ type: 10, content: `<@${OWNER}>` });
|
|
540
574
|
const offers = imageOffers([{ stack: "mealie", lines: [{ ref: "ghcr.io/mealie-recipes/mealie:latest" }], actionable: true, state: "offered" }]);
|
|
541
|
-
const withImages =
|
|
542
|
-
expect(withImages.
|
|
543
|
-
expect(
|
|
544
|
-
|
|
575
|
+
const withImages = weeklyCard({ ...base, offers, images: { scanned: 57, total: 57, critical: [{ id: "CVE-9", pkg: "openssl", image: "ghcr.io/mealie-recipes/mealie:1" }] } }, [OWNER]);
|
|
576
|
+
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");
|
|
577
|
+
expect(needsYou({ ...base, images: null })).toEqual(["1 check of this report failed; the bridge log on Cortex has the reason"]);
|
|
578
|
+
});
|
|
579
|
+
|
|
580
|
+
it("names each unacknowledged alert and says when it never reached Discord", () => {
|
|
581
|
+
const setup = event({ id: "s1", rule: "100021", level: 10, timestamp: "2026-10-19T21:31:28.085+0000", path: "/etc/sudoers.d/spc-arcane", event: "added" });
|
|
582
|
+
const test1 = event({ id: "t1", rule: "100021", level: 10, timestamp: "2026-10-21T21:47:18.458+0000", path: "/etc/sudoers.d/zz-alert-test", event: "added" });
|
|
583
|
+
const test2 = event({ id: "t2", rule: "100021", level: 10, timestamp: "2026-10-21T21:48:01.868+0000", path: "/etc/sudoers.d/zz-alert-test", event: "deleted" });
|
|
584
|
+
const brute = event({ id: "b1", rule: "5712", level: 12, description: "sshd: brute force trying to get access to the system." });
|
|
585
|
+
const wazuh = wazuhDigest([setup, test1, test2, brute], {}, (e) => e.id === "b1");
|
|
586
|
+
expect(needsYou({ ...base, wazuh, alerts: [{ key: alertKey(test1), channelId: "c9" }] })).toEqual([
|
|
587
|
+
"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",
|
|
588
|
+
"urgent alert not acknowledged: `/etc/sudoers.d/zz-alert-test` deleted on arcane × 2, last 21 Oct 23:48 CEST; Acknowledge it in <#c9>",
|
|
589
|
+
]);
|
|
590
|
+
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"]);
|
|
545
591
|
});
|
|
546
592
|
|
|
547
593
|
it("names the week before the Monday it is posted on", () => {
|
|
@@ -9,8 +9,8 @@ import type { MessageComponent } from "./rest.ts";
|
|
|
9
9
|
|
|
10
10
|
export type { AlertSummary, VulnEvent, WazuhEvent };
|
|
11
11
|
|
|
12
|
-
export const DAILY_PREFIX = "Security Daily Report
|
|
13
|
-
export const WEEKLY_PREFIX = "Security Weekly Report
|
|
12
|
+
export const DAILY_PREFIX = "Security Daily Report";
|
|
13
|
+
export const WEEKLY_PREFIX = "Security Weekly Report";
|
|
14
14
|
/** Wazuh levels from here on page at once; our own rules page at level 10 by rule id. */
|
|
15
15
|
export const URGENT_LEVEL = 11;
|
|
16
16
|
/** The poller and the reports read Wazuh from this level: every rule of ours is level 10. */
|
|
@@ -350,7 +350,7 @@ export function checksRecoveredText(what: string): string {
|
|
|
350
350
|
|
|
351
351
|
export function healthLine(a: Attention | null): string {
|
|
352
352
|
if (!a) return "Health · the check failed";
|
|
353
|
-
if (a.issues.length > 0) return `Health · ${a.issues.map((i) => escapeDiscord(i.message.replace(/\.$/, ""))).join(" · ")}`;
|
|
353
|
+
if (a.issues.length > 0) return `Health · ${a.issues.length} issue${a.issues.length === 1 ? "" : "s"} · ${a.issues.map((i) => escapeDiscord(i.message.replace(/\.$/, ""))).join(" · ")}`;
|
|
354
354
|
const pull = a.oldestPullSeconds === null ? "no bouncer pull recorded" : `bouncer pulled ${a.oldestPullSeconds} s ago`;
|
|
355
355
|
return `Health · ${a.agentsActive ?? "?"}/${a.agentsTotal ?? "?"} Wazuh agents active · ${pull}`;
|
|
356
356
|
}
|
|
@@ -521,8 +521,8 @@ function severityText(e: { severity: string; score: number | null }): string {
|
|
|
521
521
|
}
|
|
522
522
|
|
|
523
523
|
export function vulnLine(found: readonly VulnEvent[] | null, maxShown = 3): string {
|
|
524
|
-
if (!found) return "
|
|
525
|
-
if (found.length === 0) return "
|
|
524
|
+
if (!found) return "Host packages · the check failed";
|
|
525
|
+
if (found.length === 0) return "Host packages · no new CVEs";
|
|
526
526
|
const byCve = new Map<string, { e: VulnEvent; hosts: string[]; fix: boolean }>();
|
|
527
527
|
for (const e of found) {
|
|
528
528
|
const key = `${e.cve}|${e.package}`;
|
|
@@ -541,7 +541,7 @@ export function vulnLine(found: readonly VulnEvent[] | null, maxShown = 3): stri
|
|
|
541
541
|
const fixes = groups.filter((g) => g.fix).length;
|
|
542
542
|
const fixText = fixes === 0 ? "no fixed version yet" : fixes === groups.length ? "fixed versions exist" : `fixed version exists for ${fixes}`;
|
|
543
543
|
const hosts = new Set(found.map((e) => e.agent)).size;
|
|
544
|
-
return `
|
|
544
|
+
return `Host packages · ${groups.length} new CVE${groups.length === 1 ? "" : "s"} on ${hosts} host${hosts === 1 ? "" : "s"}, ${fixText} · ${shown.join(" · ")}${more}`;
|
|
545
545
|
}
|
|
546
546
|
|
|
547
547
|
export function patchLine(closed: readonly VulnEvent[] | null, label = "Patches", maxShown = 3): string {
|
|
@@ -563,7 +563,8 @@ export function patchLine(closed: readonly VulnEvent[] | null, label = "Patches"
|
|
|
563
563
|
return `${escapeDiscord(g.agent)}: ${escapeDiscord(g.pkg)} replaced ${escapeDiscord(g.version)}, ${what}`;
|
|
564
564
|
});
|
|
565
565
|
const more = groups.length > maxShown ? ` · +${groups.length - maxShown} more packages` : "";
|
|
566
|
-
|
|
566
|
+
const cves = new Set(closed.map((e) => `${e.agent}|${e.cve}`)).size;
|
|
567
|
+
return `${label} · ${cves} CVE${cves === 1 ? "" : "s"} closed by ${groups.length} package update${groups.length === 1 ? "" : "s"} · ${shown.join(" · ")}${more}`;
|
|
567
568
|
}
|
|
568
569
|
|
|
569
570
|
// ---------------------------------------------------------------- Arcane image scans
|
|
@@ -717,6 +718,30 @@ export function imageVulnLine(facts: ImageVulnFacts | null, offers: ReadonlyMap<
|
|
|
717
718
|
|
|
718
719
|
// ---------------------------------------------------------------- reports
|
|
719
720
|
|
|
721
|
+
const GREEN = 0x57f287;
|
|
722
|
+
const ORANGE = 0xe67e22;
|
|
723
|
+
const SEPARATOR: MessageComponent = { type: 14, divider: true, spacing: 1 };
|
|
724
|
+
|
|
725
|
+
/** A report line `Label · summary · detail · …` as the label in bold with its summary, then one bullet per detail. */
|
|
726
|
+
export function section(icon: string, line: string): string {
|
|
727
|
+
const [label, summary, ...details] = line.split(" · ");
|
|
728
|
+
return [`${icon} **${label}**${summary === undefined ? "" : ` · ${summary}`}`, ...details.map((d) => `- ${d}`)].join("\n");
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/** A posted report: one Container, orange while something needs the owners, and their mention below it. */
|
|
732
|
+
export interface ReportCard {
|
|
733
|
+
/** The state without the report's name, for the morning summary: `quiet day (24 h to 06:00 CEST)`. */
|
|
734
|
+
headline: string;
|
|
735
|
+
mention: boolean;
|
|
736
|
+
components: MessageComponent[];
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
/** Text Displays in groups divided by separators. */
|
|
740
|
+
function card(groups: readonly (readonly string[])[], attention: boolean, mention: string | null): MessageComponent[] {
|
|
741
|
+
const components = groups.filter((g) => g.length > 0).flatMap((g, i) => [...(i > 0 ? [SEPARATOR] : []), ...g.map((content): MessageComponent => ({ type: 10, content }))]);
|
|
742
|
+
return [{ type: 17, accent_color: attention ? ORANGE : GREEN, components }, ...(mention ? [{ type: 10, content: mention }] : [])];
|
|
743
|
+
}
|
|
744
|
+
|
|
720
745
|
export interface DailyData {
|
|
721
746
|
/** Local time the report covers up to, already formatted (`06:00 CEST`). */
|
|
722
747
|
until: string;
|
|
@@ -750,11 +775,22 @@ export function dailyNeedsOwner(d: DailyData): boolean {
|
|
|
750
775
|
return (d.attention?.issues.length ?? 0) > 0 || failures(d) > 0;
|
|
751
776
|
}
|
|
752
777
|
|
|
753
|
-
export function
|
|
754
|
-
const
|
|
755
|
-
const
|
|
756
|
-
|
|
757
|
-
|
|
778
|
+
export function dailyCard(d: DailyData, owners: readonly string[]): ReportCard {
|
|
779
|
+
const state = headline(d.wazuh.urgent, d.wazuh.unexplained.length, d.attention?.issues.length ?? 0, failures(d));
|
|
780
|
+
const mention = dailyNeedsOwner(d);
|
|
781
|
+
const sections = [
|
|
782
|
+
section("🚫", crowdsecDailyLine(d.crowdsec)),
|
|
783
|
+
section("👁️", d.wazuh.line),
|
|
784
|
+
section("📦", vulnLine(d.found)),
|
|
785
|
+
section("🩹", patchLine(d.closed)),
|
|
786
|
+
section("🐳", imageVulnLine(d.images, d.offers, d.arcaneChannelId)),
|
|
787
|
+
section("🩺", healthLine(d.attention)),
|
|
788
|
+
];
|
|
789
|
+
return {
|
|
790
|
+
headline: `${state} (24 h to ${d.until})`,
|
|
791
|
+
mention,
|
|
792
|
+
components: card([[`## 🛡️ ${DAILY_PREFIX}\n${state === "quiet day" ? "🟢" : "🟠"} ${state} · 24 h to ${d.until}`], sections], state !== "quiet day", mention ? mentionLine(owners) : null),
|
|
793
|
+
};
|
|
758
794
|
}
|
|
759
795
|
|
|
760
796
|
export interface PatchingFacts {
|
|
@@ -790,6 +826,8 @@ export interface WeeklyData {
|
|
|
790
826
|
images: ImageVulnFacts | null;
|
|
791
827
|
offers: ReadonlyMap<string, ImageOffer>;
|
|
792
828
|
arcaneChannelId?: string;
|
|
829
|
+
/** Alerts posted to Discord, to tell an unacknowledged alert from one that was never posted. */
|
|
830
|
+
alerts: readonly Pick<PostedAlert, "key" | "channelId">[];
|
|
793
831
|
last24h: { bans: number | null; wazuh: number | null; urgent: number; found: number | null; closed: number | null; health: number | null };
|
|
794
832
|
}
|
|
795
833
|
|
|
@@ -856,12 +894,25 @@ function crlText(crl: WeeklyData["crl"], timeZone: string): string {
|
|
|
856
894
|
return `RADIUS CRL: renew within ${crl.days} days (warned ${dayText(crl.warned, timeZone)})`;
|
|
857
895
|
}
|
|
858
896
|
|
|
897
|
+
/** One item per alert key the owners did not acknowledge: what changed, when, and where to acknowledge it, if anywhere. */
|
|
898
|
+
function unacknowledgedItems(d: WeeklyData): string[] {
|
|
899
|
+
const groups = new Map<string, WazuhEvent[]>();
|
|
900
|
+
for (const e of d.wazuh.unacknowledged) if (e.rule !== DEPLOYMENT_RULE) groups.set(alertKey(e), [...(groups.get(alertKey(e)) ?? []), e]);
|
|
901
|
+
return [...groups.entries()].map(([key, events]) => {
|
|
902
|
+
const last = events.reduce((a, b) => (Date.parse(b.timestamp) > Date.parse(a.timestamp) ? b : a));
|
|
903
|
+
const what = last.path ? `\`${last.path.replace(/`/g, "'")}\` ${escapeDiscord(last.event ?? "changed")}` : escapeDiscord(issueLabel(last));
|
|
904
|
+
const when = events.length > 1 ? ` × ${events.length}, last ${clockText(last.timestamp, d.timeZone)}` : `, ${clockText(last.timestamp, d.timeZone)}`;
|
|
905
|
+
const posted = d.alerts.find((a) => a.key === key);
|
|
906
|
+
const fact = `${what} on ${escapeDiscord(last.agent)}${when}`;
|
|
907
|
+
return posted ? `urgent alert not acknowledged: ${fact}; Acknowledge it in <#${posted.channelId}>` : `urgent alert never posted, so it has no Acknowledge button: ${fact}; check that it was expected`;
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
|
|
859
911
|
export function needsYou(d: WeeklyData): string[] {
|
|
860
912
|
const items: string[] = [];
|
|
861
913
|
for (const i of d.attention?.issues ?? []) items.push(escapeDiscord(i.message.replace(/\.$/, "")));
|
|
862
914
|
if (d.wazuh.unexplained.length > 0) items.push(`${d.wazuh.unexplained.length} unexplained deployment change${d.wazuh.unexplained.length === 1 ? "" : "s"} this week; Investigate on the alert`);
|
|
863
|
-
|
|
864
|
-
if (urgentLeft > 0) items.push(`${urgentLeft} urgent alert${urgentLeft === 1 ? "" : "s"} this week not acknowledged`);
|
|
915
|
+
items.push(...unacknowledgedItems(d));
|
|
865
916
|
if (d.patching && d.patching.rebootPending.length > 0) items.push(`reboot ${d.patching.rebootPending.map(escapeDiscord).join(", ")} to load installed updates`);
|
|
866
917
|
const stuck = d.openWithFix.filter((v) => d.now - Date.parse(v.since) > 3 * DAY);
|
|
867
918
|
if (stuck.length > 0) items.push(`${stuck.length} CVE${stuck.length === 1 ? "" : "s"} with a fixed version still open after 3 days (${[...new Set(stuck.map((v) => v.agent))].map(escapeDiscord).join(", ")}); unattended-upgrades may be stuck`);
|
|
@@ -879,33 +930,36 @@ export function needsYou(d: WeeklyData): string[] {
|
|
|
879
930
|
}
|
|
880
931
|
|
|
881
932
|
function lastDayLine(l: WeeklyData["last24h"]): string {
|
|
882
|
-
const n = (v: number | null,
|
|
883
|
-
|
|
933
|
+
const n = (v: number | null, one: string, many: string) => (v === null ? `${many} unknown` : `${v} ${v === 1 ? one : many}`);
|
|
934
|
+
const health = l.health === null ? "health unknown" : l.health === 0 ? "health ok" : n(l.health, "health issue", "health issues");
|
|
935
|
+
return `Last 24 h · ${n(l.bans, "ban", "bans")} · ${n(l.wazuh, "Wazuh alert at level 10+", "Wazuh alerts at level 10+")}${l.urgent > 0 ? ` (${l.urgent} urgent)` : ""} · ${n(l.found, "new CVE", "new CVEs")} · ${n(l.closed, "CVE closed", "CVEs closed")} · ${health}`;
|
|
884
936
|
}
|
|
885
937
|
|
|
886
|
-
export function
|
|
938
|
+
export function weeklyCard(d: WeeklyData, owners: readonly string[]): ReportCard {
|
|
887
939
|
const items = needsYou(d);
|
|
888
940
|
const incidents = d.wazuh.urgent;
|
|
889
941
|
const state = incidents === 0 ? "🟢 no incident" : `🟠 ${incidents} urgent alert${incidents === 1 ? "" : "s"}`;
|
|
890
942
|
const needs = items.length === 0 ? "nothing needs you" : `${items.length} item${items.length === 1 ? "" : "s"} need${items.length === 1 ? "s" : ""} you`;
|
|
891
943
|
const tracking = d.trackingSince && d.now - Date.parse(d.trackingSince) < 30 * DAY ? ` (tracked since ${dayText(d.trackingSince, d.timeZone)})` : "";
|
|
892
944
|
const fixable = d.openWithFix.length;
|
|
893
|
-
const
|
|
894
|
-
const
|
|
895
|
-
const
|
|
896
|
-
|
|
897
|
-
crowdsecWeeklyLine(d.crowdsec, d.previousBans),
|
|
898
|
-
d.wazuh.line,
|
|
899
|
-
`
|
|
900
|
-
patchingLine(d.patching, d.closed, d.timeZone),
|
|
901
|
-
imageVulnLine(d.images, d.offers, d.arcaneChannelId),
|
|
902
|
-
`${healthLine(d.attention)} · ${crlText(d.crl, d.timeZone)}
|
|
903
|
-
backupLine(d.backups, d.now, d.timeZone),
|
|
904
|
-
`Needs you · ${items.length === 0 ? "nothing" : items.map((t, i) => `${i + 1}) ${t}`).join(" ")}`,
|
|
905
|
-
lastDayLine(d.last24h),
|
|
945
|
+
const cveCount = (events: readonly VulnEvent[]) => new Set(events.map((e) => `${e.agent}|${e.cve}`)).size;
|
|
946
|
+
const found = d.found === null ? "new CVEs: unknown" : `${cveCount(d.found)} new CVE${cveCount(d.found) === 1 ? "" : "s"}`;
|
|
947
|
+
const closed = d.closed === null ? "closed: unknown" : `${cveCount(d.closed)} closed by patches`;
|
|
948
|
+
const sections = [
|
|
949
|
+
section("🚫", crowdsecWeeklyLine(d.crowdsec, d.previousBans)),
|
|
950
|
+
section("👁️", d.wazuh.line),
|
|
951
|
+
section("📦", `Host packages · ${found} · ${closed} · ${fixable} open with a fixed version${tracking}`),
|
|
952
|
+
section("🩹", patchingLine(d.patching, d.closed, d.timeZone)),
|
|
953
|
+
section("🐳", imageVulnLine(d.images, d.offers, d.arcaneChannelId)),
|
|
954
|
+
section("🩺", `${healthLine(d.attention)} · ${crlText(d.crl, d.timeZone)}`),
|
|
955
|
+
section("💾", backupLine(d.backups, d.now, d.timeZone)),
|
|
906
956
|
];
|
|
907
|
-
|
|
908
|
-
return {
|
|
957
|
+
const needsBlock = items.length === 0 ? [] : [`### Needs you\n${items.map((t, i) => `${i + 1}. ${t}`).join("\n")}`];
|
|
958
|
+
return {
|
|
959
|
+
headline: `${d.range} · ${state} · ${needs}`,
|
|
960
|
+
mention: items.length > 0,
|
|
961
|
+
components: card([[`## 🛡️ ${WEEKLY_PREFIX} · ${d.range}\n${state} · ${needs}`], needsBlock, sections, [`-# ${lastDayLine(d.last24h)}`]], incidents > 0 || items.length > 0, items.length > 0 ? mentionLine(owners) : null),
|
|
962
|
+
};
|
|
909
963
|
}
|
|
910
964
|
|
|
911
965
|
/** `13–19 Oct 2026` for the seven local days before `date` (`YYYY-MM-DD`, a Monday). */
|