clusev/tests/Feature
boban 0472b3531a feat(alerts): threshold alerting + notifications (feature 2/8)
Turns the existing metrics into an ops tool: rules that fire when a server crosses a
threshold and resolve when it recovers, with e-mail + webhook notifications. The event
sink later features (cert-expiry, uptime-down, patch-available, posture-drop) plug into.

- alert_rules (metric cpu|mem|disk|load|offline, comparator gt|lt, threshold, scope
  all|group|server) + alert_incidents (firing|resolved, FK cascade).
- AlertEvaluator — per-server state machine: opens ONE firing incident on a fresh breach
  (notifies), resolves on recovery (notifies), dedups a sustained breach (one breach = one
  alert). Numeric metrics skip a truly-offline server (stale reading); the `offline` rule
  fires only on offline, not a reachable "warning".
- AlertNotifier — best-effort e-mail (queued Mailable to configured recipients, falls back
  to admin e-mails) + generic webhook JSON POST (Slack/Discord/Mattermost/custom; only http(s)
  URLs). Every channel is wrapped so a broken SMTP/unreachable hook is logged, never thrown.
- PollMetrics evaluates after each poll (online, fresh status) and on a failed poll (offline),
  each guarded so an alerting error can never kill the poll loop.
- Alerts\Index page, manage-panel (admin): route can:-mw + mount() + per-method gate() on every
  mutation. Rule delete via signed ConfirmToken + R5 modal (no double audit). Scope group/server
  resolves a client UUID to an id server-side (never trusts a client id). Channels saved to
  Settings. Sidebar "Alarme" nav + firing-incident badge (cached 60s).
- lang/{de,en}/alerts.php + audit.php alert.* + shell.nav_alerts (de/en parity). No emoji.

Codex review raised three MEDIUMs, all fixed here:
- Webhook SSRF: strict http(s) scheme + reject hosts resolving to loopback/private/link-local/
  reserved ranges (blocks the 169.254.169.254 cloud-metadata classic), validated at save AND send,
  redirects disabled — so an admin-configured hook can't be pointed at an internal service.
- Incident dedup is now a DB invariant: a unique `firing_key` ("{rule}:{server}" while firing,
  null on resolve) means two concurrent poll ticks can't both open a duplicate incident (the loser
  hits a unique violation, caught → no-op).
- `load` is float-safe: threshold + incident value are decimal, compared as floats, so load 1.5 vs
  threshold 1 fires (it used to truncate to 1 > 1 = false).

31 new tests: evaluator (fire/resolve/dedup, offline vs warning, scope all/group/server, disabled,
fractional-load, firing_key unique, key-freed-on-resolve), notifier (email/fallback/webhook/
non-http-ignored/failure-swallowed/SSRF-reject/public-accept), component (RBAC route gating, rule
CRUD, uuid→id scope resolve, offline→threshold 0, toggle, delete via token, channels, unsafe-webhook
rejected, incidents render). 669 tests green, Pint, lang parity, Codex-reviewed (fixes applied).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 20:07:54 +02:00
..
Modals feat(security): signed confirm-action tokens + airtight backup-code reveal 2026-06-15 18:35:33 +02:00
Settings harden(auth): fold IPv4-mapped IPv6, dedupe unbanAll, limit bans render, forged-token test 2026-06-20 18:53:52 +02:00
AddSshKeyTest.php feat(ssh-keys): name an added SSH key so it is identifiable 2026-06-25 00:53:49 +02:00
AlertEvaluatorTest.php feat(alerts): threshold alerting + notifications (feature 2/8) 2026-07-05 20:07:54 +02:00
AlertNotifierTest.php feat(alerts): threshold alerting + notifications (feature 2/8) 2026-07-05 20:07:54 +02:00
AlertsComponentTest.php feat(alerts): threshold alerting + notifications (feature 2/8) 2026-07-05 20:07:54 +02:00
AuditLogDisplayTest.php harden(opsec): disguise honeypot action labels in the audit log 2026-07-05 18:59:56 +02:00
AuditRetentionTest.php feat(audit): configurable retention + scheduled clusev:prune-audit 2026-06-14 23:40:17 +02:00
BlockBannedIpMiddlewareTest.php feat(auth): guests-only BlockBannedIp middleware + 403 page 2026-06-20 17:45:16 +02:00
BruteForceHardeningTest.php fix(security): harden brute-force, rate-limiting and auth-DoS (audit follow-up) 2026-06-17 17:59:45 +02:00
BruteforceBannedIpTest.php feat(auth): BannedIp model + migration 2026-06-20 17:26:28 +02:00
BruteforceGuardBanTest.php fix(security): close file-read RBAC gap + fail2ban arg-injection + update/HMAC hardening 2026-07-05 16:05:16 +02:00
BruteforceGuardExemptTest.php feat(auth): BruteforceGuard with inet_pton CIDR exemptions 2026-06-20 17:29:00 +02:00
BruteforceHooksTest.php harden(auth): capture login IP once, assert 2fa-failed audit 2026-06-20 18:06:11 +02:00
ButtonComponentTest.php feat(ui): uniform bordered button kit; retire ghost variants 2026-06-14 10:18:47 +02:00
ChallengeFactorAdaptTest.php test(auth): cover TOTP+key challenge branch; clarify mount comment 2026-06-20 15:46:37 +02:00
CommandPaletteServerSearchTest.php fix(services): live journal poll + command-palette server search 2026-06-14 20:13:08 +02:00
CommandShortcutsTest.php docs: use the short `clusev` host-CLI aliases in the README 2026-07-02 21:26:42 +02:00
ConfirmServerScopeTest.php feat(security): signed confirm-action tokens + airtight backup-code reveal 2026-06-15 18:35:33 +02:00
CreateServerTest.php feat(servers): verify SSH on create + start in "Initialisierung" 2026-06-14 10:26:15 +02:00
DashboardAuditTest.php fix(security): keep internal IPs out of shipped code and docs/ out of the public image 2026-07-04 10:25:10 +02:00
EmailResetTest.php fix(security): constant-time password-reset (flatten account-enumeration timing) 2026-06-15 19:16:30 +02:00
ExternalTlsModeTest.php fix(deploy): apply Caddyfile changes on update (dir mount + recreate) 2026-06-19 20:57:42 +02:00
Fail2banBansModalTest.php feat(fail2ban): lazy-load Gesperrte IPs modal behind a skeleton 2026-06-15 03:05:35 +02:00
Fail2banJailValidationTest.php fix(security): close file-read RBAC gap + fail2ban arg-injection + update/HMAC hardening 2026-07-05 16:05:16 +02:00
FileEditorBinaryTest.php fix(files): binary file content no longer breaks the Livewire snapshot (v0.9.54) 2026-06-22 05:49:05 +02:00
FirstFactorCodesTest.php fix(2fa): bound the backup-code reveal flag with a 10-minute TTL 2026-06-15 18:42:58 +02:00
FleetTestConnectionTest.php feat(ssh): add FleetService::testConnection credential probe 2026-06-14 10:24:42 +02:00
ForgotPasswordKeyOnlyTest.php feat(2fa): forgot-password is key-only safe + states the no-2FA recovery path 2026-06-14 21:26:59 +02:00
ForgotPasswordSmtpAwareTest.php feat: short clusev commands in versions panel, lang strings, MOTD 2026-06-19 23:18:25 +02:00
ForgotPasswordTest.php fix(auth): rotate remember_token on reset + atomic recovery-code use 2026-06-14 17:04:12 +02:00
ForgotPasswordTimingTest.php fix(security): flatten reset-timing residuals from Codex review 2026-06-15 19:43:40 +02:00
HardeningServiceTest.php fix(hardening): fail2ban — pin the sshd jail to the systemd backend 2026-06-25 01:14:06 +02:00
HelpPageTest.php feat: help tab-URL + Commands/CLI topic + short command copy 2026-06-19 23:06:45 +02:00
HelpWireguardTopicTest.php feat(wg): WireGuard help topic (registration + DE/EN content + test) 2026-06-20 22:46:04 +02:00
HoneypotSubmitTest.php harden honeypot/ban path: close evasions, unmask & audit-DoS vectors 2026-07-05 15:05:35 +02:00
HoneypotTest.php harden honeypot/ban path: close evasions, unmask & audit-DoS vectors 2026-07-05 15:05:35 +02:00
InstallCommandTest.php security: generate a random install password instead of the literal 'clusev' 2026-07-02 19:33:52 +02:00
MetricHistoryTest.php refactor(metrics): interactive history chart — smooth, area, tooltip, instant ranges 2026-06-25 01:51:24 +02:00
MultiUserTest.php feat(accounts): let the operator set a new user's password directly 2026-06-25 20:29:15 +02:00
OnboardingTourTest.php feat(onboarding): first-run spotlight tour — dimmed backdrop, sidebar highlights, relaunchable 2026-07-02 20:00:19 +02:00
OptionalOnboardingTest.php feat(auth): make password rotation optional + correct the 2FA copy 2026-06-25 19:47:17 +02:00
PersistentSecurityGateTest.php fix(security): register EnsureSecurityOnboarded as persistent Livewire middleware 2026-06-14 22:40:31 +02:00
PipelineStatusTest.php refactor(release): single stable channel — cut internal release candidates (-rc), remove all beta wording 2026-07-05 13:13:09 +02:00
PollMetricsCredentialTest.php harden(fleet,infra): enforce credential revocation on the poller + prod container hardening 2026-07-05 17:10:19 +02:00
PromotionServiceTest.php refactor(release): single stable channel — cut internal release candidates (-rc), remove all beta wording 2026-07-05 13:13:09 +02:00
RbacFleetGateTest.php feat(rbac): gate fleet, host terminal + domain/TLS actions (manage-fleet/operate/manage-panel) 2026-07-05 01:01:24 +02:00
RbacNetworkGateTest.php feat(rbac): gate network + panel actions (manage-network/manage-panel) 2026-07-05 00:52:09 +02:00
RbacOperateGateTest.php fix(security): close file-read RBAC gap + fail2ban arg-injection + update/HMAC hardening 2026-07-05 16:05:16 +02:00
RbacReviewFixTest.php fix(rbac,honeypot): gate audit-retention + email sendTest; honeytoken scans JSON body 2026-07-05 02:28:13 +02:00
RbacSettingsGateTest.php fix(rbac,honeypot): gate settings/release surfaces + per-install canaries, no reflected/auth-user honeypot bans 2026-07-05 02:16:37 +02:00
RbacUiHidingTest.php fix(security): close file-read RBAC gap + fail2ban arg-injection + update/HMAC hardening 2026-07-05 16:05:16 +02:00
RbacUsersTest.php feat(rbac): user-management roles UI — role badge, selector, role-change with last-admin guard 2026-07-05 01:15:32 +02:00
RecoveryCodesModalTest.php style: pint --test fixes (CI pint step now reachable after the test fix) 2026-06-23 02:29:59 +02:00
ReleaseBridgeTest.php refactor(release): single stable channel — cut internal release candidates (-rc), remove all beta wording 2026-07-05 13:13:09 +02:00
ReleaseCheckerChannelTest.php refactor(release): single stable channel — cut internal release candidates (-rc), remove all beta wording 2026-07-05 13:13:09 +02:00
ReleaseCheckerTest.php chore(release): remove every 'gitea' reference from the public tree (comments, test fake-host, redundant ignore) 2026-07-03 19:54:20 +02:00
ReleaseGatingTest.php fix(release): gate the /release route on the flag (spec gating triple) 2026-06-22 23:48:17 +02:00
ReleasePageTest.php refactor(release): single stable channel — cut internal release candidates (-rc), remove all beta wording 2026-07-05 13:13:09 +02:00
ResetAdminCommandTest.php fix(webauthn): counter zero only when stored is zero + CLI clears keys 2026-06-14 18:47:07 +02:00
RestartSentinelTest.php feat(system): auto-restart sentinel — one-click restart via host watcher (no docker socket) 2026-06-14 23:42:50 +02:00
RoleFoundationTest.php feat(rbac): role enum + column + gates foundation (admin>operator>viewer) 2026-07-05 00:42:16 +02:00
ServerContextSyncTest.php fix(ui): set active server at mount only (race-free) 2026-06-14 19:43:24 +02:00
ServerGroupModelTest.php feat(fleet): server groups — organise the fleet + filter (feature 1/8) 2026-07-05 19:36:17 +02:00
ServerGroupsComponentTest.php feat(fleet): server groups — organise the fleet + filter (feature 1/8) 2026-07-05 19:36:17 +02:00
ServerShowPanelsTest.php fix(servers): keep read-error panels visible + pending header support 2026-06-14 10:41:04 +02:00
ServerShowSshHintTest.php feat(servers): hint that disabling password login leaves key-only access 2026-06-14 10:30:07 +02:00
ServicesJournalPollTest.php fix(services): cap live journal at 200 rows in a scrollable, auto-sticking box 2026-06-14 20:58:48 +02:00
SessionManagementTest.php feat(security): signed confirm-action tokens + airtight backup-code reveal 2026-06-15 18:35:33 +02:00
SettingsFactorManagementTest.php feat(security): signed confirm-action tokens + airtight backup-code reveal 2026-06-15 18:35:33 +02:00
SmtpConfigTest.php feat(mail): SMTP configuration in Settings (encrypted password, runtime override, test-send) 2026-06-14 23:42:19 +02:00
SshKeyProvisionModalTest.php fix(ssh): best-effort audit + exception-safe switch/verify and modal run(); lock serverId 2026-06-14 22:16:54 +02:00
SshKeyProvisionerTest.php fix(ssh): graceful failure if password-disable throws post-switch; document privateKey-on-failure contract 2026-06-14 22:04:56 +02:00
StatusComponentTest.php feat(ui): add "Initialisierung" (pending) server status 2026-06-14 10:20:32 +02:00
TerminalTest.php refactor(release): single stable channel — cut internal release candidates (-rc), remove all beta wording 2026-07-05 13:13:09 +02:00
ThreatsPageTest.php harden(opsec): disguise the honeypot naming on the Threats + settings pages too 2026-07-05 19:06:46 +02:00
TlsCertificateRequestTest.php feat(tls): dashboard "request certificate" button (trigger Caddy on-demand TLS) 2026-06-17 18:38:21 +02:00
TlsModeToggleTest.php feat(security): signed confirm-action tokens + airtight backup-code reveal 2026-06-15 18:35:33 +02:00
TwoFactorBackupTest.php polish(auth): distinct backup page title, autocomplete off, empty-code test 2026-06-20 15:38:38 +02:00
TwoFactorChallengeRecoveryTest.php feat(auth): accept a 2FA backup code at the login challenge 2026-06-14 16:50:36 +02:00
TwoFactorWebauthnTest.php feat(webauthn): use a security key at the login challenge 2026-06-14 18:26:58 +02:00
UnbanCommandTest.php feat(auth): clusev:unban CLI + host wrapper escape hatch 2026-06-20 18:07:43 +02:00
UpdateProgressTest.php chore(release): remove every 'gitea' reference from the public tree (comments, test fake-host, redundant ignore) 2026-07-03 19:54:20 +02:00
UserFactorSemanticsTest.php feat(2fa): pluggable factor semantics on User (hasTotp, either-factor, resetIfNoFactor) 2026-06-14 20:38:36 +02:00
UserRecoveryCodesTest.php feat(auth): store 2FA recovery codes (encrypted) on users 2026-06-14 16:48:21 +02:00
ValidIpOrCidrTest.php feat(auth): ValidIpOrCidr validation rule 2026-06-20 17:42:06 +02:00
ValidationMessagesTest.php feat(i18n): custom bilingual validation messages (DE + EN) 2026-06-14 15:45:02 +02:00
VerifyTotpTest.php fix(2fa): TwoFactorSetup back to auth layout; exception-safe User::verifyTotp at all call sites 2026-06-14 21:40:15 +02:00
VersionUpdateCheckTest.php refactor(release): single stable channel — cut internal release candidates (-rc), remove all beta wording 2026-07-05 13:13:09 +02:00
VersionsChangelogTest.php fix(versions): keep the changelog series stable on reload (0.10 -> 0.1 bug) 2026-06-25 02:15:41 +02:00
WebauthnAvailableTest.php fix(webauthn): enable security keys behind an external TLS proxy 2026-06-19 21:11:20 +02:00
WebauthnCredentialTest.php feat(webauthn): install web-auth/webauthn-lib + credential storage 2026-06-14 18:18:05 +02:00
WebauthnKeysTest.php feat(security): signed confirm-action tokens + airtight backup-code reveal 2026-06-15 18:35:33 +02:00
WebauthnOptionsTest.php fix(webauthn): add security-key hint so passkey managers defer 2026-06-19 21:30:52 +02:00
WgBridgeTest.php feat(wg): set WireGuard up from the dashboard (setup form + bridge action) 2026-06-21 08:09:35 +02:00
WgSampleCommandTest.php feat(wg): clusev:wg-sample command (sample peers + prune) + schedule 2026-06-21 00:00:06 +02:00
WgStatusTest.php feat(wg): WgStatus reader + auth-gated /wg-status.json route 2026-06-20 23:32:44 +02:00
WgTrafficSampleTest.php feat(wg): wg_traffic_samples table + model 2026-06-20 23:59:11 +02:00
WgTrafficTest.php fix(wg): WgTraffic up = throughput delta (not raw tx) — consistent with down 2026-06-21 00:04:07 +02:00
WireguardPageTest.php fix(security): keep internal IPs out of shipped code and docs/ out of the public image 2026-07-04 10:25:10 +02:00
WithFleetContextTest.php perf(fleet,wg) + i18n(dashboard,update) + a11y(btn): re-audit design/perf cleanups 2026-07-05 17:10:19 +02:00