fix: WebSub hardening from the adversarial review (v2.10.1)

- Per-item error handling in the worker; hard time limits on requests
- Notes with photos announced after attach; feed cache/ETag follow
  content_version
- Keep failing subscriptions until lease end; retry DNS and render errors;
  hub.mode=denied for gone topics
- Spec 5.1: decode unreserved chars, echo requested topic, ignore lease and
  secret on unsubscribe, case-insensitive Content-Type, refuse empty secret
- Limits count pending requests per callback address; callback validation;
  request_id guards the verification race (migration 017)
- Render once per topic per pass; likes only push /likes; Vary: Accept

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-03 11:23:36 -07:00
1 parent 409b8b31b4
commit b2043286fa
17 files changed
+825 -151

No files matched your search

+9
View File
@@ -891,6 +891,15 @@ def attach_media_to_note(note_id: int, media_ids: List[int], captions: List[str]
db.rollback()
raise
# Feeds and pages show the photos: refresh caches and tell WebSub (v2.10.1)
try:
from starpunk.notes import _websub_changed, get_note
note = get_note(id=note_id, load_content=False)
if note is not None:
_websub_changed(note, was_public=note.published)
except Exception as e:
current_app.logger.warning(f"Failed to queue WebSub update for note {note_id}: {e}")
def get_note_media(note_id: int) -> List[Dict]:
"""