Endurain logo

Endurain

Self-hosted fitness tracking service

Alternative to: strava

Endurain screenshot

About Versions (102)

v0.21.0-beta2

2026-11-18

v0.21.0-beta2 - 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 data folder 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_SCHEMES is set, when BEHIND_PROXY=true has no TRUSTED_PROXIES, when ENDURAIN_HOST is not plain scheme://host[:port], or when SECRET_KEY, FERNET_KEY or DB_PASSWORD is still the example value from .env.example or the docs.

Changes from v0.21.0-beta1

  • Audit checkpoints are sealed again. On beta1 the audit maintenance step checkpoints failed on every run with DetachedInstanceError: Instance <AuditCheckpoint ...> is not bound to a Session. jasil read the stored checkpoint’s hash after its database session had closed, so no checkpoint was ever chained and signed, or copied to AUDIT_EXTERNAL_SINK_URI. The audit rows themselves were still written; only the sealing was affected. Fixed in jasil 0.22.1. Windows that passed their grace period while beta1 was running are sealed on the first maintenance run after the update. Thanks to the beta tester who reported it.
  • Map thumbnails resolve the tile host once per render. The tile server is now resolved and checked once for each thumbnail instead of once for every tile, and every tile request of that render uses the validated address. A render makes one DNS lookup instead of one per tile, and a tile URL that names another host, or a name that changes its answer mid-render, is refused. A refused tile URL now logs the host (never the query string, which can carry the tile API key).
  • Dependency update. jasil 0.22.0 to 0.22.1.

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-Match on every editable resource, background jobs read by id at /jobs, and incremental sync at GET /sync.

Upgrading

Integrators and operators: see Changes from v0.20 to v0.21 for what changed and what to do.

  1. 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.
  2. Back up the database and the data folder.
  3. Update the image and fix the environment variables listed below (ALLOWED_REDIRECT_SCHEMES, TRUSTED_PROXIES, ENDURAIN_HOST, and any example secret).
  4. 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.
  5. Run VACUUM (ANALYZE) on the database afterwards.
  6. 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. Replaces ALLOWED_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 (also AUDIT_SIGNING_KEY_FILE).
  • AUDIT_EXTERNAL_SINK_URI - optional write-once copy of every audit checkpoint: file:///dir or s3://bucket/prefix.
  • HSTS_PRELOAD (default: false) - adds preload to the HSTS header.
  • LOG_ACCESS (default: false) - log every API request (Uvicorn access log).
  • LOG_WEBSOCKET_FRAMES (default: false) - log websocket keepalive frames at LOG_LEVEL=debug.

Changed

  • BEHIND_PROXY - true now requires TRUSTED_PROXIES; the container refuses to start without a usable entry. TRUSTED_PROXIES no longer trusts every proxy in development.
  • ENDURAIN_HOST - must be only scheme://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 token iss and aud change 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.example and the docs are refused at startup, including through the *_FILE variants.

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 in ALLOWED_REDIRECT_URIS instead (a scheme endurain becomes endurain://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.html and env.js world-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 one 404. Tokens issued before v0.21.0 are refused.
  • Scopes renamed. profile* became account, account:export and account: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 new account:integrations scope. The token’s scope is enforced, and an API key gets only the scopes its owner’s role grants.
  • Tokens and cookies. JWTs carry typ and kid headers; refresh tokens are separate tokens naming the client. Auth cookies use the __Host- prefix in production and demo. 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 the session_id to a custom-scheme address only once the user taps Continue; a claimed https address is still forwarded at once.
  • Token claim. The claim that said web or mobile is now client_type; tokens carry no client_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 read client_type.
  • Sign-in errors. Every refusal of POST /auth/refresh, and a dead pending sign-in at /auth/mfa/verify and /auth/password-change, is 401 session-ended with WWW-Authenticate: Session: sign in again, do not retry. invalid-token now means “refresh once and replay” on resource routes only. A failed password sign-in challenges with Session, not Bearer.
  • No CSRF token. The web token responses no longer carry csrf_token, and X-CSRF-Token is gone. POST /auth/refresh and /auth/logout from a web client must carry an allowed Origin header (browsers add it) and are refused when Sec-Fetch-Site is cross-site.
  • SSO sign-in with MFA follows the same steps as a password sign-in: POST /auth/sessions/{session_id}/tokens answers 200 with next_step: "mfa" and the client finishes at POST /auth/mfa/verify. mfa_code is no longer accepted by the exchange and the mfa-required problem is gone.
  • One 429 type. too-many-requests for every 429, with a scope member (requests, sign-in, mfa, step-up, provider, follow-request); rate-limited is gone.
  • Sessions and devices. POST /profile/devices/revoke is .../delete-others and .../delete is .../delete-all; session and device reads carry is_current; last_login of an identity-provider link is last_login_at.
  • Destructive actions need step-up, as POST routes with a step_up body: POST /server-settings/logs/clear, POST /strava/unlink and POST /garmin/unlink; PUT /strava/client takes step_up too.
  • 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, and POST /public/email-change/confirm answers 204.
  • MFA reads. GET /profile/mfa/status gains factors and the MFA-required sign-in answer gains methods; both are open sets.
  • Step-up. Sensitive requests carry one step_up object (current_password and/or an MFA code). Every step-up refusal is 403 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 is 409; an unsupported file type is 415; a NUL character or out-of-range value is 422.
  • HTTP semantics. Creates return 201 with Location and ETag; message-only writes return 204; edits use PATCH (identity providers, users), singleton uploads use PUT; PUT/PATCH on a versioned resource require If-Match and a stale write is 412.
  • Routes reorganised, among others: one URL for a user (/users/{user_id}); follow requests under /profile and accepted with POST; /notifications/number replaced 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 answering next_step; POST /profile/mfa/verify and 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 202 returns a job with an id and Content-Location: /jobs/{id}; read it at GET /jobs/{job_id}, list your jobs at GET /jobs.
  • Users. GET /users with only users:read needs username (exact) or username_contains (3+ characters); the user directory shows less about other users. PATCH /users/{user_id} needs the administrator’s step_up to change the email, access type, active flag, username or email-verified flag. PATCH /profile no longer accepts username (use POST /profile/username/change), photo_path or mfa_enabled. Gear acquisition is acquired_on; the component expected_kms is expected_usage.
  • Identity providers. jwks_uri is gone (keys come from discovery), providers are typed, one provider per issuer, email linking and profile sync are opt-in, client_id is required, and the slug, client_id, provider type, issuer and endpoints cannot change while users are linked (409 identity-provider-locked), and the slugs login, link, callback, icon and backchannel-logout are reserved. A native app can link a provider: POST /profile/identity-providers/{idp_id}/link with a native redirect returns an Endurain address (GET /public/idp/link?ticket=...) for the system browser.
  • Requests to /auth/ and /public/ with a body over 64 KiB are 413. Rate-limit headers are exposed, and a 401 or 403 on a rate-limited route counts against the default limit.
  • /openapi.json answers 404 in 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 USERNAME turns off two-step verification, and python -m cli set-password USERNAME sets 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 source cli.
  • GET /sync reports 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, and to the beta tester who reported the audit checkpoint failure.