Changeset 85384 in webkit


Ignore:
Timestamp:
Apr 29, 2011 7:56:23 PM (13 years ago)
Author:
abarth@webkit.org
Message:

2011-04-29 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

style-src should block @style
https://bugs.webkit.org/show_bug.cgi?id=59293

Testing makes perfect.

  • http/tests/security/contentSecurityPolicy/inline-style-attribute-allowed-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/inline-style-attribute-allowed.html: Added.
  • http/tests/security/contentSecurityPolicy/inline-style-attribute-blocked-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/inline-style-attribute-blocked.html: Added.
  • http/tests/security/contentSecurityPolicy/inline-style-attribute-on-html-expected.txt: Added.
  • http/tests/security/contentSecurityPolicy/inline-style-attribute-on-html.html: Added.

2011-04-29 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

style-src should block @style
https://bugs.webkit.org/show_bug.cgi?id=59293

This patch blocks @style when style-src doesn't have the
'unsafe-inline' token. This patch blocks the parsing of the attribute
itself. That feels vaguely like too low a level to interpose the
policy, but there didn't seem to be anywhere else natural to enforce
the policy.

Tests: http/tests/security/contentSecurityPolicy/inline-style-attribute-allowed.html

http/tests/security/contentSecurityPolicy/inline-style-attribute-blocked.html
http/tests/security/contentSecurityPolicy/inline-style-on-html.html

  • dom/StyledElement.cpp: (WebCore::StyledElement::parseMappedAttribute):
Location:
trunk
Files:
6 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r85382 r85384  
     12011-04-29  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        style-src should block @style
     6        https://bugs.webkit.org/show_bug.cgi?id=59293
     7
     8        Testing makes perfect.
     9
     10        * http/tests/security/contentSecurityPolicy/inline-style-attribute-allowed-expected.txt: Added.
     11        * http/tests/security/contentSecurityPolicy/inline-style-attribute-allowed.html: Added.
     12        * http/tests/security/contentSecurityPolicy/inline-style-attribute-blocked-expected.txt: Added.
     13        * http/tests/security/contentSecurityPolicy/inline-style-attribute-blocked.html: Added.
     14        * http/tests/security/contentSecurityPolicy/inline-style-attribute-on-html-expected.txt: Added.
     15        * http/tests/security/contentSecurityPolicy/inline-style-attribute-on-html.html: Added.
     16
    1172011-04-29  Joseph Pecoraro  <joepeck@webkit.org>
    218
  • trunk/Source/WebCore/ChangeLog

    r85382 r85384  
     12011-04-29  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        style-src should block @style
     6        https://bugs.webkit.org/show_bug.cgi?id=59293
     7
     8        This patch blocks @style when style-src doesn't have the
     9        'unsafe-inline' token.  This patch blocks the parsing of the attribute
     10        itself.  That feels vaguely like too low a level to interpose the
     11        policy, but there didn't seem to be anywhere else natural to enforce
     12        the policy.
     13
     14        Tests: http/tests/security/contentSecurityPolicy/inline-style-attribute-allowed.html
     15               http/tests/security/contentSecurityPolicy/inline-style-attribute-blocked.html
     16               http/tests/security/contentSecurityPolicy/inline-style-on-html.html
     17
     18        * dom/StyledElement.cpp:
     19        (WebCore::StyledElement::parseMappedAttribute):
     20
    1212011-04-29  Joseph Pecoraro  <joepeck@webkit.org>
    222
  • trunk/Source/WebCore/dom/StyledElement.cpp

    r83209 r85384  
    3131#include "CSSValueKeywords.h"
    3232#include "ClassList.h"
     33#include "ContentSecurityPolicy.h"
    3334#include "DOMTokenList.h"
    3435#include "Document.h"
     
    241242        if (attr->isNull())
    242243            destroyInlineStyleDecl();
    243         else
     244        else if (document()->contentSecurityPolicy()->allowInlineStyle())
    244245            getInlineStyleDecl()->parseDeclaration(attr->value());
    245246        setIsStyleAttributeValid();
Note: See TracChangeset for help on using the changeset viewer.