From 9bc62ddd5f0581998730d763390f5412fba8336b Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 21 May 2006 20:11:25 +0000 Subject: Add a new GUC parameter backslash_quote, which determines whether the SQL parser will allow "\'" to be used to represent a literal quote mark. The "\'" representation has been deprecated for some time in favor of the SQL-standard representation "''" (two single quote marks), but it has been used often enough that just disallowing it immediately won't do. Hence backslash_quote allows the settings "on", "off", and "safe_encoding", the last meaning to allow "\'" only if client_encoding is a valid server encoding. That is now the default, and the reason is that in encodings such as SJIS that allow 0x5c (ASCII backslash) to be the last byte of a multibyte character, accepting "\'" allows SQL-injection attacks as per CVE-2006-2314 (further details will be published after release). The "on" setting is available for backward compatibility, but it must not be used with clients that are exposed to untrusted input. Thanks to Akio Ishida and Yasuo Ohgaki for identifying this security issue. --- doc/src/sgml/runtime.sgml | 89 +++++++++++++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 30 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/runtime.sgml b/doc/src/sgml/runtime.sgml index 9b728ae7f44..cbebe6e17a0 100644 --- a/doc/src/sgml/runtime.sgml +++ b/doc/src/sgml/runtime.sgml @@ -1,5 +1,5 @@ @@ -3490,39 +3490,31 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' - - regex_flavor (string) - regular expressions + + backslash_quote (string) + stringsbackslash quotes - regex_flavor configuration parameter + backslash_quote configuration parameter - The regular expression flavor can be set to - advanced, extended, or basic. - The default is advanced. The extended - setting may be useful for exact backwards compatibility with - pre-7.4 releases of PostgreSQL. See - for details. - - - - - - sql_inheritance (boolean) - - sql_inheritance configuration parameter - - inheritance - - - This controls the inheritance semantics, in particular whether - subtables are included by various commands by default. They were - not included in versions prior to 7.1. If you need the old - behavior you can set this variable to off, but in the long run - you are encouraged to change your applications to use the - ONLY key word to exclude subtables. See - for more information about inheritance. + This controls whether a quote mark can be represented by + \' in a string literal. The preferred, SQL-standard way + to represent a quote mark is by doubling it ('') but + PostgreSQL has historically also accepted + \'. However, use of \' creates security risks + because in some client character set encodings, there are multibyte + characters in which the last byte is numerically equivalent to ASCII + \. If client-side code does escaping incorrectly then a + SQL-injection attack is possible. This risk can be prevented by + making the server reject queries in which a quote mark appears to be + escaped by a backslash. + The allowed values of backslash_quote are + on (allow \' always), + off (reject always), and + safe_encoding (allow only if client encoding does not + allow ASCII \ within a multibyte character). + safe_encoding is the default setting. @@ -3560,6 +3552,43 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' + + regex_flavor (string) + regular expressions + + regex_flavor configuration parameter + + + + The regular expression flavor can be set to + advanced, extended, or basic. + The default is advanced. The extended + setting may be useful for exact backwards compatibility with + pre-7.4 releases of PostgreSQL. See + for details. + + + + + + sql_inheritance (boolean) + + sql_inheritance configuration parameter + + inheritance + + + This controls the inheritance semantics, in particular whether + subtables are included by various commands by default. They were + not included in versions prior to 7.1. If you need the old + behavior you can set this variable to off, but in the long run + you are encouraged to change your applications to use the + ONLY key word to exclude subtables. See + for more information about inheritance. + + + + -- cgit v1.2.3