Changeset 50587 in webkit


Ignore:
Timestamp:
Nov 5, 2009 10:05:31 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2009-11-05 Adam Barth <abarth@webkit.org>

Reviewed by Sam Weinig.

Cross-domain access to stylesheet text should not be allowed
https://bugs.webkit.org/show_bug.cgi?id=20527

Test that a script cannot read cross-origin cssRules.

  • http/tests/security/cannot-read-cssrules-expected.txt: Added.
  • http/tests/security/cannot-read-cssrules-redirect-expected.txt: Added.
  • http/tests/security/cannot-read-cssrules-redirect.html: Added.
  • http/tests/security/cannot-read-cssrules.html: Added.

2009-11-05 Adam Barth <abarth@webkit.org>

Reviewed by Sam Weinig.

Cross-domain access to stylesheet text should not be allowed
https://bugs.webkit.org/show_bug.cgi?id=20527

Check whether whether the current document can read the cssRules from
the style sheet. Firefox throws a security error here, but we return
null instead because that's what we usually do in these cases.

Test: http/tests/security/cannot-read-cssrules-redirect.html

http/tests/security/cannot-read-cssrules.html

  • css/CSSStyleSheet.cpp: (WebCore::CSSStyleSheet::cssRules):
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r50584 r50587  
     12009-11-05  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Cross-domain access to stylesheet text should not be allowed
     6        https://bugs.webkit.org/show_bug.cgi?id=20527
     7
     8        Test that a script cannot read cross-origin cssRules.
     9
     10        * http/tests/security/cannot-read-cssrules-expected.txt: Added.
     11        * http/tests/security/cannot-read-cssrules-redirect-expected.txt: Added.
     12        * http/tests/security/cannot-read-cssrules-redirect.html: Added.
     13        * http/tests/security/cannot-read-cssrules.html: Added.
     14
    1152009-11-05  Alice Liu  <alice.liu@apple.com>
    216
  • trunk/WebCore/ChangeLog

    r50585 r50587  
     12009-11-05  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Cross-domain access to stylesheet text should not be allowed
     6        https://bugs.webkit.org/show_bug.cgi?id=20527
     7
     8        Check whether whether the current document can read the cssRules from
     9        the style sheet.  Firefox throws a security error here, but we return
     10        null instead because that's what we usually do in these cases.
     11
     12        Test: http/tests/security/cannot-read-cssrules-redirect.html
     13              http/tests/security/cannot-read-cssrules.html
     14
     15        * css/CSSStyleSheet.cpp:
     16        (WebCore::CSSStyleSheet::cssRules):
     17
    1182009-11-05  Steve Block  <steveblock@google.com>
    219
  • trunk/WebCore/css/CSSStyleSheet.cpp

    r48773 r50587  
    2929#include "ExceptionCode.h"
    3030#include "Node.h"
     31#include "SecurityOrigin.h"
    3132#include "TextEncoding.h"
    3233#include <wtf/Deque.h>
     
    119120PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules)
    120121{
     122    if (doc() && !doc()->securityOrigin()->canRequest(baseURL()))
     123        return 0;
    121124    return CSSRuleList::create(this, omitCharsetRules);
    122125}
Note: See TracChangeset for help on using the changeset viewer.