row-level-security

Manage PostgreSQL Row-Level Security policies and security-barrier view configurations.

Updated Jun 1, 2026
One-click install
npx skills add https://github.com/matejformanek/postgres-claude --skill row-level-security-matejformanek
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: row-level-security
Source: https://github.com/matejformanek/postgres-claude/tree/main/.claude/skills/row-level-security
Command: npx skills add https://github.com/matejformanek/postgres-claude --skill row-level-security-matejformanek

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the complexity of implementing and debugging PostgreSQL Row-Level Security (RLS) and security-barrier views, ensuring that sensitive data remains protected from unauthorized access and preventing potential information leakage through query planning.

Core Features & Use Cases

  • Policy Management: Provides authoritative guidance on creating, auditing, and debugging RLS policies, including the nuances of PERMISSIVE vs RESTRICTIVE rules.
  • Security Barrier Analysis: Explains how to safely use security-barrier views and the leakproof function attribute to prevent the planner from leaking data through untrusted qualifications.
  • Use Case: Use this skill to troubleshoot why a specific RLS policy is not firing for a table owner or to verify if a custom function is safe to mark as LEAKPROOF for use in security-sensitive queries.

Quick Start

Use the row-level-security skill to audit the current RLS policy configuration and verify if the leakproof status of my custom functions is correctly applied.

Frequently Asked Questions about row-level-security

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

FAQPage Schema
How do I prevent data leakage through the PostgreSQL query planner when using Row-Level Security?

PostgreSQL data leakage during query planning is prevented by using security-barrier views and leakproof functions, which stop the planner from reordering untrusted qualifications and exposing protected rows. This skill audits those configurations to ensure sensitive data remains secure.

Why is my PostgreSQL RLS policy not firing for the table owner?

PostgreSQL RLS policies often do not fire for table owners due to default role hierarchy configurations, requiring specific policy debugging and permission audits to ensure correct application across complex user roles. This skill troubleshoots these exact permission and policy conflicts.

What is the difference between PERMISSIVE and RESTRICTIVE rules in PostgreSQL Row-Level Security policies?

PERMISSIVE and RESTRICTIVE rules in PostgreSQL Row-Level Security manage policy application by combining multiple permissive rules with restrictive filters, ensuring users only access authorized data. This skill provides authoritative guidance on creating and auditing these nuanced policy combinations.

How do I verify if a custom function is safe to mark as LEAKPROOF for security-sensitive queries?

To verify a custom function is safe to mark as LEAKPROOF, you must validate its attributes against untrusted qualifications to ensure it cannot leak data during query planning. This skill performs the necessary leakproof function validation for security-sensitive environments.

How do I audit PostgreSQL security-barrier view configurations to stop the planner from reordering qualifications?

Auditing PostgreSQL security-barrier view configurations involves analyzing rewriter logic extensions and view settings to prevent the planner from pushing untrusted qualifications past security barriers. This skill manages the configuration and debugging of these barrier views.