Files
StarPunk/docs/design/v2.10.1/2026-11-03-websub-hardening.md
T
PhilandClaude Opus 5.5 0716984958 docs: Bring all documentation up to date for v2.10.1
- architecture/: overview, technology stack, auth (OIDC + built-in
  IndieAuth), syndication (POSSE) rewritten; new database.md,
  deployment.md and indieweb-protocols.md; legacy stack marked historical
- decisions/: reconstructed ADR-060 and ADR-063; 31 status corrections
  (superseded auth ADRs, proposed -> accepted); INDEX rebuilt
- design/: reconstructed the v1.6.0 documents the webmention code cites;
  reports for 18 v2 releases without a design folder; INDEX rebuilt
- projectplan/: BACKLOG rewritten (shipped items removed, open issues from
  the reviews added); RELEASE.md for v2.0.0-v2.10.1; INDEX
- standards/: development setup (uv, tests, DEV_MODE), testing (CI test
  stage), git and release flow, versioning, coding standards, cookies
- README, CLAUDE.md, .env.example (every setting the code reads, with
  defaults) brought up to date
- 137 broken links repaired (old absolute paths, moved files); stale ADR
  references in code comments corrected (comments only)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 12:40:19 -07:00

2.5 KiB

v2.10.1: WebSub hardening (implementation report)

Reconstructed on 2026-11-03 from the changelog and git history. Commit b204328.

Design

ADR-071, "Amendments (v2.10.1)", from an adversarial review of v2.10.0 against the W3C Recommendation.

Changes

  • starpunk/websub_worker.py: each intent/delivery handled in its own try block (an error drops a verification or retries a delivery, never stops the worker); failing subscribers kept until lease end; DNS failures (ResolutionError) and render errors retried; a topic rendering 404/410 sends hub.mode=denied and ends its subscriptions; each topic rendered once per pass; verification replies over 4 KB fail.
  • starpunk/webmention_ssrf.py: _Watchdog closes the client when the whole exchange exceeds the time limit (10 s), for safe_get and safe_post, so webmention fetching benefits too; ResolutionError distinguishes DNS failures.
  • starpunk/websub.py: spec 5.1 fixes (unreserved percent-decoding, requested topic echoed, lease/secret ignored on unsubscribe, empty secret refused); callback validation (printable, ≤2,048 chars, not this site, port 80/443/≥1024, IDNA host); limits count pending requests per callback address, at most 200 pending; likes only queue /likes and tag pages; unsubscribe works with an external hub.
  • starpunk/routes/websub.py: case-insensitive Content-Type check.
  • migrations/017_websub_hardening.sql: request_id, requested_topic, callback_ip on intents; callback_ip on subscriptions.
  • starpunk/media.py: attach_media_to_note announces the note (photos are in the first delivery); starpunk/notes.py/micropub.py skip the early announcement for notes with photos.
  • starpunk/feeds/cache.py, starpunk/routes/public.py: cache key and weak ETag from format + notes checksum incl. content_version (stable across processes); /feed sends Vary: Accept.
  • .env.example: TRUSTED_PROXY and the WebSub settings documented.

Tests

tests/test_websub_hardening.py (24 tests, one or more per amendment: oversized challenge, bad and IDN callbacks, per-item errors, photo notes, slow callback cut off, lease kept, DNS/render retries, denial for gone topics, pending-request limits, spec 5.1 cases, request-id race, render once per pass, likes, stable ETag, Vary: Accept).

Verification

Deployed to production; the websub.rocks publisher test passed again.

Notes

Per-client rate limits only work behind Caddy with TRUSTED_PROXY=true.