summaryrefslogtreecommitdiffstats
path: root/webkit/plugins/ppapi/url_request_info_unittest.cc
diff options
context:
space:
mode:
authorbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-16 02:49:27 +0000
committerbbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-16 02:49:27 +0000
commit91bc704081b6771e423e0ebb69553634c048c14e (patch)
treebe82e81888eb348ccf7fc441165ebc9b39461fa9 /webkit/plugins/ppapi/url_request_info_unittest.cc
parentbdb3eaaa2a6a6de13c2abbd7f8366f2fb8764194 (diff)
downloadchromium_src-91bc704081b6771e423e0ebb69553634c048c14e.zip
chromium_src-91bc704081b6771e423e0ebb69553634c048c14e.tar.gz
chromium_src-91bc704081b6771e423e0ebb69553634c048c14e.tar.bz2
Fix security bug that allowed invalid header fields to be injected by
setting the HTTP method to a multi-line string. BUG= http://code.google.com/p/nativeclient/issues/detail?id=2024 TEST=TestShellTests, url_request_info_unittest.cc Review URL: http://codereview.chromium.org/7645010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96888 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins/ppapi/url_request_info_unittest.cc')
-rw-r--r--webkit/plugins/ppapi/url_request_info_unittest.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/webkit/plugins/ppapi/url_request_info_unittest.cc b/webkit/plugins/ppapi/url_request_info_unittest.cc
index 3e1d84e..ef86615 100644
--- a/webkit/plugins/ppapi/url_request_info_unittest.cc
+++ b/webkit/plugins/ppapi/url_request_info_unittest.cc
@@ -215,6 +215,32 @@ TEST_F(URLRequestInfoTest, SetMethod) {
ASSERT_TRUE(info_->SetStringProperty(
PP_URLREQUESTPROPERTY_METHOD, "POST"));
ASSERT_TRUE(IsExpected(GetMethod(), "POST"));
+
+ // Test that method names are converted to upper case.
+ ASSERT_TRUE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "get"));
+ ASSERT_TRUE(IsExpected(GetMethod(), "GET"));
+ ASSERT_TRUE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "post"));
+ ASSERT_TRUE(IsExpected(GetMethod(), "POST"));
+}
+
+TEST_F(URLRequestInfoTest, SetInvalidMethod) {
+ ASSERT_FALSE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "CONNECT"));
+ ASSERT_FALSE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "connect"));
+ ASSERT_FALSE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "TRACE"));
+ ASSERT_FALSE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "trace"));
+ ASSERT_FALSE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "TRACK"));
+ ASSERT_FALSE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "track"));
+
+ ASSERT_FALSE(info_->SetStringProperty(
+ PP_URLREQUESTPROPERTY_METHOD, "POST\x0d\x0ax-csrf-token:\x20test1234"));
}
TEST_F(URLRequestInfoTest, SetValidHeaders) {