A disk that is on course to be full within 14 days (setting: 0 turns it off) is
flagged on the Alerts page and dashboard, from the server's own history: needs
three days of steady growth, skips erratic disks and ones the ordinary disk
alert covers. Skeleton placeholders replace "Fetching status…" and "Loading…".
Alerts that a maintenance window can silence get a Silence button (1, 4 or 24
hours) that starts one, and the alert list is refreshed at once when a window
starts or ends.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Tables stack into labelled cards on a phone. Green, red and amber badges carry
a check, cross or triangle as well as their colour. Pages inside a menu group
show a breadcrumb, with the thing's name on a server's page. Integrations are
cards with an Open button and a live status (working, failing, not checked yet,
disabled). Agent-reported servers keep a short history of load, memory and disk
use (migration 0019, one sample per ten minutes for 35 days) and show it as a
Trends card with a days-until-full forecast for a filling disk.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Setting ENVIRONMENT_NAME (and optionally ENVIRONMENT_COLOR, a name or hex
value) gives the sidebar that colour, adds a name badge next to the title and
on the sign-in page, and prefixes the browser tab title, so a dev copy can't
be taken for production. Unset, nothing changes. The colour is validated to a
plain #rrggbb before it reaches the page's styles. A public
GET /api/environment lets the sign-in page use it too.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Uptime Kuma often watches a host by another address than the one it was added
with here (a Proxmox host monitored over Tailscale, say). Address aliases on
the Maintenance page say that an address belongs to a server, integration or
DNS provider, so the sync puts the window there; matching stays exact.
Migration 0018 adds maintenance_aliases.
Also fixes monitors whose empty hostname/URL/port arrive from Kuma's metrics as
the text "null": they were taken as an address, hiding the real URL.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A monitor whose address is the host of an integration's or DNS provider's own
address now gets a maintenance window there, alongside the existing match
against servers. Matching stays exact (no inference through DNS), and monitors
that match nothing are listed with their address in the sync result.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Uptime Kuma shares its maintenance windows only over its dashboard Socket.IO
connection, which takes a login. With a login username and password on the
integration, "Sync schedule" on the Maintenance page (and a 15-minute
background pass when switched on) reads each window's running and next time
slot and the monitors it covers, and makes a maintenance window on every
server those monitors match. Windows that haven't started are listed as
Scheduled and silence nothing until they begin; ones ended or cancelled by
hand stay ended, and ones removed in Kuma are removed here.
maintenance_windows gets a source column (migration 0017) and active windows
now require their start to have passed. Adds socket.io-client, and tests
against a stand-in Uptime Kuma speaking the same protocol.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The import route returned its errors as {error} while the page reads
{message}, so a wrong API key or an unreachable Uptime Kuma showed as raw
JSON. Every failure now carries a readable message. An empty result now
says how many monitors were read and that only maintenance active right
now can be imported, and a disabled integration is explained instead of
leaving a greyed-out button. Adds route tests against a stand-in Uptime Kuma.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The expiry date is now optional: no date means the secret never expires,
gets the status "no expiry" and never raises an alert or reminder. The
Secrets form has a "Never expires" checkbox. Certificates checked against a
host keep their live expiry and can't be set to never expire. Migration
0016 makes secrets.expiry_date nullable.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Percent-encoding put "%20" in every space of a real ticket, and the base64 that replaced it arrived
as base64. osTicket (Format::parseRfc2397, via ApiJsonDataParser::fixup) takes the message's type from the
"data:" prefix and uses everything after the first comma exactly as it is, decoding nothing; its own
documented example is plain text after the comma. The text is now sent raw (JSON takes care of quotes and
line breaks; later commas are fine, since only the first one splits).
The test now mimics that parsing -- split at the first comma, decode nothing -- and requires the text to
arrive exactly as written; it fails if percent-encoding or base64 comes back. The stand-in server in the
earlier test had decoded the encoding, which is why neither mistake was caught. INTEGRATIONS.md says what
happened and that it hasn't been re-checked against a real osTicket.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A test ticket sent to a real osTicket arrived with every space shown as %20. osTicket takes the
message's type from an RFC 2397 data URL and strips the "data:" part, but leaves percent-encoded text
as it is. The message is now sent as base64 (data:text/plain;charset=utf-8;base64,...), which osTicket
decodes (it is how it takes attachments), and which works whether or not a given osTicket version
decodes percent-encoding.
The stand-in osTicket in the test had decoded the percent-encoding, which is why this wasn't caught:
the test now requires base64 and fails if any percent-encoding is in the message. INTEGRATIONS.md says
the ticket API is only partly verified against a real osTicket, and what that first test showed.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
With Settings -> Alert tickets switched on (off by default), every 15 minutes the problems on the
Alerts page are looked at and one that is new and has lasted gets one ticket in osTicket, through
its API (POST api/tickets.json, key in X-API-Key). One problem opens one ticket however many checks
see it; the app remembers what it has seen in a new alert_tickets table (migration 0015).
- Which: critical and warning by default, every kind; severities and kinds are settings.
- A problem must be seen in 2 checks in a row first (1-4, a setting), so a blip that fixes itself,
like one failed call to an integration, never opens a ticket.
- One ticket per occurrence; a problem that clears and returns within 60 minutes is the same one.
- More than 5 new problems in one check become a single summary ticket.
- Never for alerts under a maintenance window, nor about osTicket itself or its overdue tickets.
- Problems already there when it is switched on are left alone by default (the first check records
them as a baseline); can be set to ticket them too.
- If osTicket can't be reached nothing is recorded, so the next check retries; if a source couldn't
be read, a problem isn't treated as gone. Every ticket is audited.
The ticket API address, key (stored encrypted) and self-signed option are optional fields on the
osTicket integration, which otherwise still only reads the database. The settings page can send a
test ticket and run a check now; the Alerts page shows each alert's ticket number, linked to osTicket.
osTicket's API can't close or update a ticket, so a ticket opened here is the end of this app's part
in it. Tested against a stand-in osTicket, not a real one.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The records endpoint returned raw cache rows, whose `id` is this app's own row number
(12, 13, ...). The DNS page sends `r.id` back when a record is edited or deleted, so the
provider was handed a row number instead of its record id. That only worked straight after
a manual Sync, whose response carries the provider's ids; after any save or delete the page
reloads from the cache and the problem came back. The ID check added for connected systems
now refuses such an id with "That isn't a valid record ID".
The list now returns records shaped like a sync's: `id` is the provider's record id. Editing
and deleting work from the cached list for every DNS provider.
The test checks the list hands out the provider's id, and that deleting with it reaches
Cloudflare at the right address; with the old shape it fails.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
From an audit of the Authentik login, run against a fake OIDC provider:
- Session fixation: the session id wasn't changed at sign-in, so one planted beforehand
(from another page on the domain) became signed in as the victim. It is regenerated now.
- Requests from another origin: SameSite=Lax doesn't stop another app on the same parent
domain, and a body-less POST (stop a guest, rotate a token) needs no preflight. Every
POST/PUT/PATCH/DELETE, and GET /auth/logout, is refused when Sec-Fetch-Site (or, for older
browsers, Origin) says it came from elsewhere. The agent endpoint is exempt: it uses a token.
- ID token signature: openid-client checks a token's claims but, as OIDC allows for a token
from the token endpoint, not its signature, so the login rested on HTTPS to Authentik
alone. The signature is now verified against the provider's published keys (jose, now a
declared dependency).
- SESSION_SECRET: production refuses to start without one (the fallback is in the source
code) and warns when it is the .env.example placeholder or short.
- Response headers: frame-ancestors 'none', X-Frame-Options, nosniff, Referrer-Policy; the
framework name is no longer sent.
- A failed sign-in shows a plain page and is audited (session / login_failed, with address
and reason, no tokens); sign-in is limited to 20 attempts a minute per address so the
audit log and session store can't be flooded.
- A failed OIDC discovery (provider down at the first sign-in) was remembered until restart;
it is retried now.
Tests run the real app against the fake provider; switching each fix off in turn makes
the matching tests fail.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
index.ts builds the app, runs migrations and starts the schedulers in one go, so nothing
could exercise the app without also starting all that. The app itself (middleware order,
session store, routers) is now createApp() in app.ts; index.ts keeps the startup work and
calls it. No change in behaviour. The test that checks the agent endpoint is mounted ahead
of the 100 KB JSON parser reads app.ts instead.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The systemd unit now bounds the agent's capabilities to the three jobs it does as root --
reading every user's crontab (DAC_OVERRIDE, DAC_READ_SEARCH), running "crontab -l -u"
(SETUID, SETGID) and naming the program behind each socket (SYS_PTRACE) -- and adds
ProtectClock, ProtectHostname, MemoryDenyWriteExecute and DevicePolicy=closed. It does not
use PrivateDevices, which would hide /dev/log (crontab logs each read there), nor anything
that hides other processes or users, since the agent needs both.
The installer's umask 077 (for the token file) also left the unit files readable by root only;
they now get chmod 644, so "systemctl cat" works for any user.
The test renders the unit through the installer's own heredoc, so a stray backtick or $ would
show up, and pins the capability list: tightening it silently drops tasks or process names.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Certificate check, WHOIS lookup and port scanner connect to hosts that are typed in
or named by a plain-text reply. utils/networkGuard.ts now refuses loopback, link-local
(cloud metadata) and similar addresses for all three -- and a WHOIS server on a private
network -- and the connection goes to the address that was checked rather than looking
the name up again (no DNS rebinding). LAN hosts remain fine for certificate checks and
scans.
Agent endpoint: the token is checked before the body is read, the route is mounted ahead
of the 100 KB JSON parser so a real agent can send a large report (up to 4 MB), and
overlong text is trimmed instead of costing the host its whole report. An oversized or
malformed body is answered with 413 / 400 instead of a generic 500.
Tests (npm test --workspace server): the guard, the secrets route, the agent endpoint, the
Linux upload run against a fake server (token never on curl's arguments, private temp dir
removed), the systemd unit's directives, and the Windows folder permissions read back by
SID. 19 of the 26 new tests fail against the previous code.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The Tailscale device, Proxmox node, Cloudflare zone/record and Azure record/zone IDs
were put into the outgoing request path as typed. An operator could send a crafted ID
("x/../../tailnet/-/keys/k1") and make the app call a different endpoint than the button
meant -- delete an auth key instead of a device, stop every guest on a node, delete a whole
DNS zone -- under the integration's own credential. Gitea and Dockhand encoded their IDs but
still passed "..".
- utils/pathSegment.ts: checks an ID against what a real one looks like, then encodes it
(encodeURIComponent alone leaves ".." untouched). Used by the Tailscale, Proxmox,
Cloudflare, Azure, Gitea and Dockhand adapters.
- The routes refuse a bad ID with a 400 before anything is sent, and the DNS routes turn the
adapters' refusal into a 400. A server's Proxmox node name is validated when saved.
- Azure: a zone ID without "::" is now refused instead of being cut into two bogus pieces.
- Regression tests (npm test --workspace server, Node's built-in runner): the crafted IDs
are refused for every adapter and route, real IDs still work, viewers are still refused.
Against the old code 13 of the 22 tests fail.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>