Self-hosted monitoring for homelabs: host and container metrics and uptime checks from all your machines in one dashboard, with an optional AI agent that diagnoses incidents and suggests fixes.
Python ai-agentsaiopsdashboarddockerfastapihomelabincident-managementllmmonitoringopenaireactroot-cause-analysisself-hosteduptime-monitoring
Checklist: frontend (src/frontend/**)
Read src/App.jsx (large), StatisticsPage.jsx, FleetStatistics.jsx,
ContainerStatistics.jsx, ServerInsights.jsx, charts.jsx, distributions.jsx,
*Logic.js, chartMath.js, main.jsx, index.html, vite.config.js, package.json.
1. XSS
The dashboard displays attacker-controlled data (container names, mount paths, event messages, assistant text, server names). Stored XSS in an admin context = dashboard takeover, so this is the main item.
- Search for:
dangerouslySetInnerHTML,innerHTML,outerHTML,insertAdjacentHTML,document.write,eval,new Function,setTimeout("string"),srcdoc,postMessagewithout an origin check. Trace every occurrence back to the data source. - Markdown/rich text (assistant output, descriptions): is a library used? Is HTML
disabled or sanitized (DOMPurify with a restrictive configuration)? Links from markdown
filter out
javascript:/data:. - URL attributes from data:
href,src,action,formAction:http(s)scheme only (plusmailtoif needed).target="_blank"hasrel="noopener noreferrer". - SVG from data (charts that embed strings in SVG,
<text>,<title>,<a>): React escapes text, but check hand-built SVG strings andstyleobjects with data. - CSS injection: data values in
style/classNamebuilt from strings. - Prototype pollution: merging objects from collector JSON (
Object.assign, spread into keys from data,obj[key] = ...with a key from data,__proto__).
2. Authentication and secrets in the browser
- Tokens/sessions are not kept in
localStorage/sessionStorage/the URL (the session is an HttpOnly cookie). Check what is stored inlocalStorage(sensitive data, tokens, TOTP, recovery codes). - Recovery codes and the TOTP secret: shown only once, not stored in state that survives
navigation, never end up in the URL or the console log (
console.log). - No API keys,
SECRETS_KEYor internal URLs baked into the bundle (import.meta.env.VITE_*is public). Search forVITE_. - The frontend makes no security decisions that the backend does not check (hiding an admin button is not access control; the backend checklist covers that, here just note it).
- Logout clears in-memory state; sensitive responses are not cached (nginx/
Cache-Controlfor the API).
3. Generating install commands ("Connect a server")
The panel generates a command that the user copies and runs on a remote machine. It contains the join token and the image digest.
- Every value in the command (token, digest, URL,
COLLECTOR_BIND, name) is validated or shell-quoted. A value containing;,$(...),`,', a newline or a space must not break out of the quotes. Check where the values come from (dashboard configuration, API response) and how they are concatenated into the string. - The command does not use
curl | shor unpinned images; the digest is mandatory, and the display makes it clear what the user is running. - The token is shown once, has a visible expiry, and "Copy" does not leave it in state history.
4. Network call sites and CSRF
- State-changing
fetchcalls send the cookie (credentials) only to the app's own origin; no calls to arbitrary URLs taken from data. - No open redirect (
window.location = param), noredirect/nextparameter without a check that it is a relative path. - Error handling does not show stack traces/secrets to the user; API responses containing third-party strings are displayed as text.
5. CSP and build
- The frontend works under a strict CSP without
unsafe-inlinefor scripts (no inline<script>inindex.html, noevalin the bundle). New sources that require widening the CSP must be documented. -
vite.config.js: the dev proxy/server.hostdoes not expose the dev server;build.sourcemapis off in production or intentional; nodefinewith secrets. -
index.html: no external scripts/fonts without SRI; no inline handlers. - Dependencies (
package.json): unusual or unnecessary ones,postinstallscripts; see the infra checklist for audit tools.
6. Availability as security
- Rendering does not crash or freeze the browser on hostile data: very long strings,
thousands of containers,
NaN/Infinity/negative numbers in charts (chartMath.js,fleetLogic.js,containerLogic.js), empty arrays, unknown fields. A whole-app crash caused by one malformed record = an attacker with a collector can disable the dashboard.