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>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-03 10:11:23 -07:00
1 parent 57682165a4
commit ab6ff60f5c
19 files changed
+610 -122

No files matched your search

+3 -2
View File
@@ -356,7 +356,8 @@ class TestEntryPoints:
).get_json()
assert data["syndicate-to"] == [{"uid": f"{GTS}/", "name": "GoToSocial"}]
def test_micropub_default_is_all_targets(self, app):
def test_micropub_default_is_no_targets(self, app):
"""Absent mp-syndicate-to means no crossposting (v2.9.0)"""
token = self._token(app)
response = app.test_client().post(
"/micropub", data={"h": "entry", "content": "via quill"},
@@ -367,7 +368,7 @@ class TestEntryPoints:
assert response.headers["Location"].startswith("https://blog.example.com/note/")
with app.app_context():
from starpunk.database import get_db
assert get_db(app).execute("SELECT COUNT(*) FROM syndications").fetchone()[0] == 1
assert get_db(app).execute("SELECT COUNT(*) FROM syndications").fetchone()[0] == 0
def test_micropub_explicit_empty_choice(self, app):
token = self._token(app)