Reject more unsafe names in extension script substitutions.

Commit cd5f2a3570 rejected schema and owner names containing
quotes, backslashes, and dollar signs, but names containing
newlines, carriage returns, comment delimiters, or the substitution
tokens themselves can still achieve SQL injection.  To fix, reject
those names, too.

Reported-by: Anthropic OSS program
Reported-by: Sven Klemm <[email protected]>
Reported-by: Aaron Chen <[email protected]>
Author: Nathan Bossart <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Reviewed-by: Greg Burd <[email protected]>
Security: CVE-2026-120153
Backpatch-through: 14

Branch
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/bc146a3d5bf8269c85a2fbac17512cb598ec8de1
Author: Nathan Bossart <[email protected]>

Modified Files
--------------
src/backend/commands/extension.c                   | 84 ++++++++++++++++------
.../test_extensions/expected/test_extensions.out   | 23 ++++++
.../test_extensions/sql/test_extensions.sql        | 16 +++++
3 files changed, 103 insertions(+), 20 deletions(-)

Reply via email to