Changeset 283414 in webkit
- Timestamp:
- Oct 1, 2021, 4:13:26 PM (5 years ago)
- Location:
- branches/safari-611.4.2.0-branch
- Files:
-
- 8 deleted
- 8 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt (deleted)
-
LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html (deleted)
-
LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt (deleted)
-
LayoutTests/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html (deleted)
-
LayoutTests/platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt (deleted)
-
LayoutTests/platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt (deleted)
-
LayoutTests/platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt (deleted)
-
LayoutTests/platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt (deleted)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/loader/DocumentThreadableLoader.cpp (modified) (3 diffs)
-
Source/WebCore/loader/DocumentThreadableLoader.h (modified) (1 diff)
-
Source/WebCore/page/csp/ContentSecurityPolicy.cpp (modified) (4 diffs)
-
Source/WebCore/page/csp/ContentSecurityPolicy.h (modified) (2 diffs)
-
Source/WebKit/ChangeLog (modified) (1 diff)
-
Source/WebKit/NetworkProcess/NetworkLoadChecker.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/safari-611.4.2.0-branch/LayoutTests/ChangeLog
r283385 r283414 1 2021-10-01 Russell Epstein <repstein@apple.com>2 3 Cherry-pick r281431. rdar://problem/811756354 5 Report correct blocked URI in CSP violation report6 https://bugs.webkit.org/show_bug.cgi?id=2263167 <rdar://problem/78552912>8 9 Reviewed by Alex Christensen.10 11 Source/WebCore:12 13 Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html14 http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html15 16 Currently for a blocked redirection we report the blocked URI as the17 target URL. This is not up to spec and we should actually report the18 requested URL.19 20 * loader/DocumentThreadableLoader.cpp:21 (WebCore::DocumentThreadableLoader::redirectReceived):22 (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy):23 * loader/DocumentThreadableLoader.h:24 * page/csp/ContentSecurityPolicy.cpp:25 (WebCore::ContentSecurityPolicy::allowConnectToSource const):26 (WebCore::ContentSecurityPolicy::reportViolation const):27 * page/csp/ContentSecurityPolicy.h:28 29 Source/WebKit:30 31 Currently for a blocked redirection we report the blocked URI as the32 target URL. This is not up to spec and we should actually report the33 requested URL.34 35 * NetworkProcess/NetworkLoadChecker.cpp:36 (WebKit::NetworkLoadChecker::check):37 (WebKit::NetworkLoadChecker::checkRedirection):38 (WebKit::NetworkLoadChecker::checkRequest):39 (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy):40 * NetworkProcess/NetworkLoadChecker.h:41 42 LayoutTests:43 44 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.45 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html: Added.46 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.47 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html: Added.48 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.49 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.50 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.51 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.52 WebKitLegacy and Win have different console logging.53 54 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281431 268f45cc-cd09-0410-ab3c-d52691b4dbfc55 56 2021-08-22 Kate Cheney <katherine_cheney@apple.com>57 58 Report correct blocked URI in CSP violation report59 https://bugs.webkit.org/show_bug.cgi?id=22631660 <rdar://problem/78552912>61 62 Reviewed by Alex Christensen.63 64 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.65 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html: Added.66 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.67 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html: Added.68 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.69 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.70 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.71 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.72 WebKitLegacy and Win have different console logging.73 74 1 2021-09-30 Russell Epstein <repstein@apple.com> 75 2 -
branches/safari-611.4.2.0-branch/Source/WebCore/ChangeLog
r283385 r283414 1 2021-10-01 Russell Epstein <repstein@apple.com>2 3 Cherry-pick r281431. rdar://problem/811756354 5 Report correct blocked URI in CSP violation report6 https://bugs.webkit.org/show_bug.cgi?id=2263167 <rdar://problem/78552912>8 9 Reviewed by Alex Christensen.10 11 Source/WebCore:12 13 Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html14 http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html15 16 Currently for a blocked redirection we report the blocked URI as the17 target URL. This is not up to spec and we should actually report the18 requested URL.19 20 * loader/DocumentThreadableLoader.cpp:21 (WebCore::DocumentThreadableLoader::redirectReceived):22 (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy):23 * loader/DocumentThreadableLoader.h:24 * page/csp/ContentSecurityPolicy.cpp:25 (WebCore::ContentSecurityPolicy::allowConnectToSource const):26 (WebCore::ContentSecurityPolicy::reportViolation const):27 * page/csp/ContentSecurityPolicy.h:28 29 Source/WebKit:30 31 Currently for a blocked redirection we report the blocked URI as the32 target URL. This is not up to spec and we should actually report the33 requested URL.34 35 * NetworkProcess/NetworkLoadChecker.cpp:36 (WebKit::NetworkLoadChecker::check):37 (WebKit::NetworkLoadChecker::checkRedirection):38 (WebKit::NetworkLoadChecker::checkRequest):39 (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy):40 * NetworkProcess/NetworkLoadChecker.h:41 42 LayoutTests:43 44 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.45 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html: Added.46 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.47 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html: Added.48 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.49 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.50 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.51 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.52 WebKitLegacy and Win have different console logging.53 54 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281431 268f45cc-cd09-0410-ab3c-d52691b4dbfc55 56 2021-08-22 Kate Cheney <katherine_cheney@apple.com>57 58 Report correct blocked URI in CSP violation report59 https://bugs.webkit.org/show_bug.cgi?id=22631660 <rdar://problem/78552912>61 62 Reviewed by Alex Christensen.63 64 Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html65 http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html66 67 Currently for a blocked redirection we report the blocked URI as the68 target URL. This is not up to spec and we should actually report the69 requested URL.70 71 * loader/DocumentThreadableLoader.cpp:72 (WebCore::DocumentThreadableLoader::redirectReceived):73 (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy):74 * loader/DocumentThreadableLoader.h:75 * page/csp/ContentSecurityPolicy.cpp:76 (WebCore::ContentSecurityPolicy::allowConnectToSource const):77 (WebCore::ContentSecurityPolicy::reportViolation const):78 * page/csp/ContentSecurityPolicy.h:79 80 1 2021-09-30 Russell Epstein <repstein@apple.com> 81 2 -
branches/safari-611.4.2.0-branch/Source/WebCore/loader/DocumentThreadableLoader.cpp
r283385 r283414 326 326 } 327 327 328 if (!isAllowedByContentSecurityPolicy(request.url(), redirectResponse.isNull() ? ContentSecurityPolicy::RedirectResponseReceived::No : ContentSecurityPolicy::RedirectResponseReceived::Yes , redirectResponse.url())) {328 if (!isAllowedByContentSecurityPolicy(request.url(), redirectResponse.isNull() ? ContentSecurityPolicy::RedirectResponseReceived::No : ContentSecurityPolicy::RedirectResponseReceived::Yes)) { 329 329 reportContentSecurityPolicyError(redirectResponse.url()); 330 330 clearResource(); … … 669 669 } 670 670 671 bool DocumentThreadableLoader::isAllowedByContentSecurityPolicy(const URL& url, ContentSecurityPolicy::RedirectResponseReceived redirectResponseReceived , const URL& preRedirectURL)671 bool DocumentThreadableLoader::isAllowedByContentSecurityPolicy(const URL& url, ContentSecurityPolicy::RedirectResponseReceived redirectResponseReceived) 672 672 { 673 673 switch (m_options.contentSecurityPolicyEnforcement) { … … 677 677 return contentSecurityPolicy().allowChildContextFromSource(url, redirectResponseReceived); 678 678 case ContentSecurityPolicyEnforcement::EnforceConnectSrcDirective: 679 return contentSecurityPolicy().allowConnectToSource(url, redirectResponseReceived , preRedirectURL);679 return contentSecurityPolicy().allowConnectToSource(url, redirectResponseReceived); 680 680 case ContentSecurityPolicyEnforcement::EnforceScriptSrcDirective: 681 681 return contentSecurityPolicy().allowScriptFromSource(url, redirectResponseReceived); -
branches/safari-611.4.2.0-branch/Source/WebCore/loader/DocumentThreadableLoader.h
r283385 r283414 104 104 void loadRequest(ResourceRequest&&, SecurityCheckPolicy); 105 105 bool isAllowedRedirect(const URL&); 106 bool isAllowedByContentSecurityPolicy(const URL&, ContentSecurityPolicy::RedirectResponseReceived , const URL& preRedirectURL = URL());106 bool isAllowedByContentSecurityPolicy(const URL&, ContentSecurityPolicy::RedirectResponseReceived); 107 107 108 108 SecurityOrigin& securityOrigin() const; -
branches/safari-611.4.2.0-branch/Source/WebCore/page/csp/ContentSecurityPolicy.cpp
r283385 r283414 619 619 } 620 620 621 bool ContentSecurityPolicy::allowConnectToSource(const URL& url, RedirectResponseReceived redirectResponseReceived , const URL& preRedirectURL) const621 bool ContentSecurityPolicy::allowConnectToSource(const URL& url, RedirectResponseReceived redirectResponseReceived) const 622 622 { 623 623 if (LegacySchemeRegistry::schemeShouldBypassContentSecurityPolicy(url.protocol().toStringWithoutCopying())) … … 627 627 auto handleViolatedDirective = [&] (const ContentSecurityPolicyDirective& violatedDirective) { 628 628 String consoleMessage = consoleMessageForViolation(ContentSecurityPolicyDirectiveNames::connectSrc, violatedDirective, url, "Refused to connect to"); 629 reportViolation(ContentSecurityPolicyDirectiveNames::connectSrc, violatedDirective, url, consoleMessage, sourceURL, sourcePosition , preRedirectURL);629 reportViolation(ContentSecurityPolicyDirectiveNames::connectSrc, violatedDirective, url, consoleMessage, sourceURL, sourcePosition); 630 630 }; 631 631 return allPoliciesAllow(WTFMove(handleViolatedDirective), &ContentSecurityPolicyDirectiveList::violatedDirectiveForConnectSource, url, redirectResponseReceived == RedirectResponseReceived::Yes); … … 678 678 } 679 679 680 void ContentSecurityPolicy::reportViolation(const String& effectiveViolatedDirective, const ContentSecurityPolicyDirective& violatedDirective, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, const URL& preRedirectURL,JSC::JSGlobalObject* state) const681 { 682 return reportViolation(effectiveViolatedDirective, violatedDirective.text(), violatedDirective.directiveList(), blockedURL, consoleMessage, sourceURL, sourcePosition, state , preRedirectURL);683 } 684 685 void ContentSecurityPolicy::reportViolation(const String& effectiveViolatedDirective, const String& violatedDirective, const ContentSecurityPolicyDirectiveList& violatedDirectiveList, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, JSC::JSGlobalObject* state , const URL& preRedirectURL) const680 void ContentSecurityPolicy::reportViolation(const String& effectiveViolatedDirective, const ContentSecurityPolicyDirective& violatedDirective, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, JSC::JSGlobalObject* state) const 681 { 682 return reportViolation(effectiveViolatedDirective, violatedDirective.text(), violatedDirective.directiveList(), blockedURL, consoleMessage, sourceURL, sourcePosition, state); 683 } 684 685 void ContentSecurityPolicy::reportViolation(const String& effectiveViolatedDirective, const String& violatedDirective, const ContentSecurityPolicyDirectiveList& violatedDirectiveList, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, JSC::JSGlobalObject* state) const 686 686 { 687 687 logToConsole(consoleMessage, sourceURL, sourcePosition.m_line, sourcePosition.m_column, state); … … 718 718 ASSERT(m_client || is<Document>(m_scriptExecutionContext)); 719 719 720 String blockedURI; 721 if (preRedirectURL.isNull()) 722 blockedURI = deprecatedURLForReporting(blockedURL); 723 else 724 blockedURI = deprecatedURLForReporting(preRedirectURL); 725 720 String blockedURI = deprecatedURLForReporting(blockedURL); 726 721 // FIXME: Is it policy to not use the status code for HTTPS, or is that a bug? 727 722 unsigned short httpStatusCode = m_selfSourceProtocol == "http" ? m_httpStatusCode : 0; -
branches/safari-611.4.2.0-branch/Source/WebCore/page/csp/ContentSecurityPolicy.h
r283385 r283414 115 115 bool allowChildFrameFromSource(const URL&, RedirectResponseReceived = RedirectResponseReceived::No) const; 116 116 WEBCORE_EXPORT bool allowChildContextFromSource(const URL&, RedirectResponseReceived = RedirectResponseReceived::No) const; 117 WEBCORE_EXPORT bool allowConnectToSource(const URL&, RedirectResponseReceived = RedirectResponseReceived::No , const URL& requestedURL = URL()) const;117 WEBCORE_EXPORT bool allowConnectToSource(const URL&, RedirectResponseReceived = RedirectResponseReceived::No) const; 118 118 bool allowFormAction(const URL&, RedirectResponseReceived = RedirectResponseReceived::No) const; 119 119 … … 211 211 void reportViolation(const String& effectiveViolatedDirective, const ContentSecurityPolicyDirective& violatedDirective, const URL& blockedURL, const String& consoleMessage, JSC::JSGlobalObject*) const; 212 212 void reportViolation(const String& effectiveViolatedDirective, const String& violatedDirective, const ContentSecurityPolicyDirectiveList&, const URL& blockedURL, const String& consoleMessage, JSC::JSGlobalObject* = nullptr) const; 213 void reportViolation(const String& effectiveViolatedDirective, const ContentSecurityPolicyDirective& violatedDirective, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, const URL& preRedirectURL = URL(),JSC::JSGlobalObject* = nullptr) const;214 void reportViolation(const String& effectiveViolatedDirective, const String& violatedDirective, const ContentSecurityPolicyDirectiveList& violatedDirectiveList, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, JSC::JSGlobalObject* , const URL& preRedirectURL = URL()) const;213 void reportViolation(const String& effectiveViolatedDirective, const ContentSecurityPolicyDirective& violatedDirective, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, JSC::JSGlobalObject* = nullptr) const; 214 void reportViolation(const String& effectiveViolatedDirective, const String& violatedDirective, const ContentSecurityPolicyDirectiveList& violatedDirectiveList, const URL& blockedURL, const String& consoleMessage, const String& sourceURL, const TextPosition& sourcePosition, JSC::JSGlobalObject*) const; 215 215 void reportBlockedScriptExecutionToInspector(const String& directiveText) const; 216 216 -
branches/safari-611.4.2.0-branch/Source/WebKit/ChangeLog
r283385 r283414 1 2021-10-01 Russell Epstein <repstein@apple.com>2 3 Cherry-pick r281431. rdar://problem/811756354 5 Report correct blocked URI in CSP violation report6 https://bugs.webkit.org/show_bug.cgi?id=2263167 <rdar://problem/78552912>8 9 Reviewed by Alex Christensen.10 11 Source/WebCore:12 13 Tests: http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html14 http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html15 16 Currently for a blocked redirection we report the blocked URI as the17 target URL. This is not up to spec and we should actually report the18 requested URL.19 20 * loader/DocumentThreadableLoader.cpp:21 (WebCore::DocumentThreadableLoader::redirectReceived):22 (WebCore::DocumentThreadableLoader::isAllowedByContentSecurityPolicy):23 * loader/DocumentThreadableLoader.h:24 * page/csp/ContentSecurityPolicy.cpp:25 (WebCore::ContentSecurityPolicy::allowConnectToSource const):26 (WebCore::ContentSecurityPolicy::reportViolation const):27 * page/csp/ContentSecurityPolicy.h:28 29 Source/WebKit:30 31 Currently for a blocked redirection we report the blocked URI as the32 target URL. This is not up to spec and we should actually report the33 requested URL.34 35 * NetworkProcess/NetworkLoadChecker.cpp:36 (WebKit::NetworkLoadChecker::check):37 (WebKit::NetworkLoadChecker::checkRedirection):38 (WebKit::NetworkLoadChecker::checkRequest):39 (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy):40 * NetworkProcess/NetworkLoadChecker.h:41 42 LayoutTests:43 44 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.45 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect.html: Added.46 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.47 * http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects.html: Added.48 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.49 * platform/mac-wk1/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.50 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-blocked-redirect-expected.txt: Added.51 * platform/win/http/tests/security/contentSecurityPolicy/report-blocked-uri-after-multiple-redirects-expected.txt: Added.52 WebKitLegacy and Win have different console logging.53 54 git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281431 268f45cc-cd09-0410-ab3c-d52691b4dbfc55 56 2021-08-22 Kate Cheney <katherine_cheney@apple.com>57 58 Report correct blocked URI in CSP violation report59 https://bugs.webkit.org/show_bug.cgi?id=22631660 <rdar://problem/78552912>61 62 Reviewed by Alex Christensen.63 64 Currently for a blocked redirection we report the blocked URI as the65 target URL. This is not up to spec and we should actually report the66 requested URL.67 68 * NetworkProcess/NetworkLoadChecker.cpp:69 (WebKit::NetworkLoadChecker::check):70 (WebKit::NetworkLoadChecker::checkRedirection):71 (WebKit::NetworkLoadChecker::checkRequest):72 (WebKit::NetworkLoadChecker::isAllowedByContentSecurityPolicy):73 * NetworkProcess/NetworkLoadChecker.h:74 75 1 2021-08-10 Russell Epstein <repstein@apple.com> 76 2 -
branches/safari-611.4.2.0-branch/Source/WebKit/NetworkProcess/NetworkLoadChecker.h
r283385 r283414 104 104 bool isRedirected() const { return m_redirectCount; } 105 105 106 void checkRequest(WebCore::ResourceRequest&&, WebCore::ContentSecurityPolicyClient*, const URL&,ValidationHandler&&);106 void checkRequest(WebCore::ResourceRequest&&, WebCore::ContentSecurityPolicyClient*, ValidationHandler&&); 107 107 108 bool isAllowedByContentSecurityPolicy(const WebCore::ResourceRequest&, WebCore::ContentSecurityPolicyClient* , const URL& preRedirectURL = URL());108 bool isAllowedByContentSecurityPolicy(const WebCore::ResourceRequest&, WebCore::ContentSecurityPolicyClient*); 109 109 110 110 void continueCheckingRequest(WebCore::ResourceRequest&&, ValidationHandler&&);
Note:
See TracChangeset
for help on using the changeset viewer.