Framework-agnostic linter and testing toolkit for Postgres Row-Level Security.
Project description
pgrls
Framework-agnostic linter and testing toolkit for Postgres Row-Level Security.
Status: 0.0.1 — first lint rule (SEC001) shipped. The full rule catalog and the
test/diffcommands are on the roadmap below.
Install
pip install pgrls
Requires Python 3.11+.
Usage
Point pgrls at any Postgres database:
export DATABASE_URL="postgres://user:pass@host:5432/db"
pgrls lint
Or pass the URL directly:
pgrls lint --database-url "postgres://user:pass@host:5432/db"
Limit the scan to specific schemas:
pgrls lint --schemas public,tenant
Point at a non-default config file, or pick an output format:
pgrls lint --config ./config/pgrls.toml --format text
Example output
ERROR SEC001 public.users
Table public.users does not have row-level security enabled.
Add ENABLE ROW LEVEL SECURITY or include the table in
[lint.rules.SEC001].allowlist if it is a public reference table.
pgrls: 1 error.
Exit code is 1 when any violation meets or exceeds fail_on (default warning).
Configuration
Drop a pgrls.toml next to your project. See pgrls.example.toml in the repo for a fully commented version.
[database]
url = "$DATABASE_URL"
schemas = ["public"]
[lint]
disable = []
fail_on = "warning"
[lint.rules.SEC001]
allowlist = ["countries", "currencies"]
Roadmap
- More lint rules. Full SEC / PERF / HYG catalog, including the marquee SEC004 (inverted auth check / Lovable CVE pattern). JSON, SARIF, and Markdown output. Polished error messages.
pgrls test. Code-first RLS test DSL for Python, TypeScript, and Go.pgrls diff. Semantic policy diff between branches with DANGEROUS / BREAKING / SAFE classification.
License
MIT — see LICENSE.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pgrls-0.0.2.tar.gz.
File metadata
- Download URL: pgrls-0.0.2.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c38146eb27d496557608513e88e0fe9f845a8345ca40c0e3994715cee6003989
|
|
| MD5 |
69789d73df337601af69d294a70493ba
|
|
| BLAKE2b-256 |
bba8b78eaacb5b9cb6959190f413eddb5cf9ec939ba8adecf8080bf7e04ee047
|
File details
Details for the file pgrls-0.0.2-py3-none-any.whl.
File metadata
- Download URL: pgrls-0.0.2-py3-none-any.whl
- Upload date:
- Size: 13.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d678eb9e49826fa308a84b1e8f3200215aa206f606f4e41b64b060beead85355
|
|
| MD5 |
aa2a6b70c4cf5a3658f2d4483b8f9eac
|
|
| BLAKE2b-256 |
1d0651c7daea348ab44a55ec44cf3ca2beaa57f1a05c7be030eb5b5691e3dc92
|