Changeset 61391 in webkit


Ignore:
Timestamp:
Jun 18, 2010 3:28:46 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-06-18 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

noAccess url schemes block access to inline stylesheets
https://bugs.webkit.org/show_bug.cgi?id=32309

Test that data URLs can access their inline style sheets.

  • http/tests/security/data-url-inline.css-expected.txt: Added.
  • http/tests/security/data-url-inline.css.html: Added.

2010-06-18 Adam Barth <abarth@webkit.org>

Reviewed by Darin Adler.

noAccess url schemes block access to inline stylesheets
https://bugs.webkit.org/show_bug.cgi?id=32309

Instead of using baseURL() to grab the security context we should just
use finalURL directly. When I wrote the original patch that added this
security check, finalURL didn't exist yet.

If finalURL is an empty URL, that means we generated the style sheet
from text that didn't have a URL. It would be slightly safer to store
a bit on CSSStyleSheet indicating whether it came from an inline style
sheet, but I think this check is fairly accurate.

Test: http/tests/security/data-url-inline.css.html

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

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r61390 r61391  
     12010-06-18  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        noAccess url schemes block access to inline stylesheets
     6        https://bugs.webkit.org/show_bug.cgi?id=32309
     7
     8        Test that data URLs can access their inline style sheets.
     9
     10        * http/tests/security/data-url-inline.css-expected.txt: Added.
     11        * http/tests/security/data-url-inline.css.html: Added.
     12
    1132010-06-18  Adam Barth  <abarth@webkit.org>
    214
  • trunk/WebCore/ChangeLog

    r61390 r61391  
     12010-06-18  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Darin Adler.
     4
     5        noAccess url schemes block access to inline stylesheets
     6        https://bugs.webkit.org/show_bug.cgi?id=32309
     7
     8        Instead of using baseURL() to grab the security context we should just
     9        use finalURL directly.  When I wrote the original patch that added this
     10        security check, finalURL didn't exist yet.
     11
     12        If finalURL is an empty URL, that means we generated the style sheet
     13        from text that didn't have a URL.  It would be slightly safer to store
     14        a bit on CSSStyleSheet indicating whether it came from an inline style
     15        sheet, but I think this check is fairly accurate.
     16
     17        Test: http/tests/security/data-url-inline.css.html
     18
     19        * css/CSSStyleSheet.cpp:
     20        (WebCore::CSSStyleSheet::cssRules):
     21
    1222010-06-18  Adam Barth  <abarth@webkit.org>
    223
  • trunk/WebCore/css/CSSStyleSheet.cpp

    r61073 r61391  
    135135}
    136136
    137 
    138137PassRefPtr<CSSRuleList> CSSStyleSheet::cssRules(bool omitCharsetRules)
    139138{
    140     if (doc() && !doc()->securityOrigin()->canRequest(baseURL()))
     139    KURL url = finalURL();
     140    if (!url.isEmpty() && doc() && !doc()->securityOrigin()->canRequest(url))
    141141        return 0;
    142142    return CSSRuleList::create(this, omitCharsetRules);
Note: See TracChangeset for help on using the changeset viewer.