safegres

Safe and fast Postgres. Graded.

safegres is a static analyzer for a live PostgreSQL database. It reads the system catalog and parses every policy predicate and function body into an AST, then answers two questions the catalog already contains the answers to — who can actually reach this row, and what does checking that cost per row — and scores them on two independent axes.

Two Scores, Never Mixed

34 security checks and 11 performance checks, graded separately

Built for CI

Gates every pull request on only what that change introduces

Read-Only

No agent, no traffic, nothing executed or written

safegres Features

Know who can reach every row, and what it costs

Effective Access, Not Settings

Follows privileges through PUBLIC, role inheritance, schema usage, views and SECURITY DEFINER functions to show what each role can actually reach.

Policies Parsed as ASTs

Every USING and WITH CHECK expression is parsed with the real PostgreSQL grammar, so risky policies are found by structure, not by regex.

Performance on Its Own Axis

Finds policy predicates no index can serve, per-row function calls and missing foreign-key indexes, scored apart from security.

Deterministic Grades

No AI judge. The same database always gets the same score, grade, severity counts and per-rule deductions.

Works With Your Stack

Presets for Supabase, PostgREST, Hasura, Graphile and Constructive, and it runs on any Postgres.

Reports Everywhere

Summaries, Markdown, JSON and SARIF, plus GitHub job summaries, annotations and a sticky PR comment.

Two Scores in One Command

Point safegres at any Postgres database with the standard libpq environment. doctor checks the connection; audit prints a security score and a performance score from the catalog.

A Gate on Every Pull Request

Apply your schema with whatever already builds it, then audit. Fail below a grade, and fail only on performance findings that are new against your baseline.