Inbox: intake and verified processing of follows (phase 2, step 4)
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 14s
CI / test (push) Successful in 1m57s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 14s
CI / test (push) Successful in 1m57s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
Intake (in the request, no network): size, content type and shape checks, blocked domains refused (403), duplicates acknowledged once, then stored and answered 202. Processing (federation.inbox worker task): - verify the HTTP signature with either scheme, as of when it arrived, using the cached key and refreshing the sender once on failure (key rotation); a deleted account's Delete still verifies from cache - the signer must be the activity's actor and the activity id must be on the actor's host - handlers: Follow (accept, or pending with manual approval; repeat follows re-accepted; blocked accounts rejected), Undo of a Follow (only by the same actor), Delete of an actor, Update of an actor; anything else recorded - items being processed are marked, retried on transient failures, re-queued if a worker dies, and pruned after 30 days Outgoing Accept/Reject/Block activities are stored with stable ids and queued per inbox for the delivery task (next step). Public activities are fetchable at /activities/<uuid>. Metrics for inbox activities and signature checks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
This commit is contained in:
1 parent
c1a7dd0877
commit
f312c4b577
15 files changed
+1147
-60
No files matched your search
@@ -7,6 +7,14 @@ TAG = "ActivityPub"
|
||||
|
||||
_AP = {"application/activity+json": {"schema": {"type": "object"}}}
|
||||
_NOT_FOUND = {"description": "Unknown, or not sharing (the two are indistinguishable)"}
|
||||
_INBOX_RESPONSES = {
|
||||
"202": {"description": "Accepted for processing (also for a repeated activity)"},
|
||||
"400": {"description": "Not an activity with an id, type and actor"},
|
||||
"403": {"description": "The sender's domain is blocked"},
|
||||
"404": {"description": "No such user sharing (user inbox)"},
|
||||
"413": {"description": "Larger than 256 KB"},
|
||||
"415": {"description": "Not ActivityPub JSON"},
|
||||
}
|
||||
_USERNAME = {"name": "username", "in": "path", "required": True, "schema": {"type": "string"}}
|
||||
|
||||
# endpoint -> (method, summary, description, extra parameters, responses)
|
||||
@@ -120,20 +128,27 @@ _OPERATIONS = {
|
||||
"federation.user_inbox": (
|
||||
"post",
|
||||
"User inbox",
|
||||
"Receives activities for one user (signed deliveries).",
|
||||
"Receives signed activities for one user. They're stored and answered with 202, then "
|
||||
"verified and processed in the background.",
|
||||
[_USERNAME],
|
||||
{
|
||||
"202": {"description": "Accepted"},
|
||||
"404": _NOT_FOUND,
|
||||
"413": {"description": "Too large"},
|
||||
},
|
||||
_INBOX_RESPONSES,
|
||||
),
|
||||
"federation.shared_inbox": (
|
||||
"post",
|
||||
"Shared inbox",
|
||||
"Receives activities for any user on this server.",
|
||||
"Receives signed activities for any user on this server (as for the user inbox).",
|
||||
[],
|
||||
{"202": {"description": "Accepted"}, "413": {"description": "Too large"}},
|
||||
_INBOX_RESPONSES,
|
||||
),
|
||||
"federation.activity": (
|
||||
"get",
|
||||
"Activity",
|
||||
"One of our activities, when public. Replies to follows aren't public.",
|
||||
[{"name": "activity_uuid", "in": "path", "required": True, "schema": {"type": "string"}}],
|
||||
{
|
||||
"200": {"description": "Activity", "content": _AP},
|
||||
"404": {"description": "Not found or not public"},
|
||||
},
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user