Changeset 95488 in webkit


Ignore:
Timestamp:
Sep 19, 2011 3:56:22 PM (13 years ago)
Author:
abarth@webkit.org
Message:

Named property confusion with proto
https://bugs.webkit.org/show_bug.cgi?id=68221

Reviewed by Eric Seidel.

Source/WebCore:

The proto property is super magical because it's not a real named
property and it has higher precedence than even interceptors. This
confuses this check, which is meant to detech which names will get
handled by our interceptor.

Test: http/tests/security/window-named-proto.html

  • bindings/v8/custom/V8DOMWindowCustom.cpp:

(WebCore::V8DOMWindow::namedSecurityCheck):

LayoutTests:

  • http/tests/security/resources/innocent-victim-with-iframe.html: Added.
  • http/tests/security/window-named-proto-expected.txt: Added.
  • http/tests/security/window-named-proto.html: Added.
Location:
trunk
Files:
3 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r95482 r95488  
     12011-09-19  Adam Barth  <abarth@webkit.org>
     2
     3        Named property confusion with __proto__
     4        https://bugs.webkit.org/show_bug.cgi?id=68221
     5
     6        Reviewed by Eric Seidel.
     7
     8        * http/tests/security/resources/innocent-victim-with-iframe.html: Added.
     9        * http/tests/security/window-named-proto-expected.txt: Added.
     10        * http/tests/security/window-named-proto.html: Added.
     11
    1122011-09-19  John Bauman  <jbauman@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r95487 r95488  
     12011-09-19  Adam Barth  <abarth@webkit.org>
     2
     3        Named property confusion with __proto__
     4        https://bugs.webkit.org/show_bug.cgi?id=68221
     5
     6        Reviewed by Eric Seidel.
     7
     8        The __proto__ property is super magical because it's not a real named
     9        property and it has higher precedence than even interceptors.  This
     10        confuses this check, which is meant to detech which names will get
     11        handled by our interceptor.
     12
     13        Test: http/tests/security/window-named-proto.html
     14
     15        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     16        (WebCore::V8DOMWindow::namedSecurityCheck):
     17
    1182011-09-19  Adam Barth  <abarth@webkit.org>
    219
  • trunk/Source/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r95362 r95488  
    561561
    562562    if (key->IsString()) {
     563        DEFINE_STATIC_LOCAL(AtomicString, nameOfProtoProperty, ("__proto__"));
     564
    563565        String name = toWebCoreString(key);
    564566        // Notice that we can't call HasRealNamedProperty for ACCESS_HAS
     
    566568        if (type == v8::ACCESS_HAS && target->tree()->child(name))
    567569            return true;
    568         if (type == v8::ACCESS_GET && target->tree()->child(name) && !host->HasRealNamedProperty(key->ToString()))
     570        // We need to explicitly compare against nameOfProtoProperty because
     571        // V8's JSObject::LocalLookup finds __proto__ before
     572        // interceptors and even when __proto__ isn't a "real named property".
     573        if (type == v8::ACCESS_GET && target->tree()->child(name) && !host->HasRealNamedProperty(key->ToString()) && name != nameOfProtoProperty)
    569574            return true;
    570575    }
Note: See TracChangeset for help on using the changeset viewer.