8 Commits
Author SHA1 Message Date
Boris Kurktchiev 67a8e68e42 api: #160 findings 3/7/8/12 — a request target that does not parse answers 400 instead of an unhandled rejection, the reminder tick skips a state it cannot read and PUT /api/data refuses non-array workouts/routines, the push address rule judges every IPv6 spelling and re-checks literals before each send, sign out everywhere voids unredeemed pairing codes 2026-09-11 10:21:12 -04:00
JoseviandClaude Opus 5 f0c554e86d docs: SECURITY.md al dia con las protecciones nuevas
La afirmacion "CSRF protection is SameSite=Lax and nothing else" y la de que
nginx no pone ninguna cabecera ya no eran ciertas, y el parrafo de las IPs del
activity log describia un stack que se podia falsificar. Se anaden las garantias
del bloque push y se recalculan las referencias a lineas de api/server.js, que
habian quedado desplazadas.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-25 10:01:07 +02:00
Duarte Santos 2b3ffad314 Discord ueberall dort verlinken, wo Leute nach Hilfe suchen
Der Server war nur auf der Website verlinkt - im Repo selbst nirgends, obwohl
dort inzwischen das meiste passiert. Jetzt: Badge und eigener Punkt im
Community-Abschnitt der README, erste Zeile der Tabelle in CONTRIBUTING, und ein
Hinweis in der Frage-Vorlage.

Mit der Trennung, die der Sache entspricht: Discord fuer die schnelle Frage,
Issue fuer alles, was der Naechste ueber die Suche finden koennen soll - und
Exploits gehoeren in keines von beiden, sondern in ein vertrauliches Issue.

Statischer Badge, kein Live-Zaehler: das Server-Widget ist aus, shields.io wuerde
sonst "widget disabled" anzeigen.
2026-08-23 20:47:21 +02:00
Duarte Santos 925190109f Umzug nach GitLab: CI/CD fuer Tests, Images, APK, Pages und Releases
gitea.com hat keinen Actions-Runner, also gab es dort seit dem Umzug weder
Container-Images noch einen gebauten APK noch gruene Tests auf Merge Requests.
GitLab kann alles vier, also zieht das Projekt dorthin um.

.gitlab-ci.yml deckt die komplette Kette ab:
- test: Frontend-Suite (346 Tests), Locale-Checks, Fatigue-Probe, MCP-Suite
- build: api- und web-Image nach registry.gitlab.com/duartesantos8/opengym/*,
  auf v*-Tags amd64+arm64 mit latest/X.Y/X.Y.Z, sonst amd64 als edge
- package: signierter APK (zipalign + apksigner) plus Upload in die Generic
  Package Registry; der Key liegt in geschuetzten CI-Variablen und existiert
  damit nur auf main und v*-Tags
- deploy: der Browser-Demo-Build auf GitLab Pages
- release: GitLab-Release mit dem passenden CHANGELOG-Abschnitt und Links auf
  APK und Images

GitHub konnte "Tag gepusht" von "Release veroeffentlicht" unterscheiden und hat
Images nur aus letzterem gebaut (Issue #87). GitLab kann das nicht - dort ist die
Tag-Pipeline das, was das Release anlegt. Die Regel steht deshalb als Kommentar
im CI-File, und v*-Tags sind geschuetzt.

Ausserdem: Issue-/MR-Vorlagen unter .gitlab/, und saemtliche Repo-Links in
README, Docs, App, Dockerfile-Labels, docker-compose und Website zeigen auf
GitLab. site.js liest Sterne und Releases jetzt aus der GitLab-API (andere
Feldnamen, deshalb neue sessionStorage-Keys). SECURITY.md hat wieder einen
privaten Meldeweg: ein vertrauliches Issue.

.github/ und .gitea/ bleiben liegen - Spiegel bzw. fuer den Tag, an dem das
GitHub-Konto zurueckkommt.
2026-08-23 20:10:07 +02:00
Duarte Santos 8b99a644ed Release v1.2.9: Aktivitaetslog im Admin-Dashboard, Demo wieder online
Wer sich anmeldet, wer es vergeblich versucht und was ein Admin aendert, stand
bisher nirgends — der Server hat schlicht nichts protokolliert.

Aktivitaetslog:
- ./data/audit.log, eine JSON-Zeile pro Event, angehaengt statt neu geschrieben.
  Bewusst NICHT in db.json: die Datei wird bei jedem Save komplett neu geschrieben,
  und der Login-Handshake ist unauthentifiziert — ein Log darin haette aus einem
  Muell-Request einen vollen Rewrite gemacht.
- Aufbewahrung ist eine Obergrenze, kein Archiv: AUDIT_MAX (5000) bzw. AUDIT_DAYS (90).
- Per Default an (AUDIT_LOG=0 schaltet es ganz ab). IP-Adressen per Default AUS;
  AUDIT_IP=net speichert nur das Netz, full die ganze Adresse. Nie der User-Agent,
  nie die Passkey-ID eines Fehlversuchs, nie ein abgelehnter Invite-Code.
- Adresse kommt aus CF-Connecting-IP, dann X-Forwarded-For, dann X-Real-IP —
  ein Cloudflare-Tunnel schreibt den Besucher NICHT in XFF, dort steht sonst nur
  der Tunnel selbst und sieht dabei voellig plausibel aus.
- Loeschen wird selbst protokolliert, die Event-IDs zaehlen weiter: die Luecke bleibt sichtbar.
- Neue Karte in views/Admin.jsx (Filter, "Show more"), Aufbereitung in lib/audit.js
  mit 20 Tests. GET /api/admin/audit und POST /api/admin/audit/clear, beide hinter requireAdmin.

Demo:
- Die Live-Demo laeuft wieder, jetzt auf der Projektseite selbst statt auf GitHub Pages:
  opengym.duarte-santos.ch/demo/. Das eingebettete Telefon auf der Startseite geht damit auch
  wieder — es muss derselbe Host sein, X-Frame-Options ist SAMEORIGIN.

Doku: README-Config-Tabelle, .env.example, SELF_HOSTING, SECURITY (inkl. der
api/server.js-Zeilenverweise, die wieder stimmen).
2026-08-23 16:12:35 +02:00
Duarte Santos f94fa7c0e3 Umzug nach gitea.com: Images, Klon-URL, Anlaufstellen und CI umgestellt
Das GitHub-Repo ist mit dem gesperrten Account weg, mit ihm die GHCR-Images, die
Pages-Demo und die Discussions. Alles, was jemand zum Selbsthosten anklickt, zeigte
aber weiter dorthin.

- docker-compose zieht jetzt gitea.com/duartesantos/opengym-{api,web}; die
  Dockerfile-Labels (source/url/documentation) ebenso
- README, SECURITY, CONTRIBUTING und docs/SELF_HOSTING zeigen auf gitea.com.
  Discussions gibt es dort nicht: Fragen und Ideen laufen als gelabelte Issues,
  Security-Meldungen ueber eine Issue-Anfrage nach einem privaten Kanal statt
  ueber GitHubs Advisories
- Badges auf die Gitea-Shields umgestellt, die tote Pages-Demo aus dem Kopf
  genommen (die APK bleibt der Weg zum Ausprobieren)
- .gitea/workflows: Tests und Docker-Publish, weiter mit Release- statt
  Tag-Trigger. Kein type=gha-Cache, den gibt es auf den Gitea-Runnern nicht;
  der Push braucht ein Repo-Secret PACKAGES_TOKEN mit write:package
- .gitea/ISSUE_TEMPLATE mit denselben Formularen wie auf GitHub
- .github/* bleibt unangetastet, falls der Account zurueckkommt

Die alten Issue-/PR-Nummern im CHANGELOG bleiben als reiner Text stehen - sie
zeigen auf ein totes Repo und passen nicht auf die Nummerierung hier.
2026-08-22 13:54:26 +02:00
Duarte Santos accc3c1038 Sessions you can actually end, and invite codes worth guessing at
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.
2026-07-31 19:32:57 +02:00
Duarte Santos 3a120df205 A security policy, and dependency updates that stay quiet
openGym ships passkeys, a signed session cookie and an admin dashboard, and
people run it on the open internet. Until now someone finding a hole had no
option but a public issue.

SECURITY.md documents the model as it actually is, verified against server.js
rather than described from memory: what the session cookie is and how long it
lasts, that it cannot be revoked individually, that ./data is unencrypted and
its holder can mint a session for any account, that there is no rate limiting,
and what changing RP_ID costs. A self-hoster deciding whether to run this for
other people deserves that list up front.

Dependabot is monthly and grouped one PR per ecosystem — a default setup on a
solo project produces noise that stops being read, which is the opposite of the
point. Android/iOS are left out on purpose: Capacitor pins those to the npm
packages, so bumping them separately breaks the mobile build.

Also: api/ has had two dependencies since notifications landed. CONTRIBUTING
still claimed one.
2026-07-31 19:12:18 +02:00