v0.21.0-beta1
2026-11-17v0.21.0-beta1 - Account security, audit trail, UUID ids and a reviewed API
⚠️ Warning
- The DB has schema changes (17 revisions, including converting every integer id to a UUID). Back up your DB and
datafolder before updating; the conversion cannot be undone, and restoring that backup is the only way back to v0.20.x. - v0.21.0 upgrades only from v0.20.x with every data migration finished. If your server has data migrations still pending, start it on v0.20.x until they finish, then update. The first revision refuses any other database and says why.
- Everyone signs in again once. Every web and mobile session ends at the upgrade. API keys keep working.
- This release contains breaking API changes (see below). Third-party clients, scripts and older mobile app versions must update.
- Minimum Endurain mobile app is 0.11.0.
- If you use 3rd parties apps like GadgetBridge, check if they support v0.21.0 before upgrading.
- Review the environment variable changes below. Endurain refuses to start while
ALLOWED_REDIRECT_SCHEMESis set, whenBEHIND_PROXY=truehas noTRUSTED_PROXIES, whenENDURAIN_HOSTis not plainscheme://host[:port], or whenSECRET_KEY,FERNET_KEYorDB_PASSWORDis still the example value from.env.exampleor the docs.
Highlights
- First-run onboarding instead of
admin/admin(#876). A new installation no longer creates a default account. Until an account exists, the server log prints a one-time setup token (valid 24 hours), and the onboarding page creates the first administrator with it and offers MFA setup. - Audit trail (#890). Every security-relevant action is recorded in an append-only audit trail: sign-ins and refusals, sign-outs, credential, MFA, API key, session and identity-provider changes, failed step-up checks, administrative actions, and settings changes. Checkpoints can be signed (
AUDIT_SIGNING_KEY) and copied outside the database (AUDIT_EXTERNAL_SINK_URI). Rows are kept for 90 days. - Security notifications. Users are told, in the app and by email when mail is configured, about new-device sign-ins, password, email, MFA and sign-in method changes, backup-code use, refresh-token reuse, and role and deletion changes.
- Step-up for sensitive actions. Changing the password, email, username, MFA or API keys, exporting your data, and administrator actions on users, identity providers and security server settings ask for your password (or MFA code) again. Accounts without a password confirm with a fresh identity-provider sign-in (#872).
- Known devices and session control. Settings > Security lists your known devices and lets you forget one device, every other device, or all of them, and sign out everywhere at once. Forgetting a device signs it out.
- Stronger sign-in protection. Lockout is keyed per client and per account, so nobody can lock a known user out just by knowing the username (#827); an account locks after 100 failed sign-ins except from its known devices; the MFA challenge is bound to its network and ends after three wrong codes.
- Password rules follow NIST SP 800-63B-4. Length matters, character mixes do not: 15 characters by default (an administrator sets 8 to 128 per account type), checked against about 75,000 common or breached passwords shipped with the server, plus an optional Have I Been Pwned check (off by default; only a 5-character hash prefix is sent).
- Administrator invitations. An administrator can invite a new user by email, who then chooses their own password; setting a password directly stays available for servers without mail. Pending sign-ups are approved or rejected from the users list.
- Required MFA. An administrator can require MFA of administrators or of everyone. An account without MFA can still sign in, but must enrol before it can do anything else.
- Server settings in the admin UI (#853). Email, sessions, reverse geocoding and data retention are now edited in Settings > Server, and administrators get a server logs viewer. The old environment variables are imported once and deprecated (see below).
- UUID ids everywhere. Every resource id (users, activities and their children, gear, health records, notifications, goals, devices, identity providers, sessions, API keys, jobs and tokens) is now a UUID, so ids no longer reveal how many records exist or let anyone guess the next one.
- Reviewed API with one set of rules for URLs, status codes, errors, paging, filters, enums and units, published as HTTP API conventions and Compatibility in the docs, plus
ETag/If-Matchon every editable resource, background jobs read by id at/jobs, and incremental sync atGET /sync.
Upgrading
Integrators and operators: see Changes from v0.20 to v0.21 for what changed and what to do.
- Make sure your v0.20.x server finished all of its data migrations, then stop every Endurain process (web and worker containers), so nothing is left in the job queue or the Redis streams.
- Back up the database and the
datafolder. - Update the image and fix the environment variables listed below (
ALLOWED_REDIRECT_SCHEMES,TRUSTED_PROXIES,ENDURAIN_HOST, and any example secret). - Start Endurain. The schema upgrade converts every id to a UUID in one transaction, so plan for downtime on a large database. At the first start, stored files and import folders are renamed to the new UUIDs.
- Run
VACUUM (ANALYZE)on the database afterwards. - Remove the deprecated environment variables once the first start has imported them into Settings > Server.
What changes for users after the upgrade:
- Everyone signs in again; API keys keep working, and keys that had no expiry now expire 365 days after the upgrade.
- Account lockouts are lifted, and every browser sends one “new device” notice at its first sign-in (the device cookie was renamed).
- Profile archives exported before v0.21.0 cannot be imported (
older_version). Export again after the upgrade if you need an archive. - An account still holding a bcrypt password hash (not signed in since before v0.16.0) cannot sign in with its password; the owner resets it by email.
- New users’ activities are private by default; existing users keep their setting.
Environment Variables & Configuration
Variables marked deprecated moved to the admin settings. On every start, Endurain imports each one that is set into the database (when it differs), logs one warning naming them, and shows the setting as read-only while the variable is set. From v0.22.0 Endurain refuses to start while any of them is set.
New Variables
ALLOWED_REDIRECT_URIS(default:com.endurain.endurain:/auth/sso/callback) - exact redirect addresses mobile apps may use after SSO. ReplacesALLOWED_REDIRECT_SCHEMES. An app listed here receives tokens with every scope the user holds, so list only apps you trust.DB_POOL_SIZE(20),DB_MAX_OVERFLOW(40),DB_POOL_TIMEOUT_SECONDS(30),DB_LOCK_TIMEOUT_SECONDS(30),DB_STATEMENT_TIMEOUT_SECONDS(0, off) - database pool and timeout settings.AUDIT_SIGNING_KEY- optional Ed25519 key that signs audit checkpoints (alsoAUDIT_SIGNING_KEY_FILE).AUDIT_EXTERNAL_SINK_URI- optional write-once copy of every audit checkpoint:file:///dirors3://bucket/prefix.HSTS_PRELOAD(default:false) - addspreloadto the HSTS header.LOG_ACCESS(default:false) - log every API request (Uvicorn access log).LOG_WEBSOCKET_FRAMES(default:false) - log websocket keepalive frames atLOG_LEVEL=debug.
Changed
BEHIND_PROXY-truenow requiresTRUSTED_PROXIES; the container refuses to start without a usable entry.TRUSTED_PROXIESno longer trusts every proxy in development.ENDURAIN_HOST- must be onlyscheme://host[:port](no path, trailing slash, query, fragment or user info), or Endurain refuses to start. It is read in canonical form (lower-case scheme and host, default port dropped); if yours was written differently, the tokenissandaudchange and everyone signs in again.SECRET_KEY- at least 32 characters with at least 10 distinct ones. A separate key is derived for each use. To rotate it, list several keys separated by commas (the first signs, the others still verify).FERNET_KEY- rotate it by listing several keys separated by commas.SECRET_KEY,FERNET_KEY,DB_PASSWORD- the example values published in.env.exampleand the docs are refused at startup, including through the*_FILEvariants.
Deprecated (imported into the admin settings, removed in v0.22.0)
SMTP_HOST,SMTP_PORT,SMTP_USERNAME,SMTP_PASSWORD,SMTP_FROM,SMTP_SECURE,SMTP_SECURE_TYPE- now Settings > Server > Email.ACCESS_TOKEN_EXPIRE_MINUTES,REFRESH_TOKEN_EXPIRE_DAYS,SESSION_IDLE_TIMEOUT_ENABLED,SESSION_IDLE_TIMEOUT_HOURS,SESSION_ABSOLUTE_TIMEOUT_HOURS- now Settings > Server > Sessions.REVERSE_GEO_PROVIDER,PHOTON_API_HOST,PHOTON_API_USE_HTTPS,NOMINATIM_API_HOST,NOMINATIM_API_USE_HTTPS,GEOCODES_MAPS_API,REVERSE_GEO_RATE_LIMIT- now Settings > Server > Reverse geocoding.
Removed
ALLOWED_REDIRECT_SCHEMES- Endurain refuses to start while it is set. List the exact addresses inALLOWED_REDIRECT_URISinstead (a schemeendurainbecomesendurain://auth/sso/callback).ALGORITHM- tokens are always signed with HS256. A leftover value is ignored with a warning.
Other
- The absolute session timeout is always enforced, and new installations get a 72-hour idle timeout (existing installations keep their setting).
- The access-token lifetime must be shorter than the idle timeout.
- Read notifications are purged after 90 days (Settings > Server > Data retention).
- The container no longer makes
index.htmlandenv.jsworld-writable (#828).
Breaking API changes
Integrators and operators: see Changes from v0.20 to v0.21 for what changed and what to do.
If you only use the Endurain web UI you do not need to do anything. API consumers, the full list is in the Compatibility page and the OpenAPI reference; the main changes:
- UUID ids. Every id in paths, query parameters and bodies is a UUID string. A malformed id answers
422, an unknown one404. Tokens issued before v0.21.0 are refused. - Scopes renamed.
profile*becameaccount,account:exportandaccount:security; scopes with an underscore became kebab-case (health-targets:read,identity-providers:write,server-settings:logs-clear,users:read-all, …). Garmin and Strava linking moved to the newaccount:integrationsscope. The token’s scope is enforced, and an API key gets only the scopes its owner’s role grants. - Tokens and cookies. JWTs carry
typandkidheaders; refresh tokens are separate tokens naming the client. Auth cookies use the__Host-prefix inproductionanddemo. A mobile client sends its refresh token in the request body. Mobile SSO requires PKCE and an exact redirect address; SSO sign-in is bound to the browser that started it. After SSO, the browser passes thesession_idto a custom-scheme address only once the user taps Continue; a claimedhttpsaddress is still forwarded at once. - Token claim. The claim that said
webormobileis nowclient_type; tokens carry noclient_id(that name is reserved for the registered application of a future OAuth client). Clients that read the token instead of treating it as opaque must readclient_type. - Sign-in errors. Every refusal of
POST /auth/refresh, and a dead pending sign-in at/auth/mfa/verifyand/auth/password-change, is401 session-endedwithWWW-Authenticate: Session: sign in again, do not retry.invalid-tokennow means “refresh once and replay” on resource routes only. A failed password sign-in challenges withSession, notBearer. - No CSRF token. The web token responses no longer carry
csrf_token, andX-CSRF-Tokenis gone.POST /auth/refreshand/auth/logoutfrom a web client must carry an allowedOriginheader (browsers add it) and are refused whenSec-Fetch-Siteiscross-site. - SSO sign-in with MFA follows the same steps as a password sign-in:
POST /auth/sessions/{session_id}/tokensanswers200withnext_step: "mfa"and the client finishes atPOST /auth/mfa/verify.mfa_codeis no longer accepted by the exchange and themfa-requiredproblem is gone. - One
429type.too-many-requestsfor every429, with ascopemember (requests,sign-in,mfa,step-up,provider,follow-request);rate-limitedis gone. - Sessions and devices.
POST /profile/devices/revokeis.../delete-othersand.../deleteis.../delete-all; session and device reads carryis_current;last_loginof an identity-provider link islast_login_at. - Destructive actions need step-up, as
POSTroutes with astep_upbody:POST /server-settings/logs/clear,POST /strava/unlinkandPOST /garmin/unlink;PUT /strava/clienttakesstep_uptoo. - Email links and confirmation. Links in emails carry the token in the URL fragment (
#token=;?token=still works for one release), changing an email address is confirmed with a button press, andPOST /public/email-change/confirmanswers204. - MFA reads.
GET /profile/mfa/statusgainsfactorsand the MFA-required sign-in answer gainsmethods; both are open sets. - Step-up. Sensitive requests carry one
step_upobject (current_passwordand/or an MFA code). Every step-up refusal is403 step-up-failed. - Errors. Typed problem documents for more cases:
password-too-short,password-breached,mfa-code-invalid,api-key-limit,mfa-enrolment-required,components-outside-gear-type, the only-administrator refusal and others. A request that does not fit the account’s state is409; an unsupported file type is415; a NUL character or out-of-range value is422. - HTTP semantics. Creates return
201withLocationandETag; message-only writes return204; edits usePATCH(identity providers, users), singleton uploads usePUT;PUT/PATCHon a versioned resource requireIf-Matchand a stale write is412. - Routes reorganised, among others: one URL for a user (
/users/{user_id}); follow requests under/profileand accepted withPOST;/notifications/numberreplaced by/notifications/unread-count; notifications paged by cursor, with delete and bulk mark-read routes; sessions revoked through one route; the emailed-link confirm routes split and answeringnext_step;POST /profile/mfa/verifyand the user email lookup route removed; the server log paged by cursor. - One filter, page and date-window vocabulary across list endpoints; enums are strings on the wire; units are stated in field descriptions, gear distance is in meters and prices are decimal strings; health requests need a UTC offset on every instant; the identity-provider and identity-link lists are paged.
- Lighter lists. The sleep and activity lists leave heavy fields out; read the full record by id. Activity lists embed each activity’s media.
- Background jobs. Every
202returns a job with an id andContent-Location: /jobs/{id}; read it atGET /jobs/{job_id}, list your jobs atGET /jobs. - Users.
GET /userswith onlyusers:readneedsusername(exact) orusername_contains(3+ characters); the user directory shows less about other users.PATCH /users/{user_id}needs the administrator’sstep_upto change the email, access type, active flag, username or email-verified flag.PATCH /profileno longer acceptsusername(usePOST /profile/username/change),photo_pathormfa_enabled. Gear acquisition isacquired_on; the componentexpected_kmsisexpected_usage. - Identity providers.
jwks_uriis gone (keys come from discovery), providers are typed, one provider per issuer, email linking and profile sync are opt-in,client_idis required, and the slug,client_id, provider type, issuer and endpoints cannot change while users are linked (409 identity-provider-locked), and the slugslogin,link,callback,iconandbackchannel-logoutare reserved. A native app can link a provider:POST /profile/identity-providers/{idp_id}/linkwith a nativeredirectreturns an Endurain address (GET /public/idp/link?ticket=...) for the system browser. - Requests to
/auth/and/public/with a body over 64 KiB are413. Rate-limit headers are exposed, and a401or403on a rate-limited route counts against the default limit. /openapi.jsonanswers404in production; use the published API reference.
Security
This release includes security fixes, including high-severity issues. Details will be published with v0.20.0.
Thank you to everyone who reported these responsibly.
Backend
- Every backend module converted to the module structure with enforced boundaries: gears (#837), notifications (#841), server settings (#849), Garmin (#856), health (#861), users (#864), Strava (#866) and auth (#871).
- Realtime hints are delivered across processes (#848), and every open tab stays registered (#838).
- Garmin Connect linking uses a polled status instead of a websocket prompt (#845), accepts pasted MFA codes and waits longer for them, and respects Garmin rate limits.
- Account deletion runs as a durable job; health records are part of the profile export and import, and a profile import from a different account is refused.
- Recovery commands for a sole administrator, run on the server:
python -m cli reset-mfa USERNAMEturns off two-step verification, andpython -m cli set-password USERNAMEsets a generated password and prints it once (docker exec -it CONTAINER python -m cli ...). Both end the account’s sessions and record the action in the audit trail with the sourcecli. GET /syncreports what changed in a user’s records since a cursor, for clients that keep a local copy.- Fewer API round trips and smaller payloads across client reads (#867).
- Fixed TCX files without GPS coordinates failing to import (#692, #795).
- Fixed TCX lap pace and speed being 3.6 times off (#896).
- Running cadence is normalised to steps per minute at import (#787).
- Fixed FIT weightlifting exercises with subtype 0 not being recognised (#891).
- Fixed rest splits counting towards a pool swim’s active time, placeholder samples in the lap average speed, and GPX auto-laps for imperial users (now every mile).
- Fixed a plus sign in the activity search not matching literally (#885).
- Fixed the BMI not being recalculated when a weight entry is edited (#888) and the stored height changing when saved in imperial units (#889).
- Health records are validated on the server: date bounds, sleep stages within the total, fasts with server-derived durations, water capped at 20,000 ml a day, BMIs kept in range.
- Ingestion and media cleanup are retried after an outage instead of dropping the work; failed bulk-import files are swept.
- Background job logs carry the originating request id.
- Strict mypy and ty checks across the backend, enforced in CI.
- bcrypt support removed (Argon2 has been the default since v0.16.0).
- Dependency updates, including jasil 0.20, safeuploads 4.0 and uv 0.13.
Frontend
- First-run onboarding page.
- Security and profile settings split into tabs, with known devices, sign out everywhere, API key revocation and the blocked users list.
- Administrators: invite users, approve or reject pending sign-ups, reset a user’s MFA, require a new password, revoke a user’s API keys, server logs viewer, and email, sessions, geocoding and retention settings.
- Per-user weight units override (#863).
- Identity providers can use uploaded icons, and custom icons show on the login page (#875).
- Notifications can be dismissed.
- Background jobs are followed by their id.
- Field errors from the API are shown on the forms, and a stale edit closes and reloads instead of retrying.
- Many health form fixes: visible validation, confirmation before breaking or cancelling a fast, single-entry charts, skin temperature in the user’s units.
- Numbers, units, durations and plurals are formatted in the app’s language; every missing string translated in all locales.
- New footer.
- Sign-in hardening: the login redirect no longer carries one-time credentials or the URL fragment, refresh and restore answers are validated before tokens are stored, SSO sign-in with MFA uses the same steps as the password sign-in, and one-time email tokens are no longer kept in
sessionStorage.
Docs
- New HTTP API conventions and Compatibility pages.
- New Audit trail guide.
- Account security, sign-in, single sign-on, PKCE, realtime and background operations documented against the code.
- Advanced setup updated for the new, changed, deprecated and removed environment variables.
Contributors
- @alecc08 in #863
- @DanyPM in #787, #795 and #894
Thanks also to @ycanerol (#827, #828), @CristianKerr (#875), @jackfemorgan (#891) and @tof92130 (#896) for the reports.