Files
StarPunk/docs/design/v2.9.0/2026-11-03-micropub-review.md
PhilandClaude Opus 5.5 ab6ff60f5c feat: Micropub review fixes (v2.9.0)
- mp-syndicate-to/mp-slug read from JSON properties; absent means no
  crossposting
- Sanitize rendered HTML (nh3 allowlist)
- q=source/q=category need a posting scope; draft scope creates drafts;
  private/unlisted visibility saved as drafts
- Photos that can't be fetched or found fail the request; remote photos
  via the SSRF-checked, pinned fetcher
- JSON scalars wrapped, update delete values must be arrays
- bookmark-of stored; HTML content returned as {html} (migration 015)
- published stored as UTC, bad dates 400; malformed JSON 400
- Auth: case-insensitive Bearer, header+body 400, WWW-Authenticate

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

2.5 KiB

v2.9.0: Micropub review

Review against the W3C Micropub Recommendation (https://www.w3.org/TR/micropub/), run through the Flask test client and mapped to the micropub.rocks server tests. Everyday create/update/delete/query/media/auth already passed; the gaps were privacy, security and silent data loss.

Decisions (user)

  • No mp-syndicate-to from a Micropub client means no crossposting (was: all targets, v2.1.0). The admin editor's default is unchanged.
  • visibility private/unlisted are saved as drafts.
  • Rendered HTML is sanitized with an allowlist (nh3 defaults plus class, title, id, lang, dir on all tags; video/audio/source/track/picture).

Changes

Area Before After
mp-* in JSON properties ignored (all targets, timestamp slug) read as commands, never stored
absent mp-syndicate-to all targets none
q=source / q=category any token create, update, delete or draft scope
HTML content rendered raw (stored XSS) render_markdown() = Markdown + nh3
visibility ignored (published) private/unlisted -> draft; unknown -> 400
draft scope 403 creates drafts only
photo fetch/lookup failure dropped, 201 400, nothing created or changed
remote photo fetch first host checked, redirects followed webmention_ssrf.safe_get (per hop, pinned)
JSON scalars indexed per character wrapped on create; update delete values must be arrays
bookmark-of dropped notes.bookmark_of, kind bookmark (migration 015)
HTML-authored content in q=source string {"html": ...} via notes.content_format
summary / name only 400 used as text / titled post
video / audio dropped 400
published stored with offset; garbage -> now naive UTC; garbage -> 400
malformed JSON 500 400
update without operations 204 400
auth Bearer only; header+body accepted; no challenge case-insensitive; both -> 400; WWW-Authenticate

Kept as is

  • 403 (RFC 6750) for insufficient_scope; the Micropub table says 401.
  • add only for category and photo; published, syndication, location not updatable.
  • location/checkin ignored (3.3.5 allows).
  • GET access_token query parameter still accepted.

Tests

tests/test_micropub_v290.py (31 of 34 fail on v2.8.1). Updated: likes/reposts helper sends mp-syndicate-to in properties; test_micropub_default_is_no_targets; remote photo test uses the pinned fetcher; corrupted-image message.