RBAC-7: DESIGN Forgejo-identity -> per-app postgres role/RLS (design only) #55
No reviewers
Labels
No labels
bug
discussion
duplicate
enhancement
goal
help wanted
horizon:backlog
horizon:governance
horizon:mvp
invalid
operator-decision
question
roadmap
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
open-platform/mitosis!55
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/rbac-7-postgres-rls-design"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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