NekoArch • Identity & RLS Flow

Caller JWT identity propagation to Postgres RLS
⚠️ Anti-Pattern Mode: Duplicating authorization logic in API code introduces drift, bypass risks, and maintenance friction. NekoArch offloads decision making to Postgres RLS using the caller's JWT context.
ZONE 1: BROWSER HTTP REQUEST Header Bearer Auth Bearer <JWT> ZONE 2: API PROCESS (FASTIFY) authenticate() Extract JWT from header consumeQuota() App-level rate limit repository(token) Bind client with caller JWT rpc('scene_read') Pass payload + caller context ZONE 3: SUPABASE / POSTGRES RLS POLICY GATE auth.uid() = scene.owner_id ACTIVE: Per-query check ROW RETURNED (200 OK) Caller matches auth.uid() ROW HIDDEN / BLOCKED PG 42501 ➔ HTTP 403 Forbidden ANTI-PATTERN SERVICE-ROLE KEY Bypasses Postgres RLS ✖ NOT USED JWT Header JWT Scope Carry Same JWT as client PASS DENY/42501 Global Service Key Bypass
CODE INSPECTOR • Select any node to view NekoArch implementation
// Click any node in the diagram above to inspect how identity propagates
// from Fastify HTTP headers into Postgres Row Level Security policies.