Safe outbound HTTP and remote actors (phase 2, step 2)
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 10s
CI / test (push) Successful in 1m22s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
CI / validate-monitoring (push) Successful in 7s
CI / lint (push) Successful in 10s
CI / test (push) Successful in 1m22s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 5s
- 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
This commit is contained in:
1 parent
a6d3fb6c93
commit
52b9f0b27b
10 files changed
+823
-3
No files matched your search
@@ -0,0 +1,50 @@
|
||||
"""federation remote actors
|
||||
|
||||
Revision ID: 211d4743f081
|
||||
Revises: 34508576a6c7
|
||||
Create Date: 2026-09-25 21:17:31.469467
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = '211d4743f081'
|
||||
down_revision = '34508576a6c7'
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
||||
|
||||
def upgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('federation_remote_actors',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('uri', sa.String(length=2048), nullable=False),
|
||||
sa.Column('host', sa.String(length=255), nullable=False),
|
||||
sa.Column('inbox', sa.String(length=2048), nullable=False),
|
||||
sa.Column('shared_inbox', sa.String(length=2048), nullable=True),
|
||||
sa.Column('username', sa.String(length=255), nullable=True),
|
||||
sa.Column('display_name', sa.String(length=255), nullable=True),
|
||||
sa.Column('public_key_id', sa.String(length=2048), nullable=False),
|
||||
sa.Column('public_key_pem', sa.Text(), nullable=False),
|
||||
sa.Column('fetched_at', sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column('gone', sa.Boolean(), nullable=False),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('uri')
|
||||
)
|
||||
with op.batch_alter_table('federation_remote_actors', schema=None) as batch_op:
|
||||
batch_op.create_index(batch_op.f('ix_federation_remote_actors_host'), ['host'], unique=False)
|
||||
batch_op.create_index(batch_op.f('ix_federation_remote_actors_public_key_id'), ['public_key_id'], unique=False)
|
||||
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade():
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
with op.batch_alter_table('federation_remote_actors', schema=None) as batch_op:
|
||||
batch_op.drop_index(batch_op.f('ix_federation_remote_actors_public_key_id'))
|
||||
batch_op.drop_index(batch_op.f('ix_federation_remote_actors_host'))
|
||||
|
||||
op.drop_table('federation_remote_actors')
|
||||
# ### end Alembic commands ###
|
||||
Reference in new issue
Block a user