summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService/Server/XMLRPC.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-02-24 22:39:29 +0100
committerDave Lawrence <dlawrence@mozilla.com>2012-02-24 22:39:29 +0100
commit4098cc8be26a268bf561ff80f981a93c6959c678 (patch)
tree87940ec25918eb7505a3d7a495286867c72bf74c /Bugzilla/WebService/Server/XMLRPC.pm
parentbf7f26d66089402df37036d1e62a6d8711922da1 (diff)
parent11fef47a1847cdfc5671dfc41447e893ed0037a5 (diff)
downloadbugzilla-4098cc8be26a268bf561ff80f981a93c6959c678.tar.gz
bugzilla-4098cc8be26a268bf561ff80f981a93c6959c678.tar.xz
merged with bugzilla/4.2
Diffstat (limited to 'Bugzilla/WebService/Server/XMLRPC.pm')
-rw-r--r--Bugzilla/WebService/Server/XMLRPC.pm8
1 files changed, 8 insertions, 0 deletions
diff --git a/Bugzilla/WebService/Server/XMLRPC.pm b/Bugzilla/WebService/Server/XMLRPC.pm
index 5c3677993..822709d85 100644
--- a/Bugzilla/WebService/Server/XMLRPC.pm
+++ b/Bugzilla/WebService/Server/XMLRPC.pm
@@ -86,10 +86,18 @@ use XMLRPC::Lite;
our @ISA = qw(XMLRPC::Deserializer);
use Bugzilla::Error;
+use Bugzilla::WebService::Constants qw(XMLRPC_CONTENT_TYPE_WHITELIST);
use Scalar::Util qw(tainted);
sub deserialize {
my $self = shift;
+
+ # Only allow certain content types to protect against CSRF attacks
+ if (!grep($_ eq $ENV{'CONTENT_TYPE'}, XMLRPC_CONTENT_TYPE_WHITELIST)) {
+ ThrowUserError('xmlrpc_illegal_content_type',
+ { content_type => $ENV{'CONTENT_TYPE'} });
+ }
+
my ($xml) = @_;
my $som = $self->SUPER::deserialize(@_);
if (tainted($xml)) {