feat: Phase 2 tenant isolation — RLS on 11 session tables #134
Reference in New Issue
Block a user
Delete Branch "feat/tenant-isolation-phase-2"
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?
Summary
account_id NOT NULLwrite-path bugs onsession_supporting_data,session_resolution_outputs,maintenance_schedules, andpsa_post_log(3 write paths acrosspsa_documentation_service.pyandsessions.py)access_shareendpoint switched toget_admin_db(BYPASSRLS) to handle cross-tenant session reads for public share links without leaking data to app-role queries70a5dd746e83— enablesFORCE ROW LEVEL SECURITYon 11 tables; 10 with standard tenant-only policy,step_librarywith visibility-aware policy (OR visibility = 'public') to preserve cross-tenant public step accessstep_librarypublic-visibility regression testTables covered
sessions,ai_sessions,session_branches,session_supporting_data,session_resolution_outputs,session_handoffs,maintenance_schedules,psa_post_log,script_templates,script_generations,script_categories,step_libraryWhat's next (Phase 3)
account_idonaudit_logs,step_ratings,step_usage_logs,target_list_itemsaccount_idcolumn totree_nodes,session_notes,session_node_states,user_invites— then enable RLSusers/subscriptions(requires embeddingaccount_idin JWT)Test plan
alembic upgrade head— verify Phase 2 migration applies cleanly on top of Phase 1pytest tests/test_rls_isolation.py -v(requires running PostgreSQL with RLS-configured roles)access_share→get_admin_dbchange🤖 Generated with Claude Code
🚅 Deployed to the resolutionflow-pr-134 environment in selfless-grace