---
title: Tip: give database MCP servers a read-only database role. Don't trust the tool's 'read_only' switch | ctxsec
url: https://ctxsec.com/items/tip-database-mcp-enforce-read-only-with-db-role-not-tool-flag
description: "CVE-2026-126196 showed a Postgres MCP server's read_only mode could be talked past with ordinary SQL when the underlying role could write. Enforce read-only where the database enforces it."
status: "guidance based on pgEdge advisory GHSA-j7mp-839j-jrm7 (CVE-2026-126196)"
published: 2026-11-14
---

> CVE-2026-126196 showed a Postgres MCP server's read_only mode could be talked past with ordinary SQL when the underlying role could write. Enforce read-only where the database enforces it.

[← Tips & Guides](/tips) · [markdown](/items/tip-database-mcp-enforce-read-only-with-db-role-not-tool-flag.md)

guidance based on pgEdge advisory GHSA-j7mp-839j-jrm7 (CVE-2026-126196)

2026-11-14 11:40 AM ET

### Tip: give database MCP servers a read-only database role. Don't trust the tool's 'read_only' switch

- Create a dedicated role for agent connections with only SELECT on the schemas it needs (or `pg_read_all_data`), no ownership and no CREATE.
- Set `default_transaction_read_only = on` for that role as a second layer, knowing a session can change it; the role's privileges are the real boundary.
- Point agents at a read replica where possible, so even a successful write attempt fails.
- Inventory database MCP servers in use and check their versions against advisories; log every agent-issued statement.

Sources: [pgEdge: GHSA-j7mp-839j-jrm7](https://github.com/pgEdge/pgedge-postgres-mcp/security/advisories/GHSA-j7mp-839j-jrm7) · [PostgreSQL docs: predefined roles (pg_read_all_data)](https://www.postgresql.org/docs/current/predefined-roles.html)
