feat: tenant isolation Phase 4 — RLS on all remaining tables #136
Reference in New Issue
Block a user
Delete Branch "feat/tenant-isolation-phase-4"
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
Completes RLS coverage across the entire schema — after this PR every table with
account_idhas a policy enforced.b3c7e9f2a1d8)platform_steps,template_trees— own rows ORPLATFORM_ACCOUNT_IDso global content is readable by all tenantsaccounts(IS the root table, noaccount_idcolumn),plan_feature_defaults(platform config, noaccount_id)Also fixes a pre-existing bug:
script_builder_service.create_session()was missingaccount_id=on theScriptBuilderSessionconstructor, causingNOT NULLviolations and 500s on all script builder endpoints.Tables covered
Standard policy:
users,account_invites,account_limit_overrides,account_feature_overrides,subscriptions,ai_chat_sessions,ai_conversations,ai_session_steps,ai_session_embeddings,ai_suggestions,ai_usage,assistant_chats,attachments,copilot_conversations,feedback,file_uploads,fork_points,kb_imports,notifications,notification_configs,notification_logs,psa_activity_logs,psa_member_mappings,script_builder_sessions,script_categories,session_ratings,tree_embeddings,user_folders,user_pinned_treesPlatform-visibility policy:
platform_steps,template_treesTest plan
users,script_builder_sessions,ai_session_steps,notifications,platform_steps,template_treesplatform_stepsandtemplate_treestests verify global content IS visible to tenantsalembic upgrade headon clean DB applies cleanlytest_script_builder.py— 500s on session create should now be fixed🤖 Generated with Claude Code
🚅 Deployed to the resolutionflow-pr-136 environment in selfless-grace