postgres-mcp exists to be a security boundary: it hands a model a database and promises that read-only means read-only. That promise is the product, so a report that breaks it is the most valuable thing you can send us.
Read-only is enforced in three independent layers, plus a fourth you should add yourself:
- Backslash meta-commands are always rejected, in both modes.
\!runs a shell command on the host and never reaches the server, so no server-side control can cover it;\copyand\owrite local files. Any statement opening with\is refused before psql is invoked. - A statement gate (
postgres_mcp/guard.py) scrubs comments, string literals, quoted identifiers and dollar-quoted bodies, then requires every statement to open with one ofSELECT,WITH,EXPLAIN,SHOW,TABLEorVALUES, and scans for the write verbsINSERT,UPDATE,DELETE,MERGEandINTOso aWITH x AS (...) INSERT ...cannot hide behind an allowed opener. BEGIN READ ONLY(postgres_mcp/psql.py) wraps the statements, so PostgreSQL itself refuses a write even if the gate were fooled.
No tool accepts a read_only argument, so the calling model cannot escalate its
own privileges — the switch lives in configuration, not in the request.
The recommended fourth layer is a genuinely read-only PostgreSQL role (see the README), which is the only layer that does not depend on this server's correctness.
Report it if you find any of these:
- Any input that causes a write to reach a database configured read-only.
- Any way to execute a shell command or write a local file through a query.
- Any way to make the read-only decision loosen at runtime (a config value, environment variable, or request field that flips a database writable).
- Any leak of a configured password into process arguments, logs, or tool output.
These are by design, so please do not report them:
- Read-only mode refuses
SET, sosearch_pathcannot be changed; schema- qualify your tables or usedescribe_schema. - Read-only mode refuses row-locking reads (
SELECT ... FOR UPDATE/FOR SHARE), because a read-only transaction rejects them anyway. - Output is truncated by
max_rows(default 1000) and a ~100 KB byte ceiling; the trailer names the real total. - A column whose literal text is
[NULL]is ambiguous with a real SQL NULL.
Prefer GitHub's private vulnerability reporting for this repository over a
public issue, so a fix can land before the details are public. If you cannot
use that path, mahmoud.azmy@gmail.com is a fallback — but private advisories
are preferred.
This project is pre-1.0 with no tagged releases. The supported version is
main.