Dockhand vulnerability scans: warn about critical findings, with a setting to turn it off

Reads what Dockhand's scans have already stored (never starts one) every
15 minutes and raises a warning per Docker host with critical findings.
Unknown counts and stale readings are held, not treated as clean.
Settings -> Notifications has a switch (on by default); the Docker page
shows counts, scan coverage and the critical findings; /metrics and docs
updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
bobbanandClaude Sonnet 5.5 committed 2026-10-25 22:34:06 +01:00
1 parent 65214f6f0f
commit 5a2b320175
25 files changed
+8527 -12

No files matched your search

+24
View File
@@ -1169,6 +1169,30 @@ export const haReadings = sqliteTable(
(t) => [index("ha_readings_lookup_idx").on(t.integrationId, t.entityId, t.at)],
);
// ─── Docker vulnerability scans (from Dockhand) ─────────────────────────────
// What Dockhand's own stored scans add up to for one of its environments (a Docker host), as last read: one row for each (Dockhand integration, environment), replaced at every read.
// A null count means the environment's summary could not be read — which is not the same as no vulnerabilities. Read by services/dockerVulnSync.ts.
export const dockhandVulnerabilities = sqliteTable(
"dockhand_vulnerabilities",
{
integrationId: integer("integration_id")
.notNull()
.references(() => integrations.id, { onDelete: "cascade" }),
environmentId: integer("environment_id").notNull(), // Dockhand's own id for the Docker host
environmentName: text("environment_name").notNull(),
critical: integer("critical"),
high: integer("high"),
medium: integer("medium"),
low: integer("low"),
imagesScanned: integer("images_scanned"),
totalImages: integer("total_images"),
findings: text("findings").notNull().default("[]"), // JSON: the critical findings (cve, package, installedVersion, fixedVersion, imageName, containers), at most 100
updatedAt: text("updated_at").notNull(), // ISO
},
(t) => [primaryKey({ columns: [t.integrationId, t.environmentId] })],
);
// ─── Nextcloud ──────────────────────────────────────────────────────────────
// How a Nextcloud (an integration of type "nextcloud") is right now, one row each, replaced at every read: its version, whether it is in maintenance mode or needs its database