738 Commits
Author SHA1 Message Date
Juan Denis 43c4872b56 Stream the pool-retry test through the shared stub
The streaming retry test patched subprocess.Popen by hand, which
the stub-adoption ratchet counts. The shared FakePopen could not
stand in because its stdout had no readline(); it does now, so the
test scripts the two compose runs through fake_subprocess instead.
2026-11-14 22:54:09 -05:00
Juan Denis 9d97a1c305 Give new WordPress sites PhpRedis and MySQL 8.4
Object Cache Pro refuses to start without the redis PHP extension,
which the upstream wordpress image does not ship, so the runtime image
now builds it and fails the build if it does not load.

Site Health flags MySQL 8.0 as outdated and WordPress recommends 8.4,
so new sites are created on 8.4. Existing sites keep the database
they have; nothing upgrades a data directory in place.

Fixes #252
Fixes #253
2026-11-14 22:28:04 -05:00
Juan Denis ccfd68607b Pin a subnet when Docker's address pools run out
Every compose project takes a bridge network from Docker's default
pools, and a stock daemon has about thirty. Past that every new stack
failed at network creation with "all predefined address pools have
been fully subnetted", however idle the host was.

compose up now answers that failure by giving the project's networks
a /26 from SERVERKIT_COMPOSE_SUBNET_POOL (10.213.0.0/16) and starting
again. The pin goes into the project's own compose file: a separate
override is undone by any plain compose up, which recreates the
network from the exhausted pools.

Fixes #254
2026-11-14 22:28:01 -05:00
Juan Denis 2871da1458 Make each overview KPI its own board block
An overview section that wraps a whole strip of KPI tiles is one
block on a board meant to be rearranged tile by tile. Each KPI is
now an OverviewSection with `tile`: the frame is the tile's card,
with no header outside edit mode. `replaces` swaps a retired block
in a saved layout for the blocks it was split into.

Applied to Monitoring, Backups, Server, Security and Workspace.
Security and Workspace move onto the overview board to get there,
so the backend accepts their layout scopes.
2026-11-14 18:36:24 -05:00
Juan Denis 5f23e9fe6d Put Monitoring and Backups on the overview board
Their overviews are now boards like the server and service ones: each
panel is a block that can be moved, resized, removed or opened
fullscreen, with dashboard widgets alongside (Monitoring's follow the
host the page is scoped to). Layouts are saved per user under two new
board scopes.

Every board gets a quiet "Edit overview layout" link under its blocks,
so pages without a menu of their own have a way in. Monitoring layout
baselines updated.
2026-11-14 14:59:05 -05:00
Juan Denis 4fa5caef79 Report services and domains per server
The server list could not say what a server carries. It now returns
services_count and domains_count for every row, computed for the whole
list in two queries and limited to the services the caller may see, so
a count never reveals something they have no access to.
2026-11-14 14:37:33 -05:00
Juan Denis e1972e7ee9 Store overview layouts as scoped boards
A user can now save the Overview layout of a kind of detail page
(server, service). It is an ordinary dashboard board whose slug names
the kind, so it reuses the existing storage, validation and ownership
rules and needs no new routes or migration: POST with a scope upserts
it, GET ?scope= reads it, DELETE returns to the shipped layout. Scoped
boards are never listed among the dashboard tabs.
2026-11-14 13:59:00 -05:00
Juan Denis 63b73c9fdb Merge dev into feat/ui-security-polish 2026-11-04 10:13:24 -05:00
Juan Denis c5a90e2c82 feat(extensions): solid update detection (builtin sources, trust hints, refresh, count) 2026-11-03 20:20:35 -05:00
Juan Denis 2eae9f9146 test: raise the test-count baseline 2026-11-03 13:10:27 -05:00
Juan Denis 2802913419 fix(security): log instead of echoing exception text in sso, ssl, waf and buildpack routes 2026-11-03 13:10:27 -05:00
Juan Denis 60a5e0a18a fix(backups): answer 503 backup_dir_unavailable when the backup dir is not writable 2026-11-03 13:10:27 -05:00
Juan Denis cb176ab678 fix(security): drop unsafe-eval from the managed-app nginx CSP template 2026-11-03 13:10:27 -05:00
Juan Denis 313202af8d test: cover TOTPService and PermissionService 2026-11-03 12:57:58 -05:00
Juan Denis 9b93cb34ef fix(backups): degrade gracefully when the backup dir is not accessible 2026-11-03 12:57:58 -05:00
Juan Denis dd9003d458 fix(security): replace bare excepts, stop leaking exception text
Bare excepts in sockets/servers/system now catch specific errors and log;
malformed metrics from/to returns 400. docker cleanup and update-check no
longer echo str(e).
2026-11-03 12:57:58 -05:00
Juan Denis 800a54dc1a fix(security): route webhook posts through safe_http
monitoring and generic chat webhooks now refuse private/loopback targets.
2026-11-03 12:57:58 -05:00
Juan Denis 81aa19dafd fix(security): drop unsafe-inline/unsafe-eval from script-src
Move the theme FOUC snippet to /theme-init.js, allow the build-injected
vendor importmap by sha256, keep blob: for runtime extensions. Document the
localStorage token limitation in SECURITY.md.
2026-11-03 12:57:58 -05:00
Juan DenisandClaude Sonnet 5.5 a4d2ea37ef feat(agents): permission levels, signed report endpoint, health alerts
Agent-reported monitor/protect/full level (never settable from the panel),
POST /api/v1/agent/report for report-only agents, silence-based offline
detection, service-check alerts via MetricAlert, a panel-side command gate,
docs, and a demo seed script. Migration 112.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 00:04:58 -05:00
Juan Denis 2521da0e46 Add an SSH Access server permission profile
Faro access grants install keys through the agent's ssh:keys
actions. A locked-down server had no canned profile for that short
of Full Access; ssh_access grants ssh:keys:* plus the health reads.
2026-10-26 11:16:21 -04:00
Juan Denis a9668000da Keep the new route logic behind services
The SSL-enable and server-overview changes put session and query
calls in the routes, tripping the controller-boundary ratchet. Move
them into SiteDomainService and WorkspaceService, raise a typed error
for bad allowed_ips, point the ACME-contact test at the new vhost
door, and regenerate the baseline and inventory (476 -> 453).
2026-10-26 01:43:12 -04:00
Juan Denis e3131659c2 Satisfy the test seed ratchet
The custom-domain SSL test seeded its app by hand instead of through
make_application, and test_manifest_reach.py no longer seeds one, so
its baseline entry went stale.
2026-10-26 01:03:40 -04:00
Juan Denis 411ce694da Remove the orphaned manifest preview service
The generic preview provisioner replaced its only caller; only its
own tests still reached it, proving a path production no longer
takes.
2026-10-26 01:02:35 -04:00
Juan Denis 1fe8ada10d Look up agent registration tokens by digest
POST /servers/register needs no login and ran a slow PBKDF2 check
against every pending server per request, so a few IPs under the
5/min limit could keep the single worker's CPU busy. Tokens carry 256
random bits, so store a SHA-256 digest and find the row directly;
hashes issued before this still verify until they expire.
2026-10-26 01:00:48 -04:00
Juan Denis a915e95474 Send container log streams only to their viewer
Every subscriber starts its own docker logs process but emitted into
the shared app room, so with two viewers open each saw every line
twice, got the other's tail replayed, and both saw 'ended' when either
stream stopped. Deliver to the owning socket while room membership
still gates it, keeping the per-line access re-check.
2026-10-26 00:59:21 -04:00
Juan Denis c5d0597140 Make login-link redemption truly single-use
redeem() checked used_at, then set it and committed, so two requests
arriving together (a mail-preview bot and the user, or an attacker
racing them) both passed the check and both got a session. Claim the
link with one conditional UPDATE and refuse when no row changed.
2026-10-26 00:57:28 -04:00
Juan Denis 2dee9fa891 Pass DB passwords via env, not the command line
docker exec -e MYSQL_PWD=<pw>, mysqldump -p<pw> and friends put the
root DB password in argv, readable by every local account through ps
or /proc. Add secret_env() and hand the password to the child's
environment (bare -e NAME for docker exec), and drop it from the
mysqladmin readiness ping, which never needed it.
2026-10-26 00:56:42 -04:00
Juan Denis 83ea2c59d4 Write cron and storage settings atomically
Both files used a truncating open() and their loaders read damage as
empty, so a full disk mid-write reset off-site backups to local and
the next cron add replaced every job's metadata with the new job.
Route both through the config store's temp+replace write; an
unreadable file is moved aside instead of being overwritten.
2026-10-26 00:53:25 -04:00
Juan Denis a79d5010c2 Escape % in crontab commands
cron treats a bare % as end-of-command and pipes the rest to stdin,
so a job like 'date +%F >> log' ran as 'date +' on schedule while
Run now (bash -c) ran it correctly. Write lines with \%, unescape
when parsing, and locate a job's line by parsing in edit and
tracking so legacy unescaped lines are still found and fixed.
2026-10-26 00:51:38 -04:00
Juan Denis cb93120bac Keep custom-domain HTTPS across vhost rebuilds
Enabling SSL on a custom domain edited the vhost in place, but every
later rewrite (deploy, slot switch, domain attach, drift repair,
restore) rebuilt it from Domain rows that only knew wildcard certs,
so HTTPS silently disappeared while the row still said enabled.

Rebuilds now resolve each domain's own cert and render one server set
per certificate when domains differ. Enable/attach publish through
write_app_vhost and only claim SSL when nginx accepted it, the key
path is stored under its real column (legacy rows fall back to
certbot's privkey.pem), disable drops the HTTPS block, and a repeat
add_ssl_to_site swaps the cert instead of breaking nginx -t.
2026-10-26 00:49:57 -04:00
Juan Denis f724cf0067 Keep live sockets alive past access-token expiry
Every emit re-validated the socket's saved JWT including exp, and
access tokens last 15 minutes, so metrics, terminals, logs and
notifications were cut a quarter-hour after connecting; clients do
not reconnect after a server-side disconnect. Re-checks now skip exp
only; revocation, auth_version and deactivation still end the socket,
and connecting still needs an unexpired token.
2026-10-26 00:44:28 -04:00
Juan Denis 475add2674 Validate Postgres helper SQL and report user errors
pg_create_database/user and pg_grant/revoke built superuser SQL from
raw names and passwords, unlike the MySQL helpers beside them. A quote
in a password broke CREATE USER, and the create routes ignored that
and returned credentials for a user that did not exist. Validate
identifiers and privilege lists, escape the password, and surface a
failed user as user_error instead of fake credentials.
2026-10-26 00:43:13 -04:00
Juan Denis 84d6cdef4c Block file ops on parents of protected roots
PROTECTED_ROOTS only matched the path the user typed, so copying /opt
copied /opt/serverkit/.env (JWT key, DB creds) somewhere readable,
and deleting or moving /opt took the running panel with it. Refuse
copy, move, rename and delete when a protected root lies inside the
source, and keep symlinks as links when copying a tree.
2026-10-26 00:39:26 -04:00
Juan Denis e1835149a7 Require a verified email before SSO account linking
find_or_create_user attached a new SSO identity to any user with the
same email, but Google and generic OIDC profiles never carried
email_verified. An IdP account showing an unverified copy of the
admin's address signed in as the admin. Carry the claim through and
refuse to link without it; GitHub and SAML already vouch.
2026-10-26 00:37:57 -04:00
Juan Denis 8ab5ab1bfc Stop SSO from auto-creating developer accounts
Auto-provision defaulted on with role developer and no domain filter,
so enabling GitHub login for yourself let any GitHub user sign up and
open remote terminals, while password registration stayed closed.
Default to off and viewer; turning it on stays an explicit choice.
2026-10-26 00:36:57 -04:00
Juan Denis 9b85952b5f Enforce workspace access on every server route
Only three routes checked can_access_server; the rest loaded the server
by id, so a developer outside a workspace could run cron, write files,
install packages or widen agent permissions on its servers, and the
list/overview/docker picker showed every server. Every <server_id>
route now resolves through the workspace check, lists filter in SQL,
and PUT /servers/<id> validates allowed_ips like PUT /allowed-ips.
A sweep test walks the URL map so a new unguarded route fails CI.
2026-10-26 00:35:55 -04:00
Juan Denis b1260f7ea5 Catch plan citations at commit time
The guard only ran inside a backend pytest shard, so a citation in
SCSS or JSX surfaced minutes after the push. The pre-commit hook now
runs the same test file in --staged mode on every staged app file,
reusing its patterns and PENDING allowlist so the two cannot drift.
2026-10-25 23:27:21 -04:00
Juan Denis e30fe7c081 fix: refresh preview API and controller boundary inventories 2026-10-24 14:50:57 -04:00
Juan Denis caab657806 Merge remote-tracking branch 'origin/dev' into dev 2026-10-24 14:44:37 -04:00
Juan Denis e955134e41 feat: run approved assistant deployments through persistent recipe operations 2026-10-24 06:30:26 -04:00
Juan Denis a3d64e5a52 fix: preserve container port semantics for previews of slot deployments 2026-10-24 06:24:18 -04:00
Juan Denis c0dbb921e1 feat: queue preview automation and preserve cleanup ownership through app deletion 2026-10-24 06:21:26 -04:00
Juan Denis 5a13a0dfb1 feat: provision isolated generic previews with retryable resource cleanup 2026-10-24 06:11:46 -04:00
Juan Denis 355157856f feat: add effective environment inspector with browser regression checks 2026-10-24 06:02:51 -04:00
Juan Denis d4f6b2af55 feat: expose value-free effective environment provenance through app access boundary 2026-10-24 05:58:02 -04:00
Juan Denis 0894b8ff5b fix: require provisioned runtime before advertising previews 2026-10-24 05:56:04 -04:00
Juan Denis 9c934cb7a6 test: enforce pure nginx configuration boundaries 2026-10-24 05:36:59 -04:00
Juan Denis 2a030b31ef test: capture nginx rendering contract before extraction 2026-10-24 05:33:01 -04:00
Juan Denis ac0871c016 fix: start agent maintenance only in the guarded runtime phase 2026-10-24 05:14:36 -04:00
Juan Denis 3c5b948f2e test: enforce core boundaries and document extension rules 2026-10-24 04:48:54 -04:00