713 Commits

Author SHA1 Message Date
rcourtman
1edfa4311e feat: Unified Resource Model and Navigation Redesign
## Summary
Complete implementation of the Unified Resource Model with new navigation.

## Features
- v2 resources API with identity matching across sources (Proxmox, Agent, Docker)
- Infrastructure page with merged host view
- Workloads page for all VMs/LXC/Docker containers
- Global search (Cmd/Ctrl+K) with keyboard navigation
- Mobile navigation with bottom tabs and drawer
- Keyboard shortcuts (g+key navigation, ? for help)
- What's New modal for user onboarding
- Report Incorrect Merge feature for false positive fixes
- Debug tab in resource drawer (enable via localStorage)

## Technical
- Async audit logging for improved performance
- WebSocket-driven real-time updates for unified resources
- Session-based auth achieves <2ms API response times

## Tests
- Backend: 78 tests passed
- Frontend: 397 tests passed
2026-02-05 17:57:59 +00:00
rcourtman
b69229193d Add unified resource model v2 API and matcher 2026-02-05 17:57:58 +00:00
rcourtman
b6e4c20e6b fix: preserve email rateLimit when not explicitly provided in request
Backend fix:
- Added presence check in UpdateEmailConfig to detect when rateLimit is
  omitted from JSON (vs explicitly set to 0)
- Preserves existing rateLimit value when field is not present in request
- Added comprehensive integration tests covering all scenarios

Frontend fix:
- Added rateLimit to EmailConfig interface
- Fixed getEmailConfig to read rateLimit from server response
- Fixed updateEmailConfig to include rateLimit when set
- Fixed two places in Alerts.tsx that hardcoded rateLimit: 60

Additional fixes:
- Added Array.isArray guards in DiagnosticsPanel sanitization
- Initialized Nodes/PBS arrays in diagnostics response to prevent null

Closes rate limit persistence bug where updating email settings would
reset the rate limit to default value.
2026-02-05 09:59:05 +00:00
rcourtman
dc66eb544c fix(config): ensure NotifyOnResolve defaults to true for new and legacy configs 2026-02-05 09:59:05 +00:00
rcourtman
0f961054c6 fix: allow agent tokens to auto-register Proxmox nodes
The security hardening in beae4c86 added a settings:write scope
requirement to /api/auto-register, but agent install tokens only have
host-agent:report scope. This broke Proxmox auto-registration for all
agent-generated tokens. Accept either settings:write or host-agent:report
scope for auto-registration.

Fixes #1191
2026-02-04 22:55:25 +00:00
rcourtman
f6338f34fa fix: add agent:exec scope to generated agent tokens
Agent tokens created from the Settings UI and the backend install
command handler were missing the agent:exec scope, which was added
as a security requirement in 60f9e6f0. This caused all newly
installed agents to fail registration with "Agent exec token missing
required scope: agent:exec".

Fixes #1191
2026-02-04 22:33:01 +00:00
rcourtman
5bbc4329bd Remove pprof diagnostics endpoint 2026-02-04 20:44:00 +00:00
rcourtman
a37b59b7e4 Add admin-gated pprof diagnostics endpoint 2026-02-04 20:39:24 +00:00
rcourtman
ee0e89871d fix: reduce metrics memory 86x by reverting buffer and adding LTTB downsampling
The in-memory metrics buffer was changed from 1000 to 86400 points per
metric to support 30-day sparklines, but this pre-allocated ~18 MB per
guest (7 slices × 86400 × 32 bytes). With 50 guests that's 920 MB —
explaining why users needed to double their LXC memory after upgrading
to 5.1.0.

- Revert in-memory buffer to 1000 points / 24h retention
- Remove eager slice pre-allocation (use append growth instead)
- Add LTTB (Largest Triangle Three Buckets) downsampling algorithm
- Chart endpoints now use a two-tier strategy: in-memory for ranges
  ≤ 2h, SQLite persistent store + LTTB for longer ranges
- Reduce frontend ring buffer from 86400 to 2000 points

Related to #1190
2026-02-04 19:49:52 +00:00
rcourtman
502766b9b7 fix: proxy agent binary from GitHub instead of redirecting
When the server doesn't have agent binaries locally (common for
LXC/bare-metal installations), it was redirecting to GitHub releases.
The agent's HTTP client followed the redirect, but GitHub doesn't
provide the X-Checksum-Sha256 header that agents require for security
verification, causing every update attempt to fail silently.

Proxy the download through the server instead, computing and attaching
the checksum header so agents can verify and install the update.
2026-02-04 19:31:33 +00:00
rcourtman
7e55c4dc52 Expand proxy non-admin coverage for permissioned routes 2026-02-04 18:12:30 +00:00
rcourtman
422271d103 Require proxy admin for permissioned endpoints 2026-02-04 18:11:12 +00:00
rcourtman
4741307c4c Require proxy admin for quick security setup 2026-02-04 18:08:40 +00:00
rcourtman
25285e64bc Require proxy admin for AI test endpoints 2026-02-04 16:30:22 +00:00
rcourtman
5a494b10a5 Cover proxy auth for AI settings updates 2026-02-04 16:27:48 +00:00
rcourtman
34f35f0322 Protect discovery notes secrets for proxy users 2026-02-04 16:25:16 +00:00
rcourtman
12038e4e9a Guard discovery settings against proxy non-admin 2026-02-04 16:23:08 +00:00
rcourtman
a2f01f14af Require proxy admin for token regeneration 2026-02-04 16:19:57 +00:00
rcourtman
0867490ae0 Block proxy non-admin password changes 2026-02-04 16:17:00 +00:00
rcourtman
27d8cc92dc Cover proxy auth on config export/import 2026-02-04 16:13:15 +00:00
rcourtman
ce9ee2481a Enforce proxy user RBAC via RequirePermission 2026-02-04 16:11:41 +00:00
rcourtman
9d4d392026 fix: host network sparklines showing cumulative bytes instead of rates
Host network sparklines were displaying wildly incorrect values (e.g., 147 GB/s
for an idle Raspberry Pi) because cumulative byte counters (total bytes since
boot) were being stored directly instead of being converted to rates.

Changes:
- monitor.go: Use RateTracker to calculate network rates for hosts, matching
  the existing pattern used for VMs and containers. Only record network
  metrics when we have enough samples to calculate valid rates.
- router.go: Remove network metrics from live fallback for hosts since we
  can't calculate rates from a single snapshot. Better to show nothing than
  misleading cumulative totals.

The fix follows the established codebase pattern where:
1. Agent reports cumulative RXBytes/TXBytes
2. RateTracker compares consecutive samples to calculate bytes/second
3. Rates are stored in metrics history for sparkline display
2026-02-04 16:11:04 +00:00
rcourtman
f7bc69fac2 Add AI reapprove scope and license tests 2026-02-04 16:04:46 +00:00
rcourtman
c724bb04cf Extend proxy admin denial coverage 2026-02-04 16:00:43 +00:00
rcourtman
5f2990deec Require proxy admin for SSH config endpoints 2026-02-04 15:57:59 +00:00
rcourtman
145e5c46bb Require admin for host config patch and delete 2026-02-04 15:56:07 +00:00
rcourtman
5ede1f6a97 Harden apply-restart auth for proxy/OIDC 2026-02-04 15:48:06 +00:00
rcourtman
0f2122ea85 Cover proxy admin gating for config management 2026-02-04 15:45:31 +00:00
rcourtman
093235b0a9 Extend proxy admin gating to agent manage endpoints 2026-02-04 15:44:24 +00:00
rcourtman
df799c66d5 Expand proxy admin gating for host and profiles 2026-02-04 15:42:54 +00:00
rcourtman
e9860eb4c6 Block proxy non-admin for security restart and OIDC 2026-02-04 15:41:50 +00:00
rcourtman
248f4c69a5 Ensure proxy non-admins blocked for AI admin endpoints 2026-02-04 15:40:14 +00:00
rcourtman
773ba13ada Require ai:execute for approvals approve/deny 2026-02-04 15:39:04 +00:00
rcourtman
23cc5af69f Require proxy admin for test-notification 2026-02-04 15:34:30 +00:00
rcourtman
e3179e49ac Cover RBAC mutation license gating 2026-02-04 15:22:38 +00:00
rcourtman
4e3811e69e Cover RBAC mutations in permission denial tests 2026-02-04 15:21:02 +00:00
rcourtman
895a7e07e2 Verify host uninstall enforces token binding 2026-02-04 15:16:12 +00:00
rcourtman
e069507d97 Add scope checks for notification endpoints 2026-02-04 15:10:02 +00:00
rcourtman
d257815564 Reject recovery via untrusted XFF 2026-02-04 15:01:09 +00:00
rcourtman
b35de694bb Document legacy token org access 2026-02-04 14:55:20 +00:00
rcourtman
f6b70da39f Enforce token precedence for tenant access 2026-02-04 14:54:14 +00:00
rcourtman
8300ec8460 Prefer org header over cookie 2026-02-04 14:51:14 +00:00
rcourtman
d06c749c1a Reject org cookie for non-member 2026-02-04 14:48:03 +00:00
rcourtman
9ff395eba4 Cover tenant user membership checks 2026-02-04 14:41:08 +00:00
rcourtman
5e4de1e849 Deny proxy non-admin despite token 2026-02-04 14:35:08 +00:00
rcourtman
3fe152bba8 Allow API tokens with OIDC enabled 2026-02-04 14:27:46 +00:00
rcourtman
313df78cf7 Require auth for admin endpoints with OIDC 2026-02-04 14:26:38 +00:00
rcourtman
c5308adf6e Cover admin bypass routing 2026-02-04 14:24:42 +00:00
rcourtman
fecfc74c0a Gate admin endpoints for proxy users 2026-02-04 14:21:10 +00:00
rcourtman
de2ed1b33a Cover multi-org token authorization 2026-02-04 14:15:50 +00:00