Obstruct EXTRACT() field name deparse injection (CVE-2026-15741) - #1792
Obstruct EXTRACT() field name deparse injection (CVE-2026-15741)#1792xuhuicai wants to merge 1 commit into
Conversation
The parser accepts any string literal as the field name of an EXTRACT() call, deferring validation to execution. get_func_sql_syntax() appended such a field name to the deparsed output without quoting it, so a stored call with an unusual field name (whitespace, quotes, crafted text) changed meaning when deparsed by pg_dump, breaking the restored object or injecting unintended SQL. Fix by wrapping the deparsed field name in quote_identifier(). Upstream commit f9729b5078d (PostgreSQL 18.6, 2026-08-13); applies as-is because this tree's copy of ruleutils.c matches the upstream snapshot. Part of the 2026-08-13 upstream security batch tracked in IvorySQL#1767. Testing: core regression suite (249/249) and a deparse round-trip check (EXTRACT('weird field name' FROM ...) now renders as EXTRACT("weird field name" FROM ...)).
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe EXTRACT deparsing path now quotes field names with ChangesEXTRACT deparsing
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to The change safely quotes unusual EXTRACT() field names during deparsing to preserve correct SQL meaning on restore; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Port the CVE-2026-15741 fix (PostgreSQL 18.6, 2026-08-13 security release) to IvorySQL master. Closes #1791.
Upstream commit f9729b5078d ported verbatim ("Obstruct EXTRACT()
field name deparse injection").
Summary: the parser accepts any string literal as an EXTRACT() field
name; get_func_sql_syntax() deparsed it without quoting, so unusual
field names changed meaning on pg_dump restore or injected unintended
SQL. The fix quotes the field name with quote_identifier().
Notes:
changes needed.
EXTRACT("weird field name" FROM ...).
Assisted-by: Cursor
Summary by CodeRabbit
EXTRACTexpressions by correctly quoting date/time field names.IS ... NORMALIZEDexpressions.