postgres-rls

Validate PostgreSQL Row Level Security policies for multi-tenant data isolation.

10|Updated Jan 7, 2026
One-click install
npx skills add https://github.com/troykelly/codex-skills --skill postgres-rls
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: postgres-rls
Source: https://github.com/troykelly/codex-skills/tree/main/skills/postgres-rls
Command: npx skills add https://github.com/troykelly/codex-skills --skill postgres-rls

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill ensures robust data isolation and prevents critical security vulnerabilities in multi-tenant PostgreSQL databases by enforcing Row Level Security (RLS) best practices.

Core Features & Use Cases

  • RLS Policy Enforcement: Verifies correct implementation of RLS policies to prevent data leaks between tenants.
  • Vulnerability Detection: Identifies common bypasses such as superuser access, table owner privileges, and incorrect USING/WITH CHECK clauses.
  • Use Case: When modifying database schemas or policies related to tenant data, this Skill acts as a mandatory security gate, guaranteeing that RLS is correctly configured and cannot be easily bypassed.

Quick Start

Apply the postgres-rls skill to verify Row Level Security implementation for tenant isolation.

Frequently Asked Questions about postgres-rls

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

FAQPage Schema
How do I prevent PostgreSQL Row Level Security bypass by superusers and table owners?

PostgreSQL Row Level Security bypass occurs when superusers or table owners access tenant data directly. This Skill validates RLS policies to detect and prevent these privilege escalations, ensuring strict multi-tenant data isolation by enforcing correct user role configurations.

What is PostgreSQL Row Level Security and when do I need it for multi-tenant data isolation?

PostgreSQL Row Level Security is a database policy mechanism that restricts row access based on user roles. You need it for multi-tenant data isolation to prevent tenant data leakage and enforce strict access controls at the database layer.

How do I validate PostgreSQL RLS policies to fix USING and WITH CHECK clause mismatches?

Validating PostgreSQL RLS policies requires checking USING and WITH CHECK clauses to ensure they match for consistent data access and modification. This Skill identifies these mismatches to prevent context leakage and enforce proper tenant isolation.

Does PostgreSQL Row Level Security work with database views without leaking tenant context?

PostgreSQL Row Level Security can be bypassed through views if not configured correctly. This Skill identifies view bypass vulnerabilities and provides guidance to secure multi-tenant data isolation, ensuring RLS policies enforce consistently across all access paths.

What's the best way to test PostgreSQL RLS policies for multi-tenant isolation?

Testing PostgreSQL RLS policies involves verifying tenant data isolation across various access scenarios. This Skill provides testing strategies and performance optimization guidance to ensure policies enforce correctly without degrading database query performance.

Can I use PostgreSQL RLS policies to secure existing multi-tenant database schemas?

You can secure existing multi-tenant PostgreSQL schemas by applying RLS policies using migration patterns. This Skill guides you through schema modifications and policy enforcement to add tenant data isolation without disrupting current operations.