Threat model
The panel runs as root, because it writes units to/etc/systemd/system and calls systemctl. Anyone who logs in as the admin can run arbitrary commands on the host through a project’s ExecStart or build command. Treat the admin password like the root password.
The guards below limit what a compromised browser session, a forged cross-site request, or a malformed input can do. They do not make the admin account less powerful.
Passwords
Passwords are hashed with Node’s built-incrypto.scrypt. No external auth library is used.
Passwords must be at least 10 characters. Usernames must be 3 to 32 letters, digits,
_, or -.
Sessions
- A login creates a 32-byte random token. Only its SHA-256 hash is stored in the
sessionstable. - The token is sent as the cookie
aeros_sessionwithHttpOnly,SameSite=Lax,Path=/, andMax-Ageof 7 days.Secureis added when the request arrived over HTTPS. - Expired sessions are deleted when a new session is created. There is no cleanup timer.
- Logout deletes the session row.
- Changing the password deletes every session for that user and issues a new one.
seed.jsalso deletes all sessions of the user it updates.
Login rate limit
POST /api/auth/login allows 10 attempts per IP address per 15-minute window. Every attempt counts as a failure until the password checks out, and it is counted before the database lookup so a concurrent burst cannot slip past the check. A successful login clears the counter. Over the limit, the panel answers 429 with the seconds left in the window.
The counters live in memory and reset when the panel restarts. Only the login endpoint is rate limited.
The client IP comes from
req.ip. X-Forwarded-For is trusted only from loopback, so clients cannot spoof their IP to dodge the limit. Behind a proxy on another machine, every request appears to come from that proxy’s IP.Initial setup
POST /api/auth/setup creates the first admin. It works only while the users table is empty, and the count is checked again inside a database transaction. Once a user exists, the endpoint returns 409.
Cross-site request protection
requireSameOriginForMutations runs before every /api route, including unauthenticated ones. For POST, PUT, DELETE, and PATCH requests:
- If
Sec-Fetch-Siteiscross-siteand theOriginis not listed inCORS_ORIGIN, the request is rejected with403 Cross-site request blocked. - If an
Originheader is present, its host must equal the request’sHostor the firstX-Forwarded-Host, or the origin must be listed inCORS_ORIGIN. Otherwise:403 Cross-origin request blocked. - Requests with no
Originheader (such ascurlor GitHub webhooks) pass this check and still need a valid session or signature.
SameSite=Lax, which already keeps the session cookie off cross-site POST requests.
CORS_ORIGIN
Unset by default. Set it in backend/.env only when the frontend is served from a different origin than the API:
backend/.env
WebSocket
The log stream at/ws?service=<name> checks, in order:
Only then does it spawn
journalctl -u <service> -f -n 100, with arguments passed as an array. The process is killed when the socket closes.
Input guards
Every value that reachessystemctl, git, or the filesystem passes through a validator first. Commands are started with execFile or spawn and an argument array, never a shell string. Git calls put -- before user-supplied values.
assertManageableServiceName
assertManageableServiceName
Runs before every
start, stop, restart, enable, disable, unit write, unit delete, metrics read, Caddy snippet, and alert drop-in. It requires ^[a-zA-Z0-9][a-zA-Z0-9._-]{0,63}$ and rejects reserved units: aeros-panel, ssh, sshd, systemd, tailscaled, cloudflared, docker, ufw, cron, dbus, and anything starting with systemd-. A trailing .service and letter case do not get around the list.validateWorkDir
validateWorkDir
Requires an absolute path without newlines or null bytes, normalizes it with
path.posix.resolve, and rejects / and anything under /etc, /bin, /sbin, /usr, /lib, /lib64, /boot, /dev, /proc, /sys, /run, or /var/lib. Used for project working directories, .env writes, deploys, and backup paths.validateRepositoryUrl
validateRepositoryUrl
Accepts
https://, http://, ssh://, and git@host:path. Rejects values that start with - (option injection), contain whitespace or null bytes, use file:// or ext::, have a hostname starting with -, or have an SSH path with ... It runs at creation and again before every clone.validateGitBranch and validateGitCommit
validateGitBranch and validateGitCommit
Branches must match
^[a-zA-Z0-9][a-zA-Z0-9._/-]{0,119}$ and cannot contain .. or @{, or end with / or .lock. Rollback targets must be full 40 or 64 character hex SHAs.Unit field validation
Unit field validation
Names and
ExecStart are flattened to a single line so they cannot inject extra unit directives. User=, MemoryMax=, and CPUQuota= each have a strict pattern. Caddy domains must be a valid FQDN and ports 1 to 65535.A project’s build command is the one place that runs through a shell, because it is meant to hold commands like
npm ci && npm run build. Only the authenticated admin can set it, and the terminal prints configured build command instead of its text.Secrets
The installer sets
aeros.db and backend/.env to 0600. None of these values are written to logs.
HTTP headers and limits
Every response carries:Reverse proxies
trust proxy is set to loopback. X-Forwarded-For and X-Forwarded-Proto are honored only when the direct peer is 127.0.0.1 or ::1, which covers Caddy and cloudflared on the same host. A remote client sending these headers to port 3000 cannot spoof its IP or mark a plain HTTP request as secure.
The same-origin check also accepts the first X-Forwarded-Host as a valid host, from any peer. A browser cannot attach that header to a cross-site request without a CORS preflight, which the panel does not grant unless the origin is in CORS_ORIGIN.