]> granicus.if.org Git - postgresql/commit
Abandon the use of Perl's Safe.pm to enforce restrictions in plperl, as it is
authorAndrew Dunstan <andrew@dunslane.net>
Thu, 13 May 2010 16:44:03 +0000 (16:44 +0000)
committerAndrew Dunstan <andrew@dunslane.net>
Thu, 13 May 2010 16:44:03 +0000 (16:44 +0000)
commite089e04d3e0f2f67d1ad6686e09cd28c07fd50dd
tree16971b95e89c1b524ca7c4e537f2ad3717a412b0
parent2824dd4f4fa0f140b12de8ff8cbae0c096d52d36
Abandon the use of Perl's Safe.pm to enforce restrictions in plperl, as it is
fundamentally insecure. Instead apply an opmask to the whole interpreter that
imposes restrictions on unsafe operations. These restrictions are much harder
to subvert than is Safe.pm, since there is no container to be broken out of.
Backported to release 7.4.

In releases 7.4, 8.0 and 8.1 this also includes the necessary backporting of
the two interpreters model for plperl and plperlu adopted in release 8.2.

In versions 8.0 and up, the use of Perl's POSIX module to undo its locale
mangling on Windows has become insecure with these changes, so it is
replaced by our own routine, which is also faster.

Nice side effects of the changes include that it is now possible to use perl's
"strict" pragma in a natural way in plperl, and that perl's $a and
$b variables now work as expected in sort routines, and that function
compilation is significantly faster.

Tim Bunce and Andrew Dunstan, with reviews from Alex Hunsaker and
Alexey Klyukin.

Security: CVE-2010-1169
doc/src/sgml/plperl.sgml
src/pl/plperl/GNUmakefile
src/pl/plperl/plperl.c
src/pl/plperl/plperl_opmask.pl [new file with mode: 0644]
src/pl/plperl/test/plperlu_plperl.expected [new file with mode: 0644]
src/pl/plperl/test/plperlu_plperl.sql [new file with mode: 0644]
src/pl/plperl/test/runtest
src/pl/plperl/test/runtest.no-multiplicity [new file with mode: 0644]
src/pl/plperl/test/test.expected
src/pl/plperl/test/test_queries.sql