SECURITY.md documented three weaknesses two hours ago. Documented is better than hidden; fixed is better than documented. Sessions were a signed cookie the server trusted for a year, and /api/logout only cleared it in the browser you clicked it in — a copy left on a shared machine stayed good until it expired, and the only way to end it was deleting ./data/secret and signing out the entire instance. The cookie payload now carries the user's session version, and POST /api/logout/all bumps it, which kills every cookie that account ever had. Settings grows a "Sign out everywhere" row for it. Cookies already in the wild have no version field. They read as version 0 and match a user who has never bumped, so nobody is signed out by this deploy and db.json needs no migration — sv appears lazily on the first bump. Verified against a server running the new code with a db.json shaped like the live one. Session default drops from 365 days to 90, overridable with SESSION_DAYS. The expiry is baked into each cookie when issued, so lowering it never cuts an existing session short. Invite codes go from 32 to 64 bits. The app has no rate limiting by design and /api/register/options answers whether a code is valid, so the code itself has to be the part not worth guessing. Existing codes still work — validation is an exact string compare. Unused old ones are worth revoking and reissuing. What did not change: no rate limiting, still the reverse proxy's job, still the first caveat in SECURITY.md. requireUserVerification stays false — raising it could refuse passkeys that already exist, which is a lockout, not a fix.
52 lines
2.7 KiB
Bash
52 lines
2.7 KiB
Bash
# Copy this file to ".env" and adjust for your setup, then: docker compose up -d
|
|
#
|
|
# ── Local testing (default) ────────────────────────────────────────────────
|
|
# Works out of the box on the machine running Docker. Open http://localhost:8080
|
|
RP_ID=localhost
|
|
ORIGIN=http://localhost:8080
|
|
WEB_PORT=8080
|
|
RP_NAME=openGym
|
|
|
|
# ── Real deployment behind your own HTTPS domain ───────────────────────────
|
|
# Passkeys are bound to the exact hostname, and browsers only allow them over
|
|
# HTTPS (localhost is the one exception). Put openGym behind a reverse proxy /
|
|
# tunnel that terminates TLS for your domain, then set:
|
|
#
|
|
# RP_ID=gym.example.com
|
|
# ORIGIN=https://gym.example.com
|
|
# WEB_PORT=8080
|
|
# RP_NAME=openGym
|
|
#
|
|
# (Point your proxy at the web container's WEB_PORT. See docs/SELF_HOSTING.md.)
|
|
|
|
# ── Admin dashboard & invite-only signup (optional) ────────────────────────
|
|
# Both off by default — a fresh instance has open signup and no admin.
|
|
#
|
|
# Make yourself an admin: register your own passkey profile first, find your
|
|
# user id in ./data/db.json ("users"[].id), then list it here (comma-separated
|
|
# for several admins). Admins get an "Admin dashboard" link in Settings to see
|
|
# users, disable accounts, generate invite codes and view workout history.
|
|
#
|
|
# ADMIN_UIDS=youruserid,anotheradmin
|
|
#
|
|
# Require an invite code to create new profiles (existing accounts keep working;
|
|
# generate the codes from the admin dashboard):
|
|
#
|
|
# INVITE_ONLY=1
|
|
|
|
# ── Session length (optional) ──────────────────────────────────────────────
|
|
# How long a sign-in lasts, in days. Default 90 — long enough that people who
|
|
# train regularly never see a login screen, short enough that a stolen cookie
|
|
# doesn't stay good forever. Lower it for an instance on the open internet,
|
|
# raise it for a private one. Only affects new sign-ins; cookies already handed
|
|
# out keep the lifetime they were issued with. Users can end every session on
|
|
# every device themselves with "Sign out everywhere" in Settings.
|
|
#
|
|
# SESSION_DAYS=90
|
|
|
|
# ── Notifications (optional) ───────────────────────────────────────────────
|
|
# Push works out of the box — nothing to set. VAPID keys are generated on first
|
|
# run and saved to ./data/vapid.json. Each user's browser reports its own
|
|
# timezone automatically, so the workout-day reminder fires at their local
|
|
# time regardless of where the server runs or where they're travelling.
|