Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: webkit/plugins/ppapi/url_request_info_unittest.cc

Issue 7645010: Fix security bug that allowed invalid header fields to be injected by (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/ppapi/url_request_info_unittest.cc
===================================================================
--- webkit/plugins/ppapi/url_request_info_unittest.cc (revision 96431)
+++ webkit/plugins/ppapi/url_request_info_unittest.cc (working copy)
@@ -208,8 +208,34 @@
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) {
// Test default header field.
ASSERT_TRUE(IsExpected(

Powered by Google App Engine
This is Rietveld 408576698