Skip to content

feature (federation): peer registry application UI - #361

Open
klpoland wants to merge 14 commits into
masterfrom
feature-kpoland-federation-peer-registry
Open

klpoland wants to merge 14 commits into
masterfrom
feature-kpoland-federation-peer-registry

Conversation

@klpoland

@klpoland klpoland commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Note

High Risk
Touches federation trust boundaries (signed manifests, dynamic peers, mothership verify with outbound HTTPS) and new intake flows that gate who can join the mesh; misconfiguration could widen peer sets or break sync bootstrap.

Overview
Adds an end-to-end federation registry path: gateways advertise identity at /.well-known/sds-federation.json, the flagship host exposes logged-in registry intake (apply, one-time challenge token, domain verify, staff approve/reject, reissue/withdraw), and the federation sync service can pull a signed sites.json manifest, verify it with Ed25519, and merge registry peers with pinned federation.toml peers on a refresh loop (bootstrapping new peers and exposing GET /sync/api/v1/sites).

Gateway: new RegistryApplication model and UI under /users/federation/registry/ (404 on non-flagship hosts even if env says intake on). Verify fetches applicant well-known over HTTPS with DNS pinning / SSRF guards (local lab can use internal HTTP for same-FQDN). Well-known JSON can include registry_challenge from FEDERATION_REGISTRY_CHALLENGE_TOKEN plus optional registry URL/fingerprint fields. Settings add SDS_SITE_DISPLAY_NAME, flagship gating via FLAGSHIP_GATEWAY_HOST, and related federation env docs.

Federation: federation-add-peer --discover reads peer well-known; RegistryPolicy in config; site_registry handles signature, serial monotonicity, cache fallback, deny list, and runtime peer snapshots used across webhooks/bootstrap. cryptography added for manifest verification.

Docs/README and example env templates are updated for discover, registry verify, and intake flags.

Reviewed by Cursor Bugbot for commit 213dec8. Bugbot is set up for automated code reviews on this repo. Configure here.

@klpoland klpoland self-assigned this Oct 20, 2026
@klpoland klpoland added feature New feature or request gateway Gateway component federation Federation related work (sync service, document storage, peer configuration, etc.) labels Oct 20, 2026
@semanticdiff-com

semanticdiff-com Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  federation/sds_federation/services/bootstrap.py  25% smaller
  federation/sds_federation/services/peer_sync.py  17% smaller
  federation/sds_federation/routes/webhooks.py  13% smaller
  federation/sds_federation/models.py  5% smaller
  federation/README.md Unsupported file format
  federation/pyproject.toml Unsupported file format
  federation/scripts/add-peer.sh Unsupported file format
  federation/scripts/lib/discover_peer_well_known.py  0% smaller
  federation/sds_federation/main.py  0% smaller
  federation/sds_federation/routes/sites.py  0% smaller
  federation/sds_federation/schemas/registry.py  0% smaller
  federation/sds_federation/services/site_registry.py  0% smaller
  federation/templates/gateway-federation.env.tmpl Unsupported file format
  federation/tests/test_regression_schemas.py  0% smaller
  federation/tests/test_site_registry_merge.py  0% smaller
  federation/uv.lock Unsupported file format
  gateway/.envs/example/django.env Unsupported file format
  gateway/.envs/example/django.prod-example.env Unsupported file format
  gateway/README.md Unsupported file format
  gateway/config/settings/base.py  0% smaller
  gateway/config/settings/utils.py  0% smaller
  gateway/config/urls.py  0% smaller
  gateway/docs/federation-registry-verify.md Unsupported file format
  gateway/sds_gateway/api_methods/federation/registry_application_challenge.py  0% smaller
  gateway/sds_gateway/api_methods/federation/registry_application_review.py  0% smaller
  gateway/sds_gateway/api_methods/federation/registry_application_verify.py  0% smaller
  gateway/sds_gateway/api_methods/federation/registry_challenge.py  0% smaller
  gateway/sds_gateway/api_methods/federation/registry_verify_fetch.py  0% smaller
  gateway/sds_gateway/api_methods/federation/well_known.py  0% smaller
  gateway/sds_gateway/api_methods/migrations/0022_registry_application.py  0% smaller
  gateway/sds_gateway/api_methods/migrations/0023_registry_application_service_urls_charfield.py  0% smaller
  gateway/sds_gateway/api_methods/migrations/max_migration.txt Unsupported file format
  gateway/sds_gateway/api_methods/models.py  0% smaller
  gateway/sds_gateway/api_methods/tests/test_federation_well_known.py  0% smaller
  gateway/sds_gateway/api_methods/tests/test_registry_application_challenge.py  0% smaller
  gateway/sds_gateway/api_methods/tests/test_registry_application_review.py  0% smaller
  gateway/sds_gateway/api_methods/tests/test_registry_application_verify.py  0% smaller
  gateway/sds_gateway/api_methods/tests/test_registry_challenge.py  0% smaller
  gateway/sds_gateway/api_methods/tests/test_registry_verify_fetch.py  0% smaller
  gateway/sds_gateway/api_methods/views/federation_well_known.py  0% smaller
  gateway/sds_gateway/templates/base.html  0% smaller
  gateway/sds_gateway/templates/users/partials/registry_application_modal.html  0% smaller
  gateway/sds_gateway/templates/users/registry_application_detail.html Unsupported file format
  gateway/sds_gateway/templates/users/registry_application_list.html  0% smaller
  gateway/sds_gateway/users/context_processors.py  0% smaller
  gateway/sds_gateway/users/forms.py  0% smaller
  gateway/sds_gateway/users/mixins.py  0% smaller
  gateway/sds_gateway/users/tests/test_federation_registry_intake_settings.py  0% smaller
  gateway/sds_gateway/users/tests/test_registry_application_form.py  0% smaller
  gateway/sds_gateway/users/tests/test_registry_application_intake_gate.py  0% smaller
  gateway/sds_gateway/users/tests/test_registry_application_staff_review.py  0% smaller
  gateway/sds_gateway/users/urls.py  0% smaller
  gateway/sds_gateway/users/views/__init__.py  0% smaller
  gateway/sds_gateway/users/views/registry_application.py  0% smaller

@klpoland
klpoland marked this pull request as ready for review October 20, 2026 19:46

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread federation/sds_federation/main.py Resolved

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

Comment thread federation/scripts/add-peer.sh Resolved
@klpoland
klpoland force-pushed the feature-kpoland-federation-peer-registry branch from 372beda to 71c3e32 Compare October 21, 2026 15:51

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@klpoland
klpoland requested a review from mjcurran October 21, 2026 16:29

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

There are 3 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4329ab5. Configure here.

Comment thread gateway/.envs/example/django.env Resolved

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request federation Federation related work (sync service, document storage, peer configuration, etc.) gateway Gateway component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants