v2.5.2
pREST v2.5.2 fixes three advisories (stored-query RCE, unauthenticated catalog, plugin path traversal) and replaces pg.single with pg.allowed_databases.
Released: October 18, 2026
GitHub tag Β· Compare v2.5.1...v2.5.2
v2.5.2 is a security release. It fixes three advisories published against v2.5.1 and earlier (#1070). It also reworks how pREST picks which databases to serve when no registry is configured (#1068): pg.single is removed and pg.allowed_databases replaces it. MySQL README and sample config wording (#1062) and dependency bumps (#1067, #1071) ship in the same tag.
Docker:
prest/prest:v2.5.2(linux/amd64 and linux/arm64)Go install:
go install github.com/prest/prest/v2/cmd/prestd@v2.5.2
Security
Stored queries can no longer be written over REST (GHSA-2x9q-r7j9-g85f)
Critical, CVSS 9.0. Reported by arkmarta.
With database-backed queries (queries.storage = "database"), script bodies live in the prest_queries table. Before v2.5.2 nothing stopped the generic table routes from writing that table. With the default [access] restrict = false, one POST /{db}/public/prest_queries stored arbitrary SQL, and a second request to /_QUERIES/{location}/{name} ran it. When pREST connects as a PostgreSQL superuser (as the sample compose files do), that SQL can run OS commands through COPY ... FROM PROGRAM. The same routes could also read prest_users.
v2.5.2 adds a reserved table list. These names are matched case-insensitively, in any schema:
prest_queriesprest_usersthe configured
queries.tablethe configured
auth.table(PREST_AUTH_TABLE)
They are blocked on every data route, regardless of restrict, ignore_table, per-user rules, or whether auth and database-backed queries are enabled:
Any method on /{db}/{schema}/{reserved}, /batch/..., /show/...
401 {"error":"authorization required"}, even with an admin token
_join that targets a reserved table
400 {"error":"table is reserved for pREST internal use"}
MCP select_table / describe_table on a reserved table
JSON-RPC permission error
Manage stored queries through the /_QUERIES/registry API (admin-only). Manage users with SQL or prestd migrate. See Permissions β Reserved tables.
Catalog routes require auth (GHSA-fhf5-m388-4w4p)
High, CVSS 7.5. Reported by Hama1cco.
The catalog routes were registered outside every middleware stack. With auth.enabled = true, a caller with no token got 200 from /databases, /schemas, /tables, /{database}/{schema}, and /show/{database}/{schema}/{table}, while CRUD on the same tables correctly returned 401. On PostgreSQL, /databases read pg_database, so it listed every database on the server, including ones pREST was not configured to serve.
From v2.5.2 these routes run through authentication and table access control:
With
auth.enabled = true: no token is 401{"error":"authorization token is empty"}./showfollows[access]: withrestrict = true, a table not grantedreadis 401, as it is on CRUD. This applies with auth off too./databaseslists only served databases: registry aliases, orpg.databasepluspg.allowed_databases(#1068).
Only /auth, /_health, /_ready, and /_studio stay public. To re-expose a route on purpose, add it to [jwt] whitelist. See Auth β Routes that require auth.
Plugin names are confined to pluginpath (GHSA-fmr6-9j48-xrqp)
High, CVSS 8.1. Reported by T4ran24.
/_PLUGIN/{file}/{func} joined {file} onto pluginpath without a containment check, so a traversal such as ../../tmp/x loaded any .so file on disk. The route also had no authentication of its own.
From v2.5.2:
{file}must be letters, digits,_, or-, 1β63 characters, with no dots.{func}must be a Go identifier.The resolved path must stay inside
pluginpath, after symlinks are resolved. A symlinked.sothat points outside is rejected.An invalid name is 400
{"error": "invalid plugin name"}. The rejected name is not echoed. A missing library is still 404.With
auth.enabled = true,/_PLUGINrequires a token. With auth off the route stays open; only the path checks apply.The same name rules apply to
[[pluginmiddlewarelist]]file/funcvalues.
See Endpoint Plugin β Name rules and auth.
Multi-database (#1068)
Co-authored by @samithiwat. Most of the initial changes came from the brickstechnology/prest fork.
pg.single removed
pg.single and PREST_PG_SINGLE are ignored. Startup logs:
What changes:
A registry is no longer limited to
pg.database. Before, a registry withpg.single = true(the default) accepted only the default alias. Now a registry serves all of its aliases.Without a registry, only listed databases are served. Before,
pg.single = falselet any database on the[pg]host be reached by putting its name in the path. Now onlypg.databasepluspg.allowed_databasesare served. Any other name is 400database not registered: <name>./databasesand MCPprest.list_databaseslist only served databases.On MySQL without a registry,
{schema}must equal{database}. On MySQL a schema is a database, so this stops one served name from reading another database the login can see./{db}/{other}/...is 404schema not served by this database.
pg.allowed_databases
Extra databases on the [pg] host, using the [pg] credentials, served when no [[databases]] registry is configured. Works on PostgreSQL and MySQL.
See Multi-database β No-registry mode.
Unreachable registry entries
In v2.5.1 any [[databases]] entry that failed to connect at startup stopped the server. From v2.5.2:
A network or DNS failure registers the alias lazily. It answers 503
{"error":"database unavailable"}and reconnects on first use. The response does not include driver text such as host and port.Startup still fails on invalid config or auth errors, or when every entry is unreachable.
The default adapter is the first reachable alias.
/_readypings every alias, so it returns 503 while any one is down.Timescale detection and startup
migrate_on_startupsteps skip a lazy alias until the next restart.
Smaller changes
PostgreSQL keeps at most 64 distinct pools per process. A request that would open another gets 503.
Entries from
DATABASE_ALIAS_N/DATABASE_URL_Ninherit the globalmaxopenconn/maxidleconn. Before,0meant unlimited./databasesreturns aliases sorted.A connection or DNS failure is 503
database unavailableon CRUD,/_QUERIES/registry, and MCP./authreturns a generic 401{"error":"authentication failed"}when the user lookup hits a SQL or driver error.user not foundis unchanged.MySQL
/schemasin registry mode lists only the registry entries on the same host and port, not every database the login can see (#1070).prestd versionon ago installbuild reports the module version (for examplev2.5.2) instead of a hard-coded2.0.0. Builds with no version info reportdevel.The Kubernetes manifest image is
prest/prest:v2(wasv1).
Dependencies
golang.org/x/crypto0.57.0 β 0.58.0 (#1067).
Changes since v2.5.1
Security hardening: reserved tables, catalog and /show auth/ACL, /_PLUGIN confinement and auth
Multi-database fixups: pg.single removed, pg.allowed_databases, lazy 503 aliases, scoped /databases (co-authored by @samithiwat, from brickstechnology/prest)
README and sample config for MySQL
golang.org/x/crypto 0.58.0
Studio dependency updates
Full detail: compare v2.5.1...v2.5.2. Commit list: Changes since v2.5.1.
Upgrading from v2.5.1
Retag to
prest/prest:v2.5.2orgo install github.com/prest/prest/v2/cmd/prestd@v2.5.2.Check for reserved table names. If an application table is named
prest_usersorprest_queries, or matches yourauth.table/queries.table, rename it. REST,_join, and MCP can no longer reach it.Audit stored queries. If you ran
queries.storage = "database"on v2.5.1 or earlier without auth, look for rows you did not create, and delete them:Use your
queries.schema/queries.tableif you changed them. Do not trustcreated_by: a REST write could set it to any value. Read the SQL columns themselves.Use a least-privilege database role. Connect as a role without superuser,
pg_read_server_files, orpg_execute_server_program. A non-superuser role cannot runCOPY ... FROM PROGRAM, which limits what any stored-SQL bug can do.Give catalog clients a token. With
auth.enabled = true, anything that calls/databases,/schemas,/tables,/{database}/{schema},/show/..., or/_PLUGINwithout a token now gets401. Send a bearer token, or whitelist the route on purpose.Check plugin names. Rename
.sofiles whose basename contains a dot, and replace symlinks that resolve outsidepluginpath.Replace
pg.single. Use a[[databases]]registry, or list extra databases inpg.allowed_databases. Requests for any other database now get400.MySQL without a registry: paths where
{schema}differs from{database}now get404.If you skipped v2.4.2, check your
jwt.keylength. A short HMAC key does not stop startup; it disables/auth. See v2.4.2 β Upgrading.
Related
Last updated