Public: anyone can read this; nobody can change it.
RBAC-7: DESIGN Forgejo-identity -> per-app postgres role/RLS (design only) #55
Check · Review · Land done · Live — Landed; nothing deploys from this branch, so this is the end of its path.
Design-only. Adds docs/design/forgejo-identity-to-postgres-rbac.md. Question: does the Postgres layer need per-Forgejo-team roles / RLS, given forwardAuth (RBAC-2) already gates the whole app at the edge and each app already gets its own fenced CNPG cluster?
shipped merged
Sign in to join this conversation.
new above
offline
RBAC-7 (roadmap #33): DESIGN Forgejo-identity → per-app Postgres role / RLS
Design-only. Adds
docs/design/forgejo-identity-to-postgres-rbac.md.Question: does the Postgres layer need per-Forgejo-team roles / RLS, given forwardAuth (RBAC-2) already gates the whole app at the edge and each app already gets its own fenced CNPG cluster?
Key move: separate the two things "Postgres RBAC" can mean —
mcp/src/server.ts:2312,:2345). No per-team role needed.If (B) is warranted, the doc specifies the buildable mapping: Forgejo team →
app_<team>role → RLSPOLICYoncurrent_setting(app.forgejo_team), bound per-transaction viaSET LOCALfrom the forwardAuth-verified identity; RLS policies live in the app's own migration (_app-template/src/migrate.ts),create_appstays out of it, better-auth tables areBYPASSRLS. Identity is already consistent end-to-end (better-auth id == Forgejosub,_app-template/src/auth.ts:181).Recommendation: DEFER for the single-client platform
Ship Option 1 (authorize in app code against the better-auth/forwardAuth identity). The edge already gates the app and the DB is already single-tenant; RLS would add a third gate for intra-app row authz the client has no requirement for, at real (stateful) build cost. Deferring is free — RLS is additive later with no schema debt.
Build RLS when: one app hosts mutually-distrusting tenants/teams over shared tables, OR a compliance rule demands DB-enforced row authz, OR the authz surface outgrows app code.
Closes #33.
🤖 Generated with Claude Code