New tables on the federation migration branch: followers (pending or
accepted, with the Follow activity), per-user blocks, the inbox queue
(raw deliveries awaiting verification, deduplicated by activity id),
our outgoing activities, and deliveries (per inbox, with retry state).
Inbox URLs are capped at 1024 characters (remote actors are validated
against it) so the delivery unique index stays within Postgres's btree
limit; the remote actor inbox columns shrink to match.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- net.py: the only client federation uses, on httpcore (BSD-3-Clause)
with a guarded network backend: https only, every resolved address
must be public (private, loopback, link-local, CGNAT, multicast and
IPv4-mapped forms refused), and the connection goes to the checked
address; 3 redirects max (GET only), 1 MB cap, 10s/20s timeouts
- outbound.py: signed GETs (instance actor, so authorized-fetch servers
answer) and signed POSTs (as the user), trying the configured
signature schemes in order and the next only on a 401
- remote.py + federation_remote_actors: fetch, validate (id matches
URL and host, actor type, inbox on its host, key owned by the actor),
cache for 24h, refresh on demand, 410 marks an actor gone; resolve a
key id to its actor, including standalone key documents
- Config: FEDERATION_SIGNATURE_SCHEMES, FEDERATION_BLOCKED_DOMAINS,
FEDERATION_DELIVERY_CONCURRENCY, and FEDERATION_INSECURE_TESTING
(http and private addresses; only allowed for .test domains)
- Tests against a real local HTTP server, including verifying that our
fetches carry a valid signature
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
- federation_settings (per user; off, followers-only, not discoverable
by default) and federation_keys (RSA-2048; NULL user = instance
actor), on the federation migration branch
- Private keys encrypted at rest with Fernet, keyed by HKDF-SHA256 from
FEDERATION_KEY_SECRET (now required, 32+ chars, never printed)
- Keys are created when a user first enables sharing and never
regenerated; sharing.shared_user() treats unknown and non-sharing
users identically
- One flask-smorest Api per app (get_api(app)), so apps with and
without federation never share an OpenAPI spec
- Test fixtures for a second, federation-enabled app on the same DB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW