multi-tenant-safety-checker

Enforce tenant isolation in PostgreSQL with RLS and Prisma.

5|Updated Dec 31, 2025
One-click install
npx skills add https://github.com/patricio0312rev/skillset --skill multi-tenant-safety-checker-patricio0312rev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multi-tenant-safety-checker
Source: https://github.com/patricio0312rev/skillset/tree/main/templates/db-management/multi-tenant-safety-checker
Command: npx skills add https://github.com/patricio0312rev/skillset --skill multi-tenant-safety-checker-patricio0312rev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @prisma/client, and includes scripts (resource) components.

What problem does it solve?

Tenant data leakage in multi-tenant apps due to insufficient isolation and misconfigured policies. This Skill provides automated checks and guidance to enforce strict isolation at both the query and policy levels.

Core Features & Use Cases

  • Implements Row Level Security (RLS) policies across database tables to ensure tenant isolation.
  • Includes an application-level tenant context and middleware to consistently apply tenant filters.
  • Provides automated tests, audit scripts, and best-practice guidance for secure multi-tenant deployments.

Quick Start

Run the multi-tenant safety checker to validate RLS configurations and audit tenant isolation.

Frequently Asked Questions about multi-tenant-safety-checker

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I enforce tenant isolation in a multi-tenant PostgreSQL app using Prisma?

Enforce tenant isolation by implementing Row Level Security policies across database tables and applying application-level tenant context middleware. This ensures strict query-level filtering and prevents data leakage between tenants in multi-tenant SaaS architectures.

What is Row Level Security and when do I need it for tenant isolation?

Row Level Security is a PostgreSQL feature that restricts data access at the row level based on tenant context policies. You need it when building multi-tenant SaaS applications to prevent data leakage caused by insufficient tenant isolation or misconfigured query filters.

How do I audit RLS policies and test for tenant data leakage?

Audit RLS policies by running automated security test scripts that validate tenant isolation configurations. The regression test suite checks database-level RLS enforcement and application-level tenant context to identify any data leakage vulnerabilities across tenants.

Does Prisma support Row Level Security for multi-tenant PostgreSQL databases?

Prisma works with PostgreSQL Row Level Security by combining database-level RLS policies with application-level tenant context middleware. This integration ensures that tenant filters are consistently applied to queries, maintaining strict isolation in multi-tenant environments.

What's the best way to set up tenant context middleware for multi-tenant isolation?

Set up tenant context middleware at the application level to consistently apply tenant filters before queries reach the database. Combine this with PostgreSQL RLS policies and composite indexing guidance to enforce strict tenant isolation and prevent data leakage.

Why does tenant data leak even when I filter queries by tenant ID?

Tenant data leaks when application-level query filters are inconsistent or misconfigured. Enforcing tenant isolation requires both database-level Row Level Security policies and application-level tenant context middleware to guarantee strict filtering and prevent leakage.