Changeset 251861 in webkit
- Timestamp:
- Oct 31, 2019, 10:52:49 AM (5 years ago)
- Location:
- trunk/Source
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r251857 r251861 1 2019-10-31 Alex Christensen <achristensen@webkit.org> 2 3 Use SecurityOriginData in NetworkProcess where possible without other changes 4 https://bugs.webkit.org/show_bug.cgi?id=203615 5 6 Reviewed by Brady Eidson. 7 8 * page/SecurityOrigin.cpp: 9 (WebCore::SecurityOrigin::SecurityOrigin): 10 (WebCore::SecurityOrigin::isolatedCopy const): 11 * page/SecurityOrigin.h: 12 * page/SecurityOriginData.h: 13 (WebCore::SecurityOriginData::encode const): 14 * page/csp/ContentSecurityPolicy.cpp: 15 (WebCore::ContentSecurityPolicy::allowFrameAncestors const): 16 * page/csp/ContentSecurityPolicy.h: 17 * page/csp/ContentSecurityPolicyDirectiveList.cpp: 18 (WebCore::urlFromOrigin): 19 (WebCore::checkFrameAncestors): 20 (WebCore::ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins const): 21 * page/csp/ContentSecurityPolicyDirectiveList.h: 22 1 23 2019-10-31 Zalan Bujtas <zalan@apple.com> 2 24 -
trunk/Source/WebCore/page/SecurityOrigin.cpp
r250739 r251861 172 172 } 173 173 174 SecurityOrigin::SecurityOrigin(const SecurityOrigin *other)175 : m_data { other ->m_data.isolatedCopy() }176 , m_domain { other ->m_domain.isolatedCopy() }177 , m_filePath { other ->m_filePath.isolatedCopy() }178 , m_isUnique { other ->m_isUnique }179 , m_universalAccess { other ->m_universalAccess }180 , m_domainWasSetInDOM { other ->m_domainWasSetInDOM }181 , m_canLoadLocalResources { other ->m_canLoadLocalResources }182 , m_storageBlockingPolicy { other ->m_storageBlockingPolicy }183 , m_enforcesFilePathSeparation { other ->m_enforcesFilePathSeparation }184 , m_needsStorageAccessFromFileURLsQuirk { other ->m_needsStorageAccessFromFileURLsQuirk }185 , m_isPotentiallyTrustworthy { other ->m_isPotentiallyTrustworthy }186 , m_isLocal { other ->m_isLocal }174 SecurityOrigin::SecurityOrigin(const SecurityOrigin& other) 175 : m_data { other.m_data.isolatedCopy() } 176 , m_domain { other.m_domain.isolatedCopy() } 177 , m_filePath { other.m_filePath.isolatedCopy() } 178 , m_isUnique { other.m_isUnique } 179 , m_universalAccess { other.m_universalAccess } 180 , m_domainWasSetInDOM { other.m_domainWasSetInDOM } 181 , m_canLoadLocalResources { other.m_canLoadLocalResources } 182 , m_storageBlockingPolicy { other.m_storageBlockingPolicy } 183 , m_enforcesFilePathSeparation { other.m_enforcesFilePathSeparation } 184 , m_needsStorageAccessFromFileURLsQuirk { other.m_needsStorageAccessFromFileURLsQuirk } 185 , m_isPotentiallyTrustworthy { other.m_isPotentiallyTrustworthy } 186 , m_isLocal { other.m_isLocal } 187 187 { 188 188 } … … 219 219 Ref<SecurityOrigin> SecurityOrigin::isolatedCopy() const 220 220 { 221 return adoptRef(*new SecurityOrigin( this));221 return adoptRef(*new SecurityOrigin(*this)); 222 222 } 223 223 -
trunk/Source/WebCore/page/SecurityOrigin.h
r244853 r251861 222 222 SecurityOrigin(); 223 223 explicit SecurityOrigin(const URL&); 224 explicit SecurityOrigin(const SecurityOrigin *);224 explicit SecurityOrigin(const SecurityOrigin&); 225 225 226 226 // FIXME: Rename this function to something more semantic. -
trunk/Source/WebCore/page/SecurityOriginData.h
r239461 r251861 98 98 void SecurityOriginData::encode(Encoder& encoder) const 99 99 { 100 ASSERT(!isEmpty()); 100 101 encoder << protocol; 101 102 encoder << host; -
trunk/Source/WebCore/page/csp/ContentSecurityPolicy.cpp
r251425 r251861 509 509 } 510 510 511 bool ContentSecurityPolicy::allowFrameAncestors(const Vector< RefPtr<SecurityOrigin>>& ancestorOrigins, const URL& url, bool overrideContentSecurityPolicy) const511 bool ContentSecurityPolicy::allowFrameAncestors(const Vector<SecurityOriginData>& ancestorOrigins, const URL& url, bool overrideContentSecurityPolicy) const 512 512 { 513 513 if (overrideContentSecurityPolicy) -
trunk/Source/WebCore/page/csp/ContentSecurityPolicy.h
r251425 r251861 100 100 101 101 bool allowFrameAncestors(const Frame&, const URL&, bool overrideContentSecurityPolicy = false) const; 102 WEBCORE_EXPORT bool allowFrameAncestors(const Vector< RefPtr<SecurityOrigin>>& ancestorOrigins, const URL&, bool overrideContentSecurityPolicy = false) const;102 WEBCORE_EXPORT bool allowFrameAncestors(const Vector<SecurityOriginData>& ancestorOrigins, const URL&, bool overrideContentSecurityPolicy = false) const; 103 103 WEBCORE_EXPORT bool overridesXFrameOptions() const; 104 104 -
trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.cpp
r248846 r251861 80 80 } 81 81 82 static inline URL urlFromOrigin(const SecurityOriginData& origin) 83 { 84 return { URL { }, origin.toString() }; 85 } 86 82 87 static inline bool checkFrameAncestors(ContentSecurityPolicySourceListDirective* directive, const Frame& frame) 83 88 { … … 93 98 } 94 99 95 static inline bool checkFrameAncestors(ContentSecurityPolicySourceListDirective* directive, const Vector< RefPtr<SecurityOrigin>>& ancestorOrigins)100 static inline bool checkFrameAncestors(ContentSecurityPolicySourceListDirective* directive, const Vector<SecurityOriginData>& ancestorOrigins) 96 101 { 97 102 if (!directive) … … 99 104 bool didReceiveRedirectResponse = false; 100 105 for (auto& origin : ancestorOrigins) { 101 URL originURL = urlFromOrigin( *origin);106 URL originURL = urlFromOrigin(origin); 102 107 if (!originURL.isValid() || !directive->allows(originURL, didReceiveRedirectResponse, ContentSecurityPolicySourceListDirective::ShouldAllowEmptyURLIfSourceListIsNotNone::No)) 103 108 return false; … … 259 264 } 260 265 261 const ContentSecurityPolicyDirective* ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins(const Vector< RefPtr<SecurityOrigin>>& ancestorOrigins) const266 const ContentSecurityPolicyDirective* ContentSecurityPolicyDirectiveList::violatedDirectiveForFrameAncestorOrigins(const Vector<SecurityOriginData>& ancestorOrigins) const 262 267 { 263 268 if (checkFrameAncestors(m_frameAncestors.get(), ancestorOrigins)) -
trunk/Source/WebCore/page/csp/ContentSecurityPolicyDirectiveList.h
r244589 r251861 63 63 const ContentSecurityPolicyDirective* violatedDirectiveForFrame(const URL&, bool didReceiveRedirectResponse) const; 64 64 const ContentSecurityPolicyDirective* violatedDirectiveForFrameAncestor(const Frame&) const; 65 const ContentSecurityPolicyDirective* violatedDirectiveForFrameAncestorOrigins(const Vector< RefPtr<SecurityOrigin>>&) const;65 const ContentSecurityPolicyDirective* violatedDirectiveForFrameAncestorOrigins(const Vector<SecurityOriginData>&) const; 66 66 const ContentSecurityPolicyDirective* violatedDirectiveForImage(const URL&, bool didReceiveRedirectResponse) const; 67 67 #if ENABLE(APPLICATION_MANIFEST) -
trunk/Source/WebKit/ChangeLog
r251859 r251861 1 2019-10-31 Alex Christensen <achristensen@webkit.org> 2 3 Use SecurityOriginData in NetworkProcess where possible without other changes 4 https://bugs.webkit.org/show_bug.cgi?id=203615 5 6 Reviewed by Brady Eidson. 7 8 * NetworkProcess/NetworkResourceLoadParameters.cpp: 9 (WebKit::NetworkResourceLoadParameters::encode const): 10 * NetworkProcess/NetworkResourceLoadParameters.h: 11 * NetworkProcess/NetworkResourceLoader.cpp: 12 (WebKit::NetworkResourceLoader::shouldInterruptLoadForXFrameOptions): 13 * WebProcess/Network/WebLoaderStrategy.cpp: 14 (WebKit::WebLoaderStrategy::scheduleLoadFromNetworkProcess): 15 1 16 2019-10-31 Alex Christensen <achristensen@webkit.org> 2 17 -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.cpp
r251155 r251861 93 93 encoder << *sourceOrigin; 94 94 encoder << static_cast<bool>(topOrigin); 95 if ( sourceOrigin)95 if (topOrigin) 96 96 encoder << *topOrigin; 97 97 encoder << options; -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoadParameters.h
r251155 r251861 59 59 WebCore::PreflightPolicy preflightPolicy { WebCore::PreflightPolicy::Consider }; 60 60 bool shouldEnableCrossOriginResourcePolicy { false }; 61 Vector< RefPtr<WebCore::SecurityOrigin>> frameAncestorOrigins;61 Vector<WebCore::SecurityOriginData> frameAncestorOrigins; 62 62 bool isHTTPSUpgradeEnabled { false }; 63 63 -
trunk/Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
r251786 r251861 411 411 case XFrameOptionsSameOrigin: { 412 412 auto origin = SecurityOrigin::create(url); 413 auto topFrameOrigin = m_parameters.frameAncestorOrigins.last();414 if (!origin->isSameSchemeHostPort(*topFrameOrigin))415 return true;416 413 for (auto& ancestorOrigin : m_parameters.frameAncestorOrigins) { 417 if (!origin->isSameSchemeHostPort( *ancestorOrigin))414 if (!origin->isSameSchemeHostPort(ancestorOrigin.securityOrigin())) 418 415 return true; 419 416 } -
trunk/Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp
r251585 r251861 337 337 338 338 if (resourceLoader.options().mode == FetchOptions::Mode::Navigate) { 339 Vector< RefPtr<SecurityOrigin>> frameAncestorOrigins;339 Vector<SecurityOriginData> frameAncestorOrigins; 340 340 for (auto* frame = resourceLoader.frame()->tree().parent(); frame; frame = frame->tree().parent()) 341 frameAncestorOrigins.append( makeRefPtr(frame->document()->securityOrigin()));341 frameAncestorOrigins.append(frame->document()->securityOrigin().data()); 342 342 loadParameters.frameAncestorOrigins = WTFMove(frameAncestorOrigins); 343 343 }
Note:
See TracChangeset
for help on using the changeset viewer.