maint: Dependency upgrades and High backlog items (v2.11.0)

- All dependencies to current releases (97 known vulnerabilities -> 0),
  Python 3.14, uv pinned, requirements-test.txt, lxml/dateutil pinned
- CSRF tokens on admin forms, logout and IndieAuth consent
- IndieAuth client and crosspost link-card fetches via safe_get
- FLASK_DEBUG/FLASK_ENV default off/production; image sets them
- Foreign keys enforced on pooled connections; migration 018 removes orphans
- Rate limits shared across processes (rate_limits, migration 019)
- datetime.utcnow() and sqlite3 default adapters replaced
- compose.yaml fixed; duplicate dev_auth.py and test.ini removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-03 13:09:52 -07:00
1 parent 9f17e145ff
commit 75946be7b2
67 files changed
+885 -498

No files matched your search

+11 -10
View File
@@ -293,13 +293,12 @@ their credentials are set. The full list with defaults is in
callbacks, remote Micropub photos, IndieAuth client pages, crosspost link
cards) are checked first: every address the host resolves to must be public
(private, loopback, link-local, CGNAT, multicast and reserved ranges are
refused). The fetcher in `webmention_ssrf.py`, used for webmentions, reply
contexts, WebSub and remote Micropub photos, follows redirects by hand and
re-checks each hop, connects to the address it checked (no second DNS
lookup) and limits response size (1 MB by default) and total time.
Crosspost link cards use their own check that also re-checks each redirect.
The IndieAuth client-page fetch checks only the initial URL. `DEV_MODE`
relaxes the checks for local testing.
refused). Every fetch of a user-supplied URL (webmentions, reply contexts,
WebSub, remote Micropub photos, IndieAuth client pages and, since v2.11.0,
crosspost link cards) uses the fetcher in `webmention_ssrf.py`: it follows
redirects by hand and re-checks each hop, connects to the address it
checked (no second DNS lookup) and limits response size (1 MB by default)
and total time. `DEV_MODE` relaxes the checks for local testing.
- **HTML sanitising**: rendered notes (Markdown or HTML sent by a Micropub
client) and webmention content are cleaned with nh3 allow-lists; search
highlighting escapes everything except `<mark>`.
@@ -307,15 +306,17 @@ their credentials are set. The full list with defaults is in
(defaults 60 and 10 per 60 seconds); `/websub` 30 requests per IP per
minute, plus limits on subscriptions in total, per callback host and per
callback address, and on requests waiting for verification. Request-rate
counters are in memory and per process.
counters live in the `rate_limits` table, shared by all server processes
(v2.11.0).
- **Client IP behind a proxy**: with `TRUSTED_PROXY=true` the first address in
`X-Forwarded-For` is used as the client IP for rate limiting. Set it only
when the app is reachable solely through a proxy that sets that header
(Caddy does); without it, every client shares the proxy's address.
- **Auth**: hashed session and token storage, single-use login state, PKCE
for both OIDC and IndieAuth, redirect URIs checked against the client,
post-login redirects limited to this site. Admin form POSTs rely on the
SameSite=Lax session cookie (there are no per-form CSRF tokens).
post-login redirects limited to this site. Admin form POSTs, logout and
the IndieAuth consent carry a CSRF token: an HMAC of the session cookie,
checked by `starpunk/csrf.py` (v2.11.0), on top of the SameSite=Lax cookie.
- **Uploads**: request bodies are capped at 50 MB; images are processed by
Pillow and stored under random (UUID) names.
- **Container**: runs as a non-root user. HTTPS and security headers (HSTS,