CI failed on a different set of tests each run because bun runs every test
file in one process and the file order differs between machines:
- the secretsmanager route test replaced the whole ../aws module, so files
loaded after it lost awsClients, lambda and defaultAccountId (API Gateway,
SES)
- the Lightsail tests restored FLOCI_ENDPOINT by assigning undefined, which
stores the string "undefined" (runtime diagnostics)
- the auth tests used full-strength argon2 for ~30 sign-ins and timed out on
slower runners; the OIDC cleanup test cached a discovery document without
userinfo_endpoint for the shared issuer
Checked with 20 runs under bun test --randomize.
- safeReturnTo resolves the target against a placeholder origin and rejects
backslashes and control characters, so `/\evil.example` and similar
payloads can no longer redirect off-site after sign-in.
- Add a real unauthenticated /api/health and answer unknown /api/* paths
with a JSON 404 instead of the SPA shell.
- Limit request bodies: 16 KB for /api/auth/* (read before a session
exists), 128 MB for resource create/update and uploads, 10 MB elsewhere.
- Run the production image as an unprivileged user and add a Docker
HEALTHCHECK against /api/health.
- Key login throttling on the real peer address; read X-Forwarded-For only
from FLOCI_UI_TRUSTED_PROXIES (right-most untrusted hop). Add a per-IP
limit across usernames so one attacker can no longer lock out the admin.
- Require an OIDC allow-list (FLOCI_UI_OIDC_ALLOWED_GROUPS / _EMAILS, or
FLOCI_UI_OIDC_ALLOW_ALL_USERS=true); fall back to UserInfo for groups
when the ID token omits them. Redirect IdP and token errors to /login
instead of returning 500s; cache discovery and JWKS.
- Sweep expired sessions, attempts and pending OIDC requests every 60s,
cap each map, and throttle OIDC sign-in starts per IP.
- Fix the .ts import extension that broke the API type-check.
- Add auth.test.ts and document the new settings.