fix: multiple federation peering bugs

1. queueOutboxEvent no longer creates pending peer placeholders when
   autoAcceptPeering is disabled — prevents bypassing the admin's
   peering control

2. Approval endpoint checks for 202 before response.ok — when the
   remote also has autoAcceptPeering off, sets peer to awaiting_approval
   instead of incorrectly activating it

3. awaiting_approval status added to Federation panel UI — status label,
   colors, filter options so these peers are visible and manageable
This commit is contained in:
Jannis Braun
2026-04-20 17:54:00 +02:00
parent b40c57f227
commit 072858cbbb
3 changed files with 36 additions and 4 deletions
@@ -152,12 +152,23 @@ export function queueOutboxEvent(
: peers;
// For targeted origins with no existing peer record, create pending placeholders
// (only when autoAcceptPeering is enabled — otherwise the admin controls all peering)
if (targetPeerOrigins) {
const autoAcceptSettings = db
.select({ autoAcceptPeering: schema.instanceSettings.autoAcceptPeering })
.from(schema.instanceSettings)
.where(eq(schema.instanceSettings.id, 1))
.get();
const autoAcceptPeering = (autoAcceptSettings?.autoAcceptPeering ?? 1) === 1;
const matchedOrigins = new Set(matchedPeers.map(p => p.origin));
for (const origin of targetPeerOrigins) {
if (matchedOrigins.has(origin)) continue;
// Don't auto-create placeholders when autoAcceptPeering is off
if (!autoAcceptPeering) continue;
// Check if there's a rejected/revoked peer we should skip
const existingPeer = db
.select({ status: schema.federationPeers.status })