Repository navigation
feat: rich HTML alert emails with host context - #45
Merged
Merged
Conversation
Alert emails were plain text and identified the host only by UUID. The SMTP channel now sends a multipart/alternative message: the existing plain text plus a clean, table-based HTML body that names the host and shows facts (IP, OS/ kernel, arch/CPU/RAM, agent version, status + last-seen, uptime) and a severity- coloured header. Slack/Mattermost/Discord/ntfy are unchanged. - notify.Message gains optional structured fields (Host, Metric, RuleName, FiredAt, HostURL); all zero-valued by default so existing callers are intact. - email_html.go renders via html/template (auto-escaping) and base64-encodes both MIME parts; HTML render failure falls back to plain text. - alerts.Engine enriches at the single fire() choke point via a new store.HostFactsFor lookup (best-effort; failure still delivers). MON_PUBLIC_URL adds a deep link to the host page. - Tests: multipart structure, hostname escaping, absent-block omission, plain fallback.
MalteKiefer
changed the base branch from
security/audit-2026-07-16-remediation
to
main
July 16, 2026 10:44
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the "unhelpful alert email" complaint: the SMTP channel now sends a clean HTML email that names the host (not a UUID) and shows triage context. Design doc:
docs/superpowers/specs/2026-07-16-html-alert-email-design.md.Based on the security-remediation branch (#44) because it also touches
notify.go/alerts.go; GitHub will retarget tomainonce #44 merges.What
multipart/alternativeemail: existing plain text + new table-based, inline-styled, severity-coloured HTML.MON_PUBLIC_URL).How
notify.Messagegains optional structured fields; zero-valued by default (existing callers unaffected).email_html.gorenders viahtml/template(auto-escaping); both MIME parts base64-encoded; HTML failure falls back to plain text.alerts.Engine.fire()choke point via newstore.HostFactsFor(best-effort — a lookup failure still delivers the alert).Tests
Multipart structure, hostname HTML-escaping (injection), absent-block omission, plain-text fallback.
go vet/staticcheck/gosecclean; full suite green.Preview of the rendered email: see the mockup shared during design.