mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-22 21:11:14 +00:00
fix(db): let a plugin call only an allowlist of Postgres's catalog functions
The plugin SQL guard refused functions by name, so every function that reads the catalogs or the server and was not listed passed: obj_description, col_description and shobj_description returned the comments on TREK's tables, columns, database and roles by OID, format_type named a type by its OID, and version(), current_database(), inet_server_addr() and the session keywords described the server. A call to a pg_catalog function is now refused unless the function is on PLUGIN_FUNCTIONS (string, number, date and time, JSON, array, aggregate, window, UUID, range, geometry, network and text search functions), in either spelling of a call, f(...) and the column notation (x).f. The catalog's function names of Postgres 14 to 18 are kept in assets/postgres/catalog-functions.txt, and PGPLUG-021 fails on the lane when the server has a function that list does not name, so a new major cannot widen what a plugin may call. The session keywords current_user, session_user, current_role, user, system_user, current_catalog and current_schema are refused unquoted.
This commit is contained in: