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:
1 parent
9f17e145ff
commit
75946be7b2
67 files changed
+885
-498
No files matched your search
@@ -11,7 +11,7 @@ per-release designs and reports are in [../design/](../design/).
|
||||
|----------|-------------|
|
||||
| [overview.md](overview.md) | System overview: purpose, request flow, modules and routes, background workers, storage, auth model, URL surface, caching, security posture |
|
||||
| [technology-stack.md](technology-stack.md) | Current runtime, Python dependencies, standards implemented, testing and CI |
|
||||
| [database.md](database.md) | SQLite schema after migrations 001–017, migration runner and its lock, connection pool |
|
||||
| [database.md](database.md) | SQLite schema after migrations 001–019, migration runner and its lock, connection pool |
|
||||
| [deployment.md](deployment.md) | Container image stages, CI workflow, release process, `/data` layout, reverse proxy, all environment variables |
|
||||
| [simplified-auth-architecture.md](simplified-auth-architecture.md) | Admin login via OpenID Connect and the built-in IndieAuth server that issues Micropub tokens (ADR-064) |
|
||||
| [indieweb-protocols.md](indieweb-protocols.md) | How Micropub, IndieAuth, Webmention, microformats2, WebSub and the feeds are implemented, with compliance status and known gaps |
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
# Database Architecture
|
||||
|
||||
**Version**: 2.10.1 (2026-11-03)
|
||||
**Version**: 2.11.0 (2026-11-03)
|
||||
**Status**: Current. Verified against a database created by `create_app()`
|
||||
with migrations 001–017.
|
||||
with migrations 001–019.
|
||||
|
||||
StarPunk uses one SQLite file, `starpunk.db` under `DATA_PATH` (`/data` in
|
||||
the container), in WAL mode. Note *content* is not in the database: it lives
|
||||
@@ -71,6 +71,8 @@ Background: [ADR-031](../decisions/ADR-031-database-migration-system-redesign.md
|
||||
| `015_bookmarks_and_content_format.sql` | 2.9 | `notes.bookmark_of`, `notes.content_format` |
|
||||
| `016_websub.sql` | 2.10.0 | `websub_subscriptions`, `websub_intents`, `websub_deliveries`, `site_state` |
|
||||
| `017_websub_hardening.sql` | 2.10.1 | `websub_intents.request_id`, `requested_topic`, `callback_ip`; `websub_subscriptions.callback_ip` |
|
||||
| `018_foreign_key_cleanup.sql` | 2.11.0 | Removes rows orphaned while foreign keys weren't enforced |
|
||||
| `019_shared_rate_limits.sql` | 2.11.0 | `rate_limits` (counters shared by all processes) |
|
||||
|
||||
New migrations are numbered `NNN_description.sql`, must be safe to run inside
|
||||
one transaction, and should use `IF NOT EXISTS` where SQLite allows it.
|
||||
@@ -205,13 +207,18 @@ its cached feed data is stale.
|
||||
|
||||
**`schema_migrations`**: applied migrations (see above).
|
||||
|
||||
**`rate_limits`** (v2.11.0): request counts for `/webmention` and `/websub`,
|
||||
one row per key (`<limiter>:<ip or domain>`) and time window, so every
|
||||
server process enforces one shared limit. Old windows are pruned as it goes.
|
||||
|
||||
## Connections
|
||||
|
||||
- **Request connections**: `starpunk/database/pool.py`. `init_pool()` creates
|
||||
one `ConnectionPool` per process (up to 5 idle connections, 10-second busy
|
||||
timeout; `DB_POOL_SIZE` and `DB_TIMEOUT` can be set only through the
|
||||
`create_app()` config dict). Connections use `sqlite3.Row` rows,
|
||||
`check_same_thread=False` and `PRAGMA journal_mode=WAL`, and are wrapped
|
||||
`check_same_thread=False`, `PRAGMA journal_mode=WAL` and (since v2.11.0)
|
||||
`PRAGMA foreign_keys=ON`, so `ON DELETE CASCADE`/`SET NULL` run, and are wrapped
|
||||
in `MonitoredConnection` for query timing when metrics are on. `get_db()`
|
||||
stores one connection in `flask.g` per request or app context; on teardown
|
||||
it goes back to the pool, rolled back first if a transaction was left
|
||||
|
||||
@@ -24,12 +24,12 @@ deployment repository, not here.
|
||||
|
||||
## Container image (`Containerfile`)
|
||||
|
||||
A multi-stage build on `python:3.11-slim`; it works with Podman and Docker.
|
||||
A multi-stage build on `python:3.14-slim`; it works with Podman and Docker.
|
||||
|
||||
| Stage | Purpose |
|
||||
|-------|---------|
|
||||
| `builder` | Copies `uv` from `ghcr.io/astral-sh/uv`, creates `/opt/venv` and installs `requirements.txt` into it |
|
||||
| `test` | Copies the venv, adds `pytest` and `pytest-mock`, copies the source and runs `python -m pytest -q -p no:cacheprovider tests` with test values for `SESSION_SECRET`, `SITE_URL` and `ADMIN_ME`. The stage only builds if the tests pass. |
|
||||
| `test` | Copies the venv, installs `requirements-test.txt`, copies the source and runs `python -m pytest -q -p no:cacheprovider tests` with test values for `SESSION_SECRET`, `SITE_URL` and `ADMIN_ME`. The stage only builds if the tests pass. |
|
||||
| runtime (last, the default target) | Creates user `starpunk` (UID/GID 1000) and `/data/notes`, copies the venv and the application to `/app`, sets `DATA_PATH=/data`, `NOTES_PATH=/data/notes`, `DATABASE_PATH=/data/starpunk.db`, runs as `starpunk`, exposes port 8000 |
|
||||
|
||||
The runtime image's command is gunicorn:
|
||||
@@ -172,8 +172,8 @@ ignored with a warning.
|
||||
| `DATA_PATH` | `./data` (image: `/data`) | Root of all stored data |
|
||||
| `DATABASE_PATH` | `./data/starpunk.db` (image: `/data/starpunk.db`) | |
|
||||
| `NOTES_PATH` | `./data/notes` (image: `/data/notes`) | Created at start-up, but note files are always written to `DATA_PATH/notes` |
|
||||
| `FLASK_ENV` | `development` | Set `production` in production |
|
||||
| `FLASK_DEBUG` | `1` | Set `0` in production (the image does not set it) |
|
||||
| `FLASK_ENV` | `production` | Reported in `/health` and admin diagnostics; the image sets `production` |
|
||||
| `FLASK_DEBUG` | `0` | Debug off unless `1` (`flask run --debug` sets it locally); the image sets `0` |
|
||||
| `LOG_LEVEL` | `INFO` | `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL` |
|
||||
| `VERSION` | package `__version__` | Overrides the reported version; normally unset |
|
||||
|
||||
|
||||
@@ -197,7 +197,8 @@ route isn't registered at all.
|
||||
|
||||
1. Rate limits: 60 requests per minute per client IP and 10 per minute per
|
||||
source domain (`WEBMENTION_RATE_LIMIT_*`). Over the limit gets 429 with
|
||||
`Retry-After`. The limiter is in memory, per process. The client IP
|
||||
`Retry-After`. Counts are shared by all server processes (`rate_limits`
|
||||
table, v2.11.0). The client IP
|
||||
comes from `X-Forwarded-For` only when `TRUSTED_PROXY=true`.
|
||||
2. Form-encoded (JSON also accepted). `source` and `target` are required,
|
||||
http(s), at most 2048 characters, and different from each other.
|
||||
@@ -445,7 +446,7 @@ Drafts that stay drafts change nothing.
|
||||
|
||||
Limits (429 when hit):
|
||||
|
||||
- 30 requests per minute per client IP (per process; needs
|
||||
- 30 requests per minute per client IP (shared by all processes; needs
|
||||
`TRUSTED_PROXY=true` behind a proxy);
|
||||
- at most 200 pending verifications;
|
||||
- `WEBSUB_MAX_SUBSCRIPTIONS` (1000) in total;
|
||||
@@ -488,7 +489,6 @@ retried.
|
||||
|
||||
- The hub serves only this site's topics, by design. websub.rocks' hub
|
||||
tests use their own topics, so they can't be run against it.
|
||||
- Rate limiting is per process and in memory.
|
||||
- Deliveries always carry the full topic content (no diffs). Fat pings
|
||||
aren't sent to external hubs.
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -328,14 +328,16 @@ In place:
|
||||
untrusted redirect URIs never followed.
|
||||
- Post-login redirects are limited to this site.
|
||||
|
||||
CSRF (v2.11.0): admin form POSTs, `/auth/logout` and the consent form's
|
||||
approve button need a `csrf_token` field (or `X-CSRF-Token` header) equal to
|
||||
an HMAC-SHA256 of the `starpunk_session` cookie under `SECRET_KEY`; anything
|
||||
else gets 400. The token changes with every login and needs no storage.
|
||||
Endpoints apps call with bearer tokens are not affected. The client metadata
|
||||
fetch uses `webmention_ssrf.safe_get` (every redirect hop checked, the
|
||||
connection pinned, a 5-second limit).
|
||||
|
||||
Known gaps:
|
||||
|
||||
- Admin forms and the consent form have no CSRF token. They rely on the
|
||||
`SameSite=Lax` session cookie, which cross-site POSTs don't carry.
|
||||
- The client metadata fetch checks the `client_id` URL against private
|
||||
addresses, but then makes a plain `httpx.get` that follows redirects.
|
||||
Redirect hops are not re-checked and the connection is not pinned, unlike
|
||||
`webmention_ssrf.safe_get`.
|
||||
- `scopes_supported` leaves out `draft`, although Micropub honours it and
|
||||
the consent screen grants it when requested. Unknown scopes are also shown
|
||||
and granted as requested; they just have no effect.
|
||||
|
||||
@@ -246,10 +246,6 @@ to itself (v2.8.0).
|
||||
|
||||
- Bluesky and Threads copies don't follow edits (platform limitation).
|
||||
Unticking and re-ticking a target makes a new copy.
|
||||
- Link-card and Threads image fetches check every redirect hop against
|
||||
private addresses but don't pin DNS, and use a per-request rather than an
|
||||
overall time limit. Webmention and WebSub fetching use the stricter
|
||||
`webmention_ssrf` fetcher.
|
||||
- No per-target choice for Micropub updates: `mp-syndicate-to` is read only
|
||||
on create.
|
||||
- Likes of ordinary web pages, and all likes on Threads, stay on the site.
|
||||
@@ -14,9 +14,9 @@ the pieces fit together.
|
||||
|
||||
| Component | Choice |
|
||||
|-----------|--------|
|
||||
| Language | Python 3.11 (`python:3.11-slim` base image) |
|
||||
| Web framework | Flask 3.0 (Werkzeug, Jinja2, itsdangerous, click come with it) |
|
||||
| WSGI server | gunicorn 21.2, 4 sync workers (see [deployment.md](deployment.md)) |
|
||||
| Language | Python 3.14 (`python:3.14-slim` base image; since v2.11.0) |
|
||||
| Web framework | Flask 3.1 (Werkzeug, Jinja2, itsdangerous, click come with it) |
|
||||
| WSGI server | gunicorn 26.2, 4 sync workers (see [deployment.md](deployment.md)) |
|
||||
| Database | SQLite (standard-library `sqlite3`), WAL mode, FTS5 for search |
|
||||
| Content storage | Markdown files on disk |
|
||||
| Background work | `threading` daemon threads; `fcntl.flock` file locks to pick one process |
|
||||
@@ -28,32 +28,36 @@ the pieces fit together.
|
||||
|
||||
## Python dependencies (`requirements.txt`)
|
||||
|
||||
Pinned to a minor series. Upgraded in v2.11.0, when the set had no known
|
||||
vulnerabilities (`pip-audit`); check again before each release.
|
||||
|
||||
| Package | Pin | Used for |
|
||||
|---------|-----|----------|
|
||||
| Flask | `3.0.*` | Web framework |
|
||||
| gunicorn | `21.2.*` | Production WSGI server |
|
||||
| markdown | `3.5.*` | Rendering notes (`extra`, `codehilite`, `nl2br` and a bare-URL linking extension) |
|
||||
| feedgen | `1.0.*` | RSS 2.0 feed (`starpunk/feeds/rss.py`); Atom and JSON Feed are generated by StarPunk's own code |
|
||||
| httpx | `0.27.*` | All outbound HTTP: OIDC, IndieAuth client discovery, webmention and WebSub requests (through the SSRF-safe wrapper in `webmention_ssrf.py`), crossposting APIs, health check |
|
||||
| python-dotenv | `1.0.*` | Loading `.env` |
|
||||
| beautifulsoup4 | `4.12.*` | HTML parsing: IndieAuth client pages, crosspost text and link cards |
|
||||
| Flask | `3.1.*` | Web framework |
|
||||
| gunicorn | `26.2.*` | Production WSGI server |
|
||||
| markdown | `3.11.*` | Rendering notes (`extra`, `codehilite`, `nl2br` and a bare-URL linking extension) |
|
||||
| nh3 | `0.3.*` | HTML sanitising (rendered notes, webmention content) |
|
||||
| beautifulsoup4 | `4.15.*` | HTML parsing: IndieAuth client pages, crosspost text and link cards |
|
||||
| lxml | `6.1.*` | Outgoing link extraction, webmention endpoint discovery and source checks |
|
||||
| mf2py | `2.0.*` | Parsing microformats2 (webmention sources, reply contexts, author h-card) |
|
||||
| pytest | `8.0.*` | Test runner (listed here as well as in the image's test stage) |
|
||||
| psutil | `5.9.*` | Memory monitor and system metrics |
|
||||
| Pillow | `10.1.*` | Image validation, resizing and variants |
|
||||
| pillow-heif | `0.18.*` | HEIC/HEIF uploads (iPhone photos) |
|
||||
| nh3 | `0.2.*` | HTML sanitising (rendered notes, webmention content) |
|
||||
| PyJWT[crypto] | `2.10.*` | Verifying OIDC ID tokens (JWKS, RS/ES signatures via `cryptography`) |
|
||||
| python-dateutil | `4.0.*` | Dates in reply contexts |
|
||||
| feedgen | `1.0.*` | RSS 2.0 feed (`starpunk/feeds/rss.py`); Atom and JSON Feed are generated by StarPunk's own code |
|
||||
| httpx | `0.28.*` | All outbound HTTP; requests to user-supplied URLs go through `webmention_ssrf.safe_get`/`safe_post` |
|
||||
| PyJWT[crypto] | `2.15.*` | Verifying OIDC ID tokens (JWKS, RS/ES signatures via `cryptography`) |
|
||||
| python-dotenv | `1.2.*` | Loading `.env` |
|
||||
| Pillow | `13.0.*` | Image validation, resizing and variants |
|
||||
| pillow-heif | `1.8.*` | HEIC/HEIF uploads (iPhone photos) |
|
||||
| psutil | `7.2.*` | Memory monitor and system metrics |
|
||||
|
||||
Packages imported directly but installed only as dependencies of the above:
|
||||
`lxml` (outgoing link extraction, webmention endpoint discovery and source checks; from feedgen) and `python-dateutil` (dates in
|
||||
reply contexts; from feedgen). `markupsafe` comes with Flask/Jinja2.
|
||||
`markupsafe` comes with Flask/Jinja2.
|
||||
|
||||
### Development dependencies (`requirements-dev.txt`)
|
||||
### Test and development dependencies
|
||||
|
||||
Includes `requirements.txt`, plus `pytest-cov`, `pytest-mock`, `black`,
|
||||
`flake8`, `mypy` and `gunicorn`. Coding standards are in
|
||||
[../standards/](../standards/).
|
||||
- `requirements-test.txt`: `pytest` 9.2 and `pytest-mock` 3.15, used by the
|
||||
Containerfile test stage (CI).
|
||||
- `requirements-dev.txt`: runtime and test requirements plus `pytest-cov`,
|
||||
`black`, `flake8`, `mypy` (not enforced) and `pip-audit`. Coding standards
|
||||
are in [../standards/](../standards/).
|
||||
|
||||
### Deliberately not used
|
||||
|
||||
@@ -94,7 +98,7 @@ Protocol details: [indieweb-protocols.md](indieweb-protocols.md),
|
||||
```
|
||||
|
||||
- **In CI**: the `test` stage of the `Containerfile` installs the production
|
||||
requirements plus pytest and pytest-mock and runs the whole suite. The
|
||||
requirements plus `requirements-test.txt` and runs the whole suite. The
|
||||
image is only built and pushed if it passes. Checklist:
|
||||
[../standards/testing-checklist.md](../standards/testing-checklist.md).
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ is in `../architecture/`; decisions are in `../decisions/` (ADRs).
|
||||
|
||||
## Contents
|
||||
|
||||
[v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [v2.10.2](#v2102) · [hotfix](#hotfix)
|
||||
[v1.0.0](#v100) · [v1.1.1](#v111) · [v1.1.2](#v112) · [v1.2.0](#v120) · [v1.3.0](#v130) · [v1.3.1](#v131) · [v1.4.0](#v140) · [v1.4.1](#v141) · [v1.4.2](#v142) · [v1.5.0](#v150) · [v1.6.0](#v160) · [v2.0.0](#v200) · [v2.0.1](#v201) · [v2.0.2](#v202) · [v2.1.0](#v210) · [v2.2.0](#v220) · [v2.3.0](#v230) · [v2.3.1](#v231) · [v2.3.2](#v232) · [v2.3.3](#v233) · [v2.4.0](#v240) · [v2.5.0](#v250) · [v2.6.0](#v260) · [v2.6.1](#v261) · [v2.6.2](#v262) · [v2.6.3](#v263) · [v2.6.4](#v264) · [v2.6.5](#v265) · [v2.6.6](#v266) · [v2.6.7](#v267) · [v2.6.8](#v268) · [v2.6.9](#v269) · [v2.7.0](#v270) · [v2.7.1](#v271) · [v2.7.2](#v272) · [v2.8.0](#v280) · [v2.8.1](#v281) · [v2.9.0](#v290) · [v2.10.0](#v2100) · [v2.10.1](#v2101) · [v2.10.2](#v2102) · [v2.11.0](#v2110) · [hotfix](#hotfix)
|
||||
|
||||
## v1.0.0
|
||||
|
||||
@@ -410,6 +410,10 @@ OIDC admin login and built-in IndieAuth server.
|
||||
|
||||
- [2026-11-03-reply-context-fetch.md](v2.10.2/2026-11-03-reply-context-fetch.md) - Reply contexts fetched again (fetch_source returns three values since v2.7.0)
|
||||
|
||||
## v2.11.0
|
||||
|
||||
- [2026-11-03-maintenance-release.md](v2.11.0/2026-11-03-maintenance-release.md) - Dependency upgrades (Python 3.14), foreign keys, CSRF, fetchers, debug default, shared rate limits
|
||||
|
||||
## hotfix
|
||||
|
||||
Not a release folder.
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# v2.11.0: Maintenance release
|
||||
|
||||
Dependency upgrades and the five High items in the backlog (all re-checked
|
||||
against the code first and still present).
|
||||
|
||||
## Dependencies
|
||||
|
||||
`pip-audit` on the v2.10.2 set found 97 published vulnerabilities in eight
|
||||
packages (Pillow 64, PyJWT 22, gunicorn 4, Flask 2, Markdown 2,
|
||||
python-dotenv 2, pytest 2, pillow-heif 1). All direct dependencies were moved
|
||||
to their current minor series (`requirements.txt`); the new set has no known
|
||||
vulnerabilities. Python moved from 3.11 to 3.14 (`python:3.14-slim`); the
|
||||
whole suite passes with `-W error::DeprecationWarning`.
|
||||
|
||||
- `requirements-test.txt` (pytest, pytest-mock) is installed by the
|
||||
Containerfile test stage; pytest left the runtime requirements.
|
||||
- `lxml` and `python-dateutil` are pinned (used directly, previously only
|
||||
transitive). `uv` is pinned to 0.9.28 in the Containerfile.
|
||||
- `datetime.utcnow()` (34 calls in `starpunk/`, more in tests) became
|
||||
`datetime.now(timezone.utc).replace(tzinfo=None)`: same naive-UTC values.
|
||||
sqlite3's default datetime adapters, deprecated in 3.12, are registered
|
||||
explicitly in `starpunk/database/__init__.py` with the same output.
|
||||
|
||||
## High backlog items
|
||||
|
||||
1. **Foreign keys.** `PRAGMA foreign_keys=ON` on every pooled connection
|
||||
(`database/pool.py`); all deletes of notes, media and WebSub subscriptions
|
||||
go through the pool. Every foreign key is `CASCADE` or `SET NULL`, so no
|
||||
delete can be blocked. Migration 018 removes orphans (production: three
|
||||
`note_tags` rows from hard-deleted notes). Crosspost rows still have no
|
||||
foreign key on purpose.
|
||||
2. **CSRF.** `starpunk/csrf.py`: token = HMAC-SHA256(SECRET_KEY,
|
||||
"csrf:" + starpunk_session cookie); `before_request` checks the
|
||||
`csrf_token` field or `X-CSRF-Token` header on every admin POST,
|
||||
`auth.logout` and `indieauth.approve`; 400 otherwise. All 12 POST forms
|
||||
carry it. `CSRF_ENABLED` (default true); test apps turn it off unless they
|
||||
set it.
|
||||
3. **Fetchers.** `indieauth.fetch_client_redirect_uris` and
|
||||
`syndication._fetch_public` use `webmention_ssrf.safe_get` (per-hop
|
||||
checks, DNS pinning, hard deadline). `safe_get` gained `truncate` for
|
||||
reads that stop at the size limit.
|
||||
4. **Debug default.** `FLASK_DEBUG` defaults to 0 and `FLASK_ENV` to
|
||||
production; the runtime image sets both.
|
||||
5. **Shared rate limits.** `SharedRateLimiter` keeps sliding-window counters
|
||||
in `rate_limits` (migration 019): current window plus the previous one
|
||||
weighted by overlap. Used by `/webmention` (per IP and per source domain)
|
||||
and `/websub`; old windows are pruned every 200 calls.
|
||||
|
||||
## Housekeeping
|
||||
|
||||
`compose.yaml` no longer pins 0.6.0 or sets `VERSION`/`ENVIRONMENT`; the
|
||||
unused root `dev_auth.py` and the committed `test.ini` were removed.
|
||||
|
||||
## Tests
|
||||
|
||||
New: `tests/test_csrf.py`, `tests/test_foreign_keys.py`,
|
||||
`tests/test_shared_rate_limit.py`, IndieAuth client-metadata tests through the
|
||||
fetcher (including a redirect to a private address). Crosspost tests route
|
||||
link-card fetches through the fetcher's transport. Full suite: 1264 passed
|
||||
on Python 3.14.
|
||||
@@ -1,9 +1,9 @@
|
||||
# StarPunk Backlog
|
||||
|
||||
**Last Updated**: 2026-11-03 (current release: v2.10.1)
|
||||
**Last Updated**: 2026-11-03 (current release: v2.11.0)
|
||||
|
||||
These are the open features and bugs, sorted by priority. Each item was checked against the code
|
||||
at v2.10.1. Work that has shipped is listed per release in `vX.Y.Z/RELEASE.md` and in
|
||||
at v2.11.0. Work that has shipped is listed per release in `vX.Y.Z/RELEASE.md` and in
|
||||
`CHANGELOG.md`.
|
||||
|
||||
## Priority Levels
|
||||
@@ -23,30 +23,7 @@ at v2.10.1. Work that has shipped is listed per release in `vX.Y.Z/RELEASE.md` a
|
||||
|
||||
## High
|
||||
|
||||
### SQLite foreign keys are not enforced (ON DELETE CASCADE is inert)
|
||||
- **Description**: No connection runs `PRAGMA foreign_keys = ON`, so the `ON DELETE CASCADE` clauses in the schema do nothing. When a note is deleted from the admin (a hard delete), its `note_tags`, `note_media`, `syndications` and webmention rows stay behind. `delete_media()` relies on the cascade to remove `media_variants` and `note_media` rows, so those are left orphaned too. Before turning the pragma on, check for existing orphan rows and add a migration that cleans them up. Each cascade also needs tests.
|
||||
- **Where**: `starpunk/database/` (connection setup/pool), `starpunk/notes.py` (`delete_note`, hard delete), `starpunk/media.py` (`delete_media`), `migrations/007`–`010`, `016`
|
||||
- **Source**: v2.10.x review; confirmed in code (there is no `foreign_keys` pragma anywhere in `starpunk/`)
|
||||
|
||||
### No CSRF tokens on admin and consent forms
|
||||
- **Description**: Admin forms (create/edit/delete notes, webmention moderation, token revocation) and the IndieAuth consent form rely only on the `SameSite=Lax` session cookie. Lax blocks cross-site POSTs in current browsers, but a per-session CSRF token is the standard defence and covers older clients and same-site subdomains.
|
||||
- **Where**: `starpunk/routes/admin.py`, `starpunk/routes/indieauth.py`, `templates/admin/*`
|
||||
- **Source**: Documentation refresh 2026-11-03 (architecture review)
|
||||
|
||||
### Two outbound fetches don't use the hardened fetcher
|
||||
- **Description**: IndieAuth client-metadata discovery (`indieauth.fetch_client_redirect_uris`) checks only the first URL, then uses `httpx.get(follow_redirects=True)`: redirect hops aren't checked and DNS isn't pinned. Crosspost link cards and Threads image fetches (`syndication._fetch_public`) check each hop but don't pin DNS, and their 10 s timeout is per read. Move both to `webmention_ssrf.safe_get`, as Webmention, WebSub and Micropub photo downloads already do.
|
||||
- **Where**: `starpunk/indieauth.py`, `starpunk/syndication.py`
|
||||
- **Source**: Documentation refresh 2026-11-03
|
||||
|
||||
### `FLASK_DEBUG` defaults to on
|
||||
- **Description**: `config.py` reads `FLASK_DEBUG` with default `"1"` (and `FLASK_ENV` defaults to development); the runtime image sets neither. Production is safe only because the deployment sets `FLASK_DEBUG=0`. Default to off, or set it in the `Containerfile` runtime stage.
|
||||
- **Where**: `starpunk/config.py`, `Containerfile`
|
||||
- **Source**: Documentation refresh 2026-11-03 (production verified: DEBUG is False there)
|
||||
|
||||
### Rate limiters are per process
|
||||
- **Description**: `RateLimiter` keeps its counters in memory, and gunicorn runs 4 workers. The WebSub hub limit of 30/min is therefore really 4×30/min, and the webmention endpoint limit is multiplied the same way. Consider a counter stored in SQLite that all workers share.
|
||||
- **Where**: `starpunk/rate_limiter.py`, `starpunk/routes/websub.py`, `starpunk/routes/webmention.py`, `Containerfile` (`--workers 4`)
|
||||
- **Source**: ADR-071 (Consequences: rate limiting bounds subscriber-chosen requests); v2.10.1 review
|
||||
None open.
|
||||
|
||||
---
|
||||
|
||||
@@ -92,20 +69,15 @@ at v2.10.1. Work that has shipped is listed per release in `vX.Y.Z/RELEASE.md` a
|
||||
- **Where**: `starpunk/webmention_processor.py`, `starpunk/webmention_worker.py`
|
||||
- **Source**: v1.6.0 design reconstruction (docs/design/v1.6.0/background-worker.md)
|
||||
|
||||
### Webmention rate limiter never cleaned up
|
||||
- **Description**: `cleanup_rate_limiters()` is never called, so per-IP and per-domain keys accumulate for the life of each process.
|
||||
- **Where**: `starpunk/rate_limiter.py`, `starpunk/routes/webmention.py`
|
||||
- **Source**: v1.6.0 design reconstruction
|
||||
|
||||
### Atom and JSON Feed not linked from pages
|
||||
- **Description**: `base.html` advertises only `/feed` (as RSS) and OPML with `rel=alternate`; add `<link rel="alternate">` for `/feed.atom` and `/feed.json` so readers can pick a format.
|
||||
- **Where**: `templates/base.html`
|
||||
- **Source**: Documentation refresh 2026-11-03
|
||||
|
||||
### Housekeeping in the repository
|
||||
- **Description**: `compose.yaml` is stale (`image: starpunk:0.6.0`, `VERSION=0.6.0` would override the real version, unused `ENVIRONMENT`); the root `dev_auth.py` duplicates `starpunk/dev_auth.py` and is unused; `LICENSE` says "Copyright (c) 2024 [Your Name]"; `test.ini` contains a private host name; `lxml` and `python-dateutil` are used directly but only installed as dependencies of other packages, while `pytest` is pinned in the production `requirements.txt`.
|
||||
- **Where**: `compose.yaml`, `dev_auth.py`, `LICENSE`, `test.ini`, `requirements*.txt`
|
||||
- **Source**: Documentation refresh 2026-11-03
|
||||
### LICENSE placeholder
|
||||
- **Description**: `LICENSE` still reads "Copyright (c) 2024 [Your Name]". Fill in the holder and year.
|
||||
- **Where**: `LICENSE`
|
||||
- **Source**: Documentation refresh 2026-11-03 (rest of that housekeeping item done in v2.11.0)
|
||||
|
||||
### Backfeed responses to crossposts
|
||||
- **Description**: Idea: bring likes, boosts and replies to StarPunk's own crossposts back to the note as responses. Two options: poll GoToSocial (the token would need a `read` scope), or rely on Bridgy, which sends webmentions. Since v2.8.0, StarPunk ignores webmentions *from* a note's own crossposts, so that rule would need to change to work with Bridgy.
|
||||
@@ -213,6 +185,8 @@ at v2.10.1. Work that has shipped is listed per release in `vX.Y.Z/RELEASE.md` a
|
||||
|
||||
These items were removed from the backlog because they have shipped:
|
||||
|
||||
- v2.11.0: SQLite foreign keys enforced (orphans cleaned up by migration 018); CSRF tokens on admin, logout and consent forms; IndieAuth client and crosspost link-card fetches moved onto the SSRF-safe fetcher; `FLASK_DEBUG`/`FLASK_ENV` default to off/production; rate limits shared by all processes (and old windows pruned, so the webmention limiter no longer grows); dependencies upgraded (Python 3.14, no known vulnerabilities); stale `compose.yaml`, duplicate `dev_auth.py` and `test.ini` removed or fixed; `lxml`/`python-dateutil` pinned, `pytest` out of the runtime requirements
|
||||
|
||||
- POSSE: GoToSocial (v2.1.0), Bluesky (v2.2.0), Threads (v2.6.0)
|
||||
- Webmentions: receive, send, display and moderation (v1.6.0); fixed and made spec-compliant in v2.6.8–v2.7.2
|
||||
- Reply contexts, replies, likes, reposts and bookmarks (v2.4.0, v2.5.0, v2.9.0)
|
||||
|
||||
@@ -4,7 +4,7 @@ Future work and per-release plans. See `../DOCUMENTATION.md` (PROJECTPLAN).
|
||||
|
||||
## Backlog
|
||||
|
||||
- **[BACKLOG.md](BACKLOG.md)** - Open features and bugs by priority (updated for v2.10.1)
|
||||
- **[BACKLOG.md](BACKLOG.md)** - Open features and bugs by priority (updated for v2.11.0)
|
||||
|
||||
## Releases
|
||||
|
||||
@@ -47,3 +47,4 @@ Future work and per-release plans. See `../DOCUMENTATION.md` (PROJECTPLAN).
|
||||
- **[v2.10.0](v2.10.0/RELEASE.md)** - WebSub (Released 2026-11-03)
|
||||
- **[v2.10.1](v2.10.1/RELEASE.md)** - WebSub hardening (Released 2026-11-03)
|
||||
- **[v2.10.2](v2.10.2/RELEASE.md)** - Reply context fetch fix (Released 2026-11-03)
|
||||
- **[v2.11.0](v2.11.0/RELEASE.md)** - Maintenance: dependency upgrades, High backlog items (Released 2026-11-03)
|
||||
@@ -0,0 +1,28 @@
|
||||
# v2.11.0
|
||||
|
||||
- **Date**: 2026-11-03
|
||||
- **Status**: Released
|
||||
- **Focus**: Maintenance: dependency upgrades and the High backlog items
|
||||
|
||||
## Security
|
||||
|
||||
- All dependencies upgraded (97 known vulnerabilities before, none after); Python 3.14
|
||||
- CSRF tokens on admin forms, logout and the IndieAuth consent
|
||||
- IndieAuth client and crosspost link-card fetches use the SSRF-safe fetcher
|
||||
- Debug off and production environment by default
|
||||
|
||||
## Changes
|
||||
|
||||
- Rate limits shared by all server processes
|
||||
- `requirements-test.txt`; pytest out of the production image; `lxml` and `python-dateutil` pinned; `uv` pinned
|
||||
|
||||
## Bugs fixed
|
||||
|
||||
- Foreign keys enforced, so deletes cascade; orphan rows removed (migration 018)
|
||||
- Deprecated `datetime.utcnow()` and sqlite3 adapters replaced
|
||||
- Stale `compose.yaml`, duplicate `dev_auth.py` and `test.ini` cleaned up
|
||||
|
||||
## Related
|
||||
|
||||
- [CHANGELOG](../../../CHANGELOG.md)
|
||||
- [Design note](../../design/v2.11.0/2026-11-03-maintenance-release.md)
|
||||
@@ -9,7 +9,7 @@ deployment is in [architecture/deployment.md](../architecture/deployment.md).
|
||||
|
||||
## Requirements
|
||||
|
||||
- Python 3.11 (the container image uses `python:3.11-slim`)
|
||||
- Python 3.14 (the container image uses `python:3.14-slim`)
|
||||
- [uv](https://docs.astral.sh/uv/) for the virtual environment and packages ([ADR-006](../decisions/ADR-006-python-virtual-environment-uv.md))
|
||||
- git
|
||||
- Optional: Docker or Podman, to build the image and run the CI test stage locally
|
||||
@@ -23,7 +23,7 @@ pytest-mock, black, flake8, mypy).
|
||||
```bash
|
||||
git clone https://git.thesatelliteoflove.com/phil/StarPunk.git
|
||||
cd StarPunk
|
||||
uv venv --python 3.11 # creates .venv/ (gitignored)
|
||||
uv venv --python 3.14 # creates .venv/ (gitignored)
|
||||
uv pip install -r requirements-dev.txt
|
||||
```
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ cd ~/Documents/projects/StarPunk # main checkout, on main
|
||||
git pull
|
||||
git worktree add ../StarPunk-worktrees/v2.10.1 -b fix/v2.10.1-websub-hardening main
|
||||
cd ../StarPunk-worktrees/v2.10.1
|
||||
uv venv --python 3.11 && uv pip install -r requirements-dev.txt
|
||||
uv venv --python 3.14 && uv pip install -r requirements-dev.txt
|
||||
```
|
||||
|
||||
### 2. Make the change
|
||||
|
||||
@@ -10,7 +10,7 @@ out." Patterns specific to small helper functions are in
|
||||
|
||||
## Base style
|
||||
|
||||
- [PEP 8](https://peps.python.org/pep-0008/) naming and layout, Python 3.11.
|
||||
- [PEP 8](https://peps.python.org/pep-0008/) naming and layout, Python 3.14. Use `datetime.now(timezone.utc)`, not the deprecated `datetime.utcnow()`.
|
||||
- **Match the file you are editing.** 4-space indents everywhere; quote
|
||||
style varies between modules (newer code uses double quotes); keep lines
|
||||
to roughly 100 characters.
|
||||
|
||||
Reference in new issue
Block a user