Review fixes: forwarded IP, sign-in errors, revoking access

- take the visitor IP from the last X-Forwarded-For entry (the one
  the proxy adds); the first can be set by the client to fake unique
  visitors
- show "Sign-in failed" with a retry link when the identity provider
  rejects the callback instead of a generic 500 page
- report concurrent unique-constraint conflicts (e.g. two requests
  claiming the same shortcode) as 409 instead of 500
- admins can revoke a user's access (end sessions, delete API tokens)
  from Administration; previously a removed user kept working tokens
- README: security notes on the proxy header, offboarding and rate
  limiting

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 17:49:30 +02:00
co-authored by Claude Opus 5.5
parent 00f5fe1f33
commit 3dc2c28330
9 changed files with 131 additions and 10 deletions
+6
View File
@@ -67,6 +67,12 @@ docker compose up -d
Put it behind a reverse proxy with TLS. Back up `data/`: it holds the SQLite database (`short.db`) and the uploaded avatars. Database migrations run automatically on startup.
## Security notes
- **Reverse proxy:** with `TRUST_PROXY=true` the visitor IP is taken from the last `X-Forwarded-For` entry, so the proxy in front of short must append to that header (Traefik, Caddy and nginx' `$proxy_add_x_forwarded_for` do).
- **Removing someone:** admin rights and access follow Authentik at each sign-in, but existing sessions (up to 30 days) and API tokens keep working. When someone leaves or loses admin rights, use **Administration → user → Revoke access** to end their sessions and delete their tokens, and remove their access in Authentik.
- **Rate limiting** isn't built in. Every visit is recorded, so very public links can be flooded to inflate stats; rate-limit at the reverse proxy if needed. Individual clicks are deleted after 90 days.
## API
The admin UI uses the same JSON API. Create a token under **API tokens**; it has the same permissions as your account.