Skip to content

Security: aderaaij/loopback-training-server

SECURITY.md

Security

Loopback Server holds health and training data, so this page says how to report a problem, what the server is built to protect and from whom, what it connects to, and where its protection stops. It describes the server as released; the changelog says when something here changed.

Reporting a vulnerability

Please do not open a public issue for a security problem. Use Report a vulnerability under this repository's Security tab, which sends a private report to the maintainer.

This is a one-person project with no bounty. Expect an answer within a week, and a fix or a stated plan after that depending on how serious it is. Reports about the iOS app are welcome here too.

Supported versions

Only the latest release gets security fixes. An upgrade within 0.1.x is always safe to take (see Releases & upgrading).

What it protects, and from whom

Who is trusted. Whoever runs the host and the admin account can read everything: the database is theirs, and an admin can reset any account's password. Loopback is built for a household or a small group that trusts its admin, not for strangers sharing one server.

One athlete from another. Every row belongs to an account, and every request is answered for the account its token belongs to. An athlete cannot read or change another athlete's data. The admin screens show when a member last synced and which devices they have, not their workouts.

People who can reach the server and have no account. Without a token the server answers only: a health check, the sign-in form, first-run setup (which closes for good once an admin account exists), trading in a QR code or an invitation someone was given, the steps by which an AI assistant signs in, and the dashboard's own files. Sign-in is limited to five attempts a minute per client address. There is no open registration: an account needs the admin, who creates it or gives out an invitation. The admin's System screen shows sign-ins, failures and refused tokens.

A lost or leaked credential. Passwords are stored as argon2 hashes. Tokens are random, shown once, and stored only as a SHA-256 hash. Each device and each assistant has its own token, listed under Devices & tokens and revocable one at a time. A QR code for the phone app works once and for five minutes.

An AI assistant you connect. An assistant gets a coach token, whether it signed in or you pasted one. A coach token is refused everywhere except the requests the coach's tools make: it cannot create or revoke tokens, change what you share, approve another assistant or upload data as if it were your phone. Within that, it can do what the coach does, which includes rewriting a plan and deleting a workout. What it can read follows what you share in the app (Training always; Recovery, Body, Daily activity and Nutrition each a switch).

What your data leaves the server for

The server itself makes no outgoing connections. It talks to its own database, and the coach inside it talks to the server's own API. There is no telemetry, no update check and no licence check.

Data leaves in three ways, each of your choosing:

  • To your AI assistant. Whatever the coach reads to answer you goes to the company that runs the assistant, under your account with them. That is the point of connecting one, and it is the largest flow of data out of the server.
  • To the map tile provider, from your browser. A workout's route is drawn on map tiles that your browser fetches, by default from CARTO. CARTO sees your browser's address and which tiles it asked for, which shows roughly where the route is. Set MAP_TILE_URL to use another provider, or one you host.
  • To whatever stands in front of the server. With the built-in HTTPS or Tailscale setups, traffic is decrypted only on your machine. A proxy that ends the HTTPS connection for you, such as a Cloudflare Tunnel, can read what passes through it.

Where the protection stops

  • Plain HTTP is allowed. The server listens on HTTP and leaves encryption to what you put in front of it (Exposing the server). On a network you do not fully trust, use one of the HTTPS setups.
  • No second factor. An account is a username and a password. On a server that is reachable from the internet, every account needs a strong one.
  • The dashboard keeps its token in the browser's local storage. A script injected into the dashboard's page could read it. The dashboard loads no third-party scripts.
  • Nothing is encrypted at rest by the server. The database and the nightly backups (plain pg_dump files, gzipped) are as safe as the disk they are on. Keep backups somewhere only you can read.
  • Behind a proxy the rate limit needs one setting. Unless FORWARDED_ALLOW_IPS names the proxy, every client shares one sign-in limit and the audit trail shows the proxy's address. The built-in HTTPS and Tailscale setups set it for you.
  • The container runs as root by default, on the ordinary Docker network, so it can reach what its host can reach. deploy/demo/docker-compose.public.yml shows a stricter setup (an ordinary user, a read-only filesystem, a network with no way out) that a server with one fixed way in can copy.
  • An account marked read-only is refused every change, and can still read everything it holds.

How this was checked

The claims above about tokens and accounts are covered by the test suite: one test walks every route in the server and expects a coach token to be refused outside its list, another does the same for read-only accounts, and others check that one account cannot reach another's data. Nobody outside the project has reviewed the code for security. If you do, the maintainer would like to hear what you find.

There aren't any published security advisories