pgsql: Check EXECUTE privilege on type-to-json cast functions.
pgsql: Check EXECUTE privilege on type-to-json cast functions.
От:
Noah Misch <noah@leadboat.com>
Дата:
Check EXECUTE privilege on type-to-json cast functions. When converting a value to json or jsonb, to_json() and its many friends execute the cast function without first checking for EXECUTE privileges. To fix, check privileges and invoke the object access hook before calling the cast function. This covers to_json(), to_jsonb(), row_to_json(), array_to_json(), the json[b]_build_*() and *_agg() functions, the SQL/JSON constructors (v16 and later), and COPY TO with FORMAT json (v19 and later). Reported-by: Filip Janus Reported-by: Anthropic OSS program Author: Nathan Bossart Co-authored-by: Anthropic OSS program Reviewed-by: Andrew Dunstan Security: CVE-2026-116303 Backpatch-through: 14 Branch ------ REL_14_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/d275f6accdb80dd2afa0fc7eb8eaf1eb585120e9 Author: Nathan Bossart Modified Files -------------- src/backend/utils/adt/json.c | 8 ++++++++ src/backend/utils/adt/jsonb.c | 10 ++++++++++ src/test/regress/expected/privileges.out | 21 +++++++++++++++++++++ src/test/regress/sql/privileges.sql | 15 +++++++++++++++ 4 files changed, 54 insertions(+)