Ignore:
Timestamp:
Nov 29, 2018, 3:06:43 PM (6 years ago)
Author:
[email protected]
Message:

CSS subresource loads should not be observable from resource timing if the stylesheet is opaque
https://bugs.webkit.org/show_bug.cgi?id=192132

Reviewed by Ryosuke Niwa.

Source/WebCore:

Introduce a new ResourceLoaderOptions to determine whether a load is made from a resource that is opaque.
Make use of that option to disable exposing such loads to the web page through resource timing.
The same option might later be used to bypass service workers.

Make use of this option for CSS subresource loads.
When the CSS stylesheet is opaque for the page, set this option.

Test: http/tests/security/clean-origin-exposed-resource-timing.html

http/tests/security/cross-origin-resource-timing.html

  • css/CSSCursorImageValue.cpp:

(WebCore::CSSCursorImageValue::CSSCursorImageValue):
(WebCore::CSSCursorImageValue::loadImage):

  • css/CSSCursorImageValue.h:
  • css/CSSFontFaceSrcValue.cpp:

(WebCore::CSSFontFaceSrcValue::cachedFont):

  • css/CSSFontFaceSrcValue.h:
  • css/CSSImageSetValue.cpp:

(WebCore::CSSImageSetValue::CSSImageSetValue):
(WebCore::CSSImageSetValue::loadBestFitImage):

  • css/CSSImageSetValue.h:
  • css/CSSImageValue.cpp:

(WebCore::CSSImageValue::CSSImageValue):
(WebCore::CSSImageValue::loadImage):

  • css/CSSImageValue.h:
  • css/CSSStyleSheet.h:
  • css/StyleRuleImport.cpp:

(WebCore::StyleRuleImport::setCSSStyleSheet):
(WebCore::StyleRuleImport::requestStyleSheet):

  • css/StyleSheetContents.h:
  • css/parser/CSSParserContext.h:
  • css/parser/CSSPropertyParser.cpp:

(WebCore::consumeCursor):
(WebCore::consumeFontFaceSrcURI):

  • css/parser/CSSPropertyParserHelpers.cpp:

(WebCore::CSSPropertyParserHelpers::consumeImageSet):
(WebCore::CSSPropertyParserHelpers::consumeImage):

  • html/HTMLBodyElement.cpp:

(WebCore::HTMLBodyElement::collectStyleForPresentationAttribute):

  • html/HTMLLinkElement.cpp:

(WebCore::HTMLLinkElement::initializeStyleSheet):
(WebCore::HTMLLinkElement::setCSSStyleSheet):

  • html/HTMLTableElement.cpp:

(WebCore::HTMLTableElement::collectStyleForPresentationAttribute):

  • html/HTMLTablePartElement.cpp:

(WebCore::HTMLTablePartElement::collectStyleForPresentationAttribute):

  • loader/ResourceLoaderOptions.h:
  • loader/ResourceTimingInformation.cpp:

(WebCore::ResourceTimingInformation::shouldAddResourceTiming):

  • svg/SVGFontFaceUriElement.cpp:

(WebCore::SVGFontFaceUriElement::srcValue const):

LayoutTests:

  • http/tests/security/clean-origin-css-exposed-resource-timing-expected.txt: Added.
  • http/tests/security/clean-origin-css-exposed-resource-timinge-timing.html: Added.
  • http/tests/security/cross-origin-css-resource-timing-expected.txt: Added.
  • http/tests/security/cross-origin-css-resource-timing.html: Added.
  • http/tests/security/resources/loading-subresources.css: Added.
  • http/tests/security/resources/imported-loading-subresources.css: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/CSSImageSetValue.cpp

    r225499 r238698  
    3939namespace WebCore {
    4040
    41 CSSImageSetValue::CSSImageSetValue()
     41CSSImageSetValue::CSSImageSetValue(LoadedFromOpaqueSource loadedFromOpaqueSource)
    4242    : CSSValueList(ImageSetClass, CommaSeparator)
     43    , m_loadedFromOpaqueSource(loadedFromOpaqueSource)
    4344{
    4445}
     
    99100        // and any CSS transforms. https://bugs.webkit.org/show_bug.cgi?id=81698
    100101        ImageWithScale image = bestImageForScaleFactor();
    101         CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), options);
     102
     103        ResourceLoaderOptions loadOptions = options;
     104        loadOptions.loadedFromOpaqueSource = m_loadedFromOpaqueSource;
     105        CachedResourceRequest request(ResourceRequest(document->completeURL(image.imageURL)), loadOptions);
    102106        request.setInitiator(cachedResourceRequestInitiators().css);
    103107        if (options.mode == FetchOptions::Mode::Cors)
Note: See TracChangeset for help on using the changeset viewer.