postgresql/src/test/regress
Tom Lane 17351fce4e Prevent access to external files/URLs via XML entity references.
xml_parse() would attempt to fetch external files or URLs as needed to
resolve DTD and entity references in an XML value, thus allowing
unprivileged database users to attempt to fetch data with the privileges
of the database server.  While the external data wouldn't get returned
directly to the user, portions of it could be exposed in error messages
if the data didn't parse as valid XML; and in any case the mere ability
to check existence of a file might be useful to an attacker.

The ideal solution to this would still allow fetching of references that
are listed in the host system's XML catalogs, so that documents can be
validated according to installed DTDs.  However, doing that with the
available libxml2 APIs appears complex and error-prone, so we're not going
to risk it in a security patch that necessarily hasn't gotten wide review.
So this patch merely shuts off all access, causing any external fetch to
silently expand to an empty string.  A future patch may improve this.

In HEAD and 9.2, also suppress warnings about undefined entities, which
would otherwise occur as a result of not loading referenced DTDs.  Previous
branches don't show such warnings anyway, due to different error handling
arrangements.

Credit to Noah Misch for first reporting the problem, and for much work
towards a solution, though this simplistic approach was not his preference.
Also thanks to Daniel Veillard for consultation.

Security: CVE-2012-3489
2012-08-14 18:31:16 -04:00
..
data Fix GIN to support null keys, empty and null items, and full index scans. 2011-01-07 19:16:24 -05:00
expected Prevent access to external files/URLs via XML entity references. 2012-08-14 18:31:16 -04:00
input Change syntax of new CHECK NO INHERIT constraints 2012-07-24 16:01:32 -04:00
output Change syntax of new CHECK NO INHERIT constraints 2012-07-24 16:01:32 -04:00
sql Prevent access to external files/URLs via XML entity references. 2012-08-14 18:31:16 -04:00
.gitignore Convert cvsignore to gitignore, and add .gitignore for build targets. 2010-09-22 12:57:04 +02:00
GNUmakefile pg_regress: Use target-specific variable instead of overriding make rule 2012-02-07 22:42:19 +02:00
Makefile Remove remains of old depend target. 2007-01-20 17:16:17 +00:00
parallel_schedule Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
pg_regress.c Use --nosync during make check's initdb call. 2012-07-21 19:56:22 -04:00
pg_regress.h pg_regress: Replace exit_nicely() with exit() plus atexit() hook 2012-01-02 22:09:25 +02:00
pg_regress_main.c pg_regress: Replace exit_nicely() with exit() plus atexit() hook 2012-01-02 22:09:25 +02:00
regress.c Redesign the plancache mechanism for more flexibility and efficiency. 2011-09-16 00:43:52 -04:00
regressplans.sh Tweak regressplans.sh to use any already-set PGOPTIONS. 2000-12-18 02:45:47 +00:00
resultmap Enable compiling with the mingw-w64 32 bit compiler. 2011-12-10 15:35:41 -05:00
serial_schedule Syntax support and documentation for event triggers. 2012-07-18 10:16:16 -04:00
standby_schedule Remove cvs keywords from all files. 2010-09-20 22:08:53 +02:00