Title: [126336] trunk/Source/WebCore
Revision
126336
Author
[email protected]
Date
2012-08-22 12:36:53 -0700 (Wed, 22 Aug 2012)

Log Message

[BlackBerry] Add a check to filter out cookies that tries to set the
domain to a top level domain
https://bugs.webkit.org/show_bug.cgi?id=94722

Patch by Otto Derek Cheung <[email protected]> on 2012-08-22
Reviewed by Rob Buis.

Adding conditions to check whether a cookie domain is a top level domain.
If it is, throw it out when parsing.

Manual Testing by trying to insert a cookie with an invalid domain
using web-inspector. (ex: when on news.yahoo.com.hk, try to document.
cookie="test1=seeifthiscookieexist; domain=.com.hk")

PR121622

* platform/blackberry/CookieParser.cpp:
WebCore::CookieParser::parseOneCookie):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (126335 => 126336)


--- trunk/Source/WebCore/ChangeLog	2012-08-22 19:34:31 UTC (rev 126335)
+++ trunk/Source/WebCore/ChangeLog	2012-08-22 19:36:53 UTC (rev 126336)
@@ -1,3 +1,23 @@
+2012-08-22  Otto Derek Cheung  <[email protected]>
+
+        [BlackBerry] Add a check to filter out cookies that tries to set the 
+        domain to a top level domain
+        https://bugs.webkit.org/show_bug.cgi?id=94722
+
+        Reviewed by Rob Buis.
+
+        Adding conditions to check whether a cookie domain is a top level domain.
+        If it is, throw it out when parsing.
+
+        Manual Testing by trying to insert a cookie with an invalid domain
+        using web-inspector. (ex: when on news.yahoo.com.hk, try to document.
+        cookie="test1=seeifthiscookieexist; domain=.com.hk")
+
+        PR121622
+
+        * platform/blackberry/CookieParser.cpp:
+        WebCore::CookieParser::parseOneCookie):
+
 2012-08-22  Rob Buis  <[email protected]>
 
         Remove RenderBlock::paintEllipsisBoxes

Modified: trunk/Source/WebCore/platform/blackberry/CookieParser.cpp (126335 => 126336)


--- trunk/Source/WebCore/platform/blackberry/CookieParser.cpp	2012-08-22 19:34:31 UTC (rev 126335)
+++ trunk/Source/WebCore/platform/blackberry/CookieParser.cpp	2012-08-22 19:36:53 UTC (rev 126336)
@@ -29,6 +29,7 @@
 
 #include "Logging.h"
 #include "ParsedCookie.h"
+#include <network/TopLevelDomain.h>
 #include <wtf/CurrentTime.h>
 #include <wtf/text/CString.h>
 
@@ -271,6 +272,11 @@
                 // We should check for an embedded dot in the portion of string in the host not in the domain
                 // but to match firefox behaviour we do not.
 
+                // Check whether the domain is a top level domain, if it is throw it out
+                // http://publicsuffix.org/list/
+                if (!BlackBerry::Platform::TopLevelDomain::isCookieWritableDomain(realDomain.utf8().data()))
+                    LOG_AND_DELETE("Invalid cookie %s (domain): it did not pass the top level domain check", cookie.ascii().data());
+
                 res->setDomain(realDomain);
             } else
                 LOG_AND_DELETE("Invalid cookie %s (domain)", cookie.ascii().data());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to