Changeset 276193 in webkit
- Timestamp:
- Apr 16, 2021, 8:22:00 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 29 edited
- 4 copied
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/loader/cancel-load-during-port-block-timer-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/cache/cancel-during-failure-crash-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/preload/download_resources_from_invalid_headers-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/preload/resources/nph-invalid_resources_from_header.pl (modified) (1 diff)
-
LayoutTests/http/tests/security/blocked-on-redirect-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/security/form-blocked-port-expected.txt (added)
-
LayoutTests/http/tests/security/form-blocked-port.html (added)
-
LayoutTests/http/tests/xmlhttprequest/cross-origin-redirect-responseURL-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/xmlhttprequest/redirect-cross-origin-2-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/xmlhttprequest/redirect-cross-origin-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt (modified) (1 diff)
-
LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post.html (modified) (1 diff)
-
LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events.html (modified) (1 diff)
-
LayoutTests/http/wpt/beacon/beacon-async-error-logging-expected.txt (modified) (1 diff)
-
LayoutTests/http/wpt/beacon/beacon-async-error-logging.html (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt (copied) (copied from trunk/LayoutTests/http/tests/xmlhttprequest/redirect-cross-origin-2-expected.txt ) (1 diff)
-
LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt (copied) (copied from trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt ) (1 diff)
-
LayoutTests/platform/win/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt (copied) (copied from trunk/LayoutTests/http/tests/xmlhttprequest/redirect-cross-origin-2-expected.txt ) (1 diff)
-
LayoutTests/platform/win/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt (copied) (copied from trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt ) (1 diff)
-
LayoutTests/platform/wk2/http/tests/security/blocked-on-redirect-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/HTMLMediaElement.cpp (modified) (1 diff)
-
Source/WebCore/loader/DocumentLoader.cpp (modified) (1 diff)
-
Source/WebCore/loader/FrameLoader.cpp (modified) (2 diffs)
-
Source/WebCore/loader/FrameLoader.h (modified) (1 diff)
-
Source/WebCore/loader/PingLoader.cpp (modified) (1 diff)
-
Source/WebCore/loader/ResourceLoader.cpp (modified) (1 diff)
-
Source/WebCore/loader/SubframeLoader.cpp (modified) (2 diffs)
-
Source/WebCore/loader/SubresourceLoader.cpp (modified) (1 diff)
-
Source/WebCore/loader/cache/CachedResourceLoader.cpp (modified) (1 diff)
-
Tools/ChangeLog (modified) (1 diff)
-
Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r276188 r276193 1 2021-04-16 Brent Fulgham <bfulgham@apple.com> 2 3 Perform port blocking earlier in the load 4 https://bugs.webkit.org/show_bug.cgi?id=224525 5 <rdar://problem/75440591> 6 7 Reviewed by Darin Adler. 8 9 WebKit blocks loads to URLs with any of the prohibited ports defined in 10 the engine. This blocking happens late in the load process, allowing 11 connections to be made (and observed). Instead, we should stop the load 12 early, at the same time we perform other checks. 13 14 Note: The fact that we now block loads earlier means that we do not fire 15 'willSendRequestForFrame' for blocked ports, so WebKitTestRunner no longer 16 outputs a message to stdout. Those errors are reported in the JS console, 17 but since some test paths are specified to always output JS console messages 18 to stderrr (for example the WPT tests), we have to revise out test expectations 19 for a few cases. 20 21 * fast/loader/cancel-load-during-port-block-timer.html: Revised expectation to reflect new console error message. 22 * http/tests/cache/cancel-during-failure-crash-expected.txt: Ditto. 23 * http/tests/preload/download_resources_from_invalid_headers-expected.txt: Update to reflect a preflight is not executed 24 for a blocked port. 25 * http/tests/preload/resources/nph-invalid_resources_from_header.pl: Update to reflect that we do not preload 26 from restricted ports. 27 * http/tests/security/blocked-on-redirect-expected.txt: Revised expectation to match revised error message. 28 * http/tests/security/form-blocked-port.html: Added. 29 * http/tests/security/form-blocked-port-expected.txt: Added. 30 * http/tests/xmlhttprequest/cross-origin-redirect-responseURL-expected.txt: Revised expectation for revised error message. 31 * http/tests/xmlhttprequest/redirect-cross-origin-2-expected.txt: Ditto. 32 * http/tests/xmlhttprequest/redirect-cross-origin-expected.txt: Ditto. 33 * http/tests/xmlhttprequest/simple-cross-origin-denied-events.html: Instead of using a port WebKit blocks (7), use one that 34 is not blocked but is unlikely to be active (as originally intended). This retains the expected test behavior since we now 35 block loads to restricted ports earlier in the load process. 36 * http/tests/xmlhttprequest/simple-cross-origin-denied-events-post.html: Ditto. 37 * http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Update test output to reflect that we 38 are attempting to load from port 8 instead of port 7. 39 * http/wpt/beacon/beacon-async-error-logging-expected.txt: Ditto. 40 * http/wpt/beacon/beacon-async-error-logging.html: Update to reflect a preflight is not executed 41 for a blocked port. 42 * imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt: Since we block before executing the load, 43 TestRunner no longer outputs an error message to stdout. Instead, they appear in stderr (since all 'wpt' tests are marked 44 to dump console.log output to stderr). 45 * imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt: Ditto. 46 * platform/mac-wk1/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt: Revise to reflect change in console 47 logging (the functional test results are identical). 48 * platform/mac-wk1/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Ditto. 49 * platform/win/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt: Ditto. 50 * platform/win/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt: Ditto. 51 * platform/wk2/http/tests/security/blocked-on-redirect-expected.txt: Ditto. 52 1 53 2021-04-16 Chris Dumez <cdumez@apple.com> 2 54 -
trunk/LayoutTests/fast/loader/cancel-load-during-port-block-timer-expected.txt
r31434 r276193 1 CONSOLE MESSAGE: Not allowed to use restricted network port 22: http://127.0.0.1:22/ 1 2 If this does crash, the test has passed. -
trunk/LayoutTests/http/tests/cache/cancel-during-failure-crash-expected.txt
r115223 r276193 1 CONSOLE MESSAGE: Not allowed to use restricted network port 7: http://localhost:7/ 1 2 PASS -
trunk/LayoutTests/http/tests/preload/download_resources_from_invalid_headers-expected.txt
r231450 r276193 19 19 PASS internals.isPreloaded('../resources/dumm'); is false 20 20 PASS internals.isPreloaded('http://localhost:8000/preload/resources/square.png'); is false 21 PASS internals.isPreloaded('http://localhost:53/preload/resources/dummy.js'); is true21 PASS internals.isPreloaded('http://localhost:53/preload/resources/dummy.js'); is false 22 22 PASS internals.isPreloaded('#foobar'); is false 23 23 PASS internals.isPreloaded('../resources/Ahem.ttf'); is false -
trunk/LayoutTests/http/tests/preload/resources/nph-invalid_resources_from_header.pl
r217962 r276193 44 44 shouldBeFalse("internals.isPreloaded('../resources/dumm');"); 45 45 shouldBeFalse("internals.isPreloaded('http://localhost:8000/preload/resources/square.png');"); 46 // Invalid ports get preloaded (and get terminated further down the stack). 47 shouldBeTrue("internals.isPreloaded('http://localhost:53/preload/resources/dummy.js');"); 46 shouldBeFalse("internals.isPreloaded('http://localhost:53/preload/resources/dummy.js');"); 48 47 shouldBeFalse("internals.isPreloaded('#foobar');"); 49 48 shouldBeFalse("internals.isPreloaded('../resources/Ahem.ttf');"); -
trunk/LayoutTests/http/tests/security/blocked-on-redirect-expected.txt
r272981 r276193 1 1 http://127.0.0.1:8000/resources/redirect.py?code=307&url=http://localhost:25/security/resources/post-done.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/resources/redirect.py?code=307&url=http://localhost:25/security/resources/post-done.html, main document URL http://127.0.0.1:8000/security/blocked-on-redirect.html, http method GET> redirectResponse (null) 2 2 http://127.0.0.1:8000/security/blocked-on-redirect.html - didFinishLoading 3 CONSOLE MESSAGE: Not allowed to use restricted network port : http://localhost:25/security/resources/post-done.html3 CONSOLE MESSAGE: Not allowed to use restricted network port 25: http://localhost:25/security/resources/post-done.html 4 4 http://127.0.0.1:8000/resources/redirect.py?code=307&url=http://localhost:25/security/resources/post-done.html - didFailLoadingWithError: <NSError domain WebKitErrorDomain, code 103, failing URL "http://localhost:25/security/resources/post-done.html"> 5 5 This test produces output in the console. Only the initial URL should be logged. -
trunk/LayoutTests/http/tests/xmlhttprequest/cross-origin-redirect-responseURL-expected.txt
r267644 r276193 1 CONSOLE MESSAGE: Not allowed to use restricted network port 7: http://localhost:7/ 2 CONSOLE MESSAGE: Not allowed to use restricted network port 22: http://localhost:22/ 1 3 Test XMLHttpRequest responseURL. 2 4 -
trunk/LayoutTests/http/tests/xmlhttprequest/redirect-cross-origin-2-expected.txt
r205473 r276193 1 1 CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 2 2 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/reply.xml due to access control checks. 3 CONSOLE MESSAGE: Not allowed to use restricted network port 22: http://localhost:22/ 3 4 Test that a cross-origin redirect to a server that responds is indistinguishable from one that does not. Should say PASS: 4 5 -
trunk/LayoutTests/http/tests/xmlhttprequest/redirect-cross-origin-expected.txt
r205473 r276193 1 1 CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 2 2 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/reply.xml due to access control checks. 3 CONSOLE MESSAGE: Not allowed to use restricted network port 7: http://localhost:7/ 3 4 Test that a cross-origin redirect to a server that responds is indistinguishable from one that does not. Should say PASS: 4 5 -
trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt
r231056 r276193 1 1 CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 2 2 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/reply.xml due to access control checks. 3 CONSOLE MESSAGE: C ORS-preflight request was blocked4 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost: 7/ due to access control checks.3 CONSOLE MESSAGE: Could not connect to the server. 4 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8/ due to access control checks. 5 5 Test that a simple cross-origin request to a server that responds (but does not permit cross-origin requests) is indistinguishable from one that does not exist. Should say PASS: 6 6 -
trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post.html
r120167 r276193 37 37 xhr.upload.onloadstart = function() { log("upload.onloadstart") } 38 38 xhr.upload.onprogress = function() { log("upload.onprogress") } 39 xhr.open("POST", "http://localhost: 7/", true); // A port that will likely refuse the connection.39 xhr.open("POST", "http://localhost:8/", true); // A port that will likely refuse the connection. 40 40 xhr.setRequestHeader("Content-Type", "text/plain"); 41 41 xhr.send("Text"); -
trunk/LayoutTests/http/tests/xmlhttprequest/simple-cross-origin-denied-events.html
r120167 r276193 32 32 xhr.onprogress = function() { log("onprogress") } 33 33 xhr.onerror = function() { log("onerror"); setTimeout(doneMissing, 100); } 34 xhr.open("GET", "http://localhost: 7/", true); // A port that will likely refuse the connection.34 xhr.open("GET", "http://localhost:8/", true); // A port that will likely refuse the connection. 35 35 xhr.send(); 36 }36 } 37 37 38 38 function doneMissing() -
trunk/LayoutTests/http/wpt/beacon/beacon-async-error-logging-expected.txt
r267644 r276193 1 CONSOLE MESSAGE: Not allowed to use restricted network port 1: http://localhost:1/ 1 2 CONSOLE MESSAGE: Beacon API cannot load http://localhost:1/. Not allowed to use restricted network port 2 3 -
trunk/LayoutTests/http/wpt/beacon/beacon-async-error-logging.html
r244700 r276193 16 16 } 17 17 let hostWithInvalidPort = "http://localhost:1"; 18 assert_ true(navigator.sendBeacon(hostWithInvalidPort, 'test'), "sendBeacon should return true");18 assert_false(navigator.sendBeacon(hostWithInvalidPort, 'test'), "sendBeacon should return true"); 19 19 }, "Should log an error message in the console"); 20 20 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any-expected.txt
r275831 r276193 1 Blocked access to external URL http://example.com:1/2 Blocked access to external URL http://example.com:7/3 Blocked access to external URL http://example.com:9/4 Blocked access to external URL http://example.com:11/5 Blocked access to external URL http://example.com:13/6 Blocked access to external URL http://example.com:15/7 Blocked access to external URL http://example.com:17/8 Blocked access to external URL http://example.com:19/9 Blocked access to external URL http://example.com:20/10 Blocked access to external URL http://example.com:21/11 Blocked access to external URL http://example.com:22/12 Blocked access to external URL http://example.com:23/13 Blocked access to external URL http://example.com:25/14 Blocked access to external URL http://example.com:37/15 Blocked access to external URL http://example.com:42/16 Blocked access to external URL http://example.com:43/17 Blocked access to external URL http://example.com:53/18 Blocked access to external URL http://example.com:69/19 Blocked access to external URL http://example.com:77/20 Blocked access to external URL http://example.com:79/21 Blocked access to external URL http://example.com:87/22 Blocked access to external URL http://example.com:95/23 Blocked access to external URL http://example.com:101/24 Blocked access to external URL http://example.com:102/25 Blocked access to external URL http://example.com:103/26 Blocked access to external URL http://example.com:104/27 Blocked access to external URL http://example.com:109/28 Blocked access to external URL http://example.com:110/29 Blocked access to external URL http://example.com:111/30 Blocked access to external URL http://example.com:113/31 Blocked access to external URL http://example.com:115/32 Blocked access to external URL http://example.com:117/33 Blocked access to external URL http://example.com:119/34 Blocked access to external URL http://example.com:123/35 Blocked access to external URL http://example.com:135/36 Blocked access to external URL http://example.com:137/37 Blocked access to external URL http://example.com:139/38 Blocked access to external URL http://example.com:143/39 Blocked access to external URL http://example.com:161/40 Blocked access to external URL http://example.com:179/41 Blocked access to external URL http://example.com:389/42 Blocked access to external URL http://example.com:427/43 Blocked access to external URL http://example.com:465/44 Blocked access to external URL http://example.com:512/45 Blocked access to external URL http://example.com:513/46 Blocked access to external URL http://example.com:514/47 Blocked access to external URL http://example.com:515/48 Blocked access to external URL http://example.com:526/49 Blocked access to external URL http://example.com:530/50 Blocked access to external URL http://example.com:531/51 Blocked access to external URL http://example.com:532/52 Blocked access to external URL http://example.com:540/53 Blocked access to external URL http://example.com:548/54 Blocked access to external URL http://example.com:554/55 Blocked access to external URL http://example.com:556/56 Blocked access to external URL http://example.com:563/57 Blocked access to external URL http://example.com:587/58 Blocked access to external URL http://example.com:601/59 Blocked access to external URL http://example.com:636/60 Blocked access to external URL http://example.com:993/61 Blocked access to external URL http://example.com:995/62 Blocked access to external URL http://example.com:2049/63 Blocked access to external URL http://example.com:1719/64 Blocked access to external URL http://example.com:1720/65 Blocked access to external URL http://example.com:1723/66 Blocked access to external URL http://example.com:3659/67 Blocked access to external URL http://example.com:4045/68 Blocked access to external URL http://example.com:5060/69 Blocked access to external URL http://example.com:5061/70 Blocked access to external URL http://example.com:6000/71 Blocked access to external URL http://example.com:6566/72 Blocked access to external URL http://example.com:6665/73 Blocked access to external URL http://example.com:6666/74 Blocked access to external URL http://example.com:6667/75 Blocked access to external URL http://example.com:6668/76 Blocked access to external URL http://example.com:6669/77 Blocked access to external URL http://example.com:6697/78 Blocked access to external URL http://example.com:10080/79 1 80 2 PASS Request on bad port 1 should throw TypeError. -
trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-bad-port.any.worker-expected.txt
r275831 r276193 1 Blocked access to external URL http://example.com:1/2 Blocked access to external URL http://example.com:7/3 Blocked access to external URL http://example.com:9/4 Blocked access to external URL http://example.com:11/5 Blocked access to external URL http://example.com:13/6 Blocked access to external URL http://example.com:15/7 Blocked access to external URL http://example.com:17/8 Blocked access to external URL http://example.com:19/9 Blocked access to external URL http://example.com:20/10 Blocked access to external URL http://example.com:21/11 Blocked access to external URL http://example.com:22/12 Blocked access to external URL http://example.com:23/13 Blocked access to external URL http://example.com:25/14 Blocked access to external URL http://example.com:37/15 Blocked access to external URL http://example.com:42/16 Blocked access to external URL http://example.com:43/17 Blocked access to external URL http://example.com:53/18 Blocked access to external URL http://example.com:69/19 Blocked access to external URL http://example.com:77/20 Blocked access to external URL http://example.com:79/21 Blocked access to external URL http://example.com:87/22 Blocked access to external URL http://example.com:95/23 Blocked access to external URL http://example.com:101/24 Blocked access to external URL http://example.com:102/25 Blocked access to external URL http://example.com:103/26 Blocked access to external URL http://example.com:104/27 Blocked access to external URL http://example.com:109/28 Blocked access to external URL http://example.com:110/29 Blocked access to external URL http://example.com:111/30 Blocked access to external URL http://example.com:113/31 Blocked access to external URL http://example.com:115/32 Blocked access to external URL http://example.com:117/33 Blocked access to external URL http://example.com:119/34 Blocked access to external URL http://example.com:123/35 Blocked access to external URL http://example.com:135/36 Blocked access to external URL http://example.com:137/37 Blocked access to external URL http://example.com:139/38 Blocked access to external URL http://example.com:143/39 Blocked access to external URL http://example.com:161/40 Blocked access to external URL http://example.com:179/41 Blocked access to external URL http://example.com:389/42 Blocked access to external URL http://example.com:427/43 Blocked access to external URL http://example.com:465/44 Blocked access to external URL http://example.com:512/45 Blocked access to external URL http://example.com:513/46 Blocked access to external URL http://example.com:514/47 Blocked access to external URL http://example.com:515/48 Blocked access to external URL http://example.com:526/49 Blocked access to external URL http://example.com:530/50 Blocked access to external URL http://example.com:531/51 Blocked access to external URL http://example.com:532/52 Blocked access to external URL http://example.com:540/53 Blocked access to external URL http://example.com:548/54 Blocked access to external URL http://example.com:554/55 Blocked access to external URL http://example.com:556/56 Blocked access to external URL http://example.com:563/57 Blocked access to external URL http://example.com:587/58 Blocked access to external URL http://example.com:601/59 Blocked access to external URL http://example.com:636/60 Blocked access to external URL http://example.com:993/61 Blocked access to external URL http://example.com:995/62 Blocked access to external URL http://example.com:2049/63 Blocked access to external URL http://example.com:1719/64 Blocked access to external URL http://example.com:1720/65 Blocked access to external URL http://example.com:1723/66 Blocked access to external URL http://example.com:3659/67 Blocked access to external URL http://example.com:4045/68 Blocked access to external URL http://example.com:5060/69 Blocked access to external URL http://example.com:5061/70 Blocked access to external URL http://example.com:6000/71 Blocked access to external URL http://example.com:6566/72 Blocked access to external URL http://example.com:6665/73 Blocked access to external URL http://example.com:6666/74 Blocked access to external URL http://example.com:6667/75 Blocked access to external URL http://example.com:6668/76 Blocked access to external URL http://example.com:6669/77 Blocked access to external URL http://example.com:6697/78 Blocked access to external URL http://example.com:10080/79 1 80 2 PASS Request on bad port 1 should throw TypeError. -
trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt
r276192 r276193 1 1 CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 2 2 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/reply.xml due to access control checks. 3 CONSOLE MESSAGE: Not allowed to use restricted network port 7: http://localhost:7/ 3 4 Test that a cross-origin redirect to a server that responds is indistinguishable from one that does not. Should say PASS: 4 5 -
trunk/LayoutTests/platform/mac-wk1/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt
r276192 r276193 2 2 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/reply.xml due to access control checks. 3 3 CONSOLE MESSAGE: CORS-preflight request was blocked 4 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost: 7/ due to access control checks.4 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8/ due to access control checks. 5 5 Test that a simple cross-origin request to a server that responds (but does not permit cross-origin requests) is indistinguishable from one that does not exist. Should say PASS: 6 6 -
trunk/LayoutTests/platform/win/http/tests/xmlhttprequest/redirect-cross-origin-post-expected.txt
r276192 r276193 1 1 CONSOLE MESSAGE: Origin http://127.0.0.1:8000 is not allowed by Access-Control-Allow-Origin. 2 2 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/reply.xml due to access control checks. 3 CONSOLE MESSAGE: Not allowed to use restricted network port 7: http://localhost:7/ 3 4 Test that a cross-origin redirect to a server that responds is indistinguishable from one that does not. Should say PASS: 4 5 -
trunk/LayoutTests/platform/win/http/tests/xmlhttprequest/simple-cross-origin-denied-events-post-expected.txt
r276192 r276193 2 2 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8000/xmlhttprequest/resources/reply.xml due to access control checks. 3 3 CONSOLE MESSAGE: CORS-preflight request was blocked 4 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost: 7/ due to access control checks.4 CONSOLE MESSAGE: XMLHttpRequest cannot load http://localhost:8/ due to access control checks. 5 5 Test that a simple cross-origin request to a server that responds (but does not permit cross-origin requests) is indistinguishable from one that does not exist. Should say PASS: 6 6 -
trunk/LayoutTests/platform/wk2/http/tests/security/blocked-on-redirect-expected.txt
r272981 r276193 1 1 http://127.0.0.1:8000/security/blocked-on-redirect.html - didFinishLoading 2 2 http://127.0.0.1:8000/resources/redirect.py?code=307&url=http://localhost:25/security/resources/post-done.html - willSendRequest <NSURLRequest URL http://127.0.0.1:8000/resources/redirect.py?code=307&url=http://localhost:25/security/resources/post-done.html, main document URL http://127.0.0.1:8000/security/blocked-on-redirect.html, http method GET> redirectResponse (null) 3 CONSOLE MESSAGE: Not allowed to use restricted network port : http://localhost:25/security/resources/post-done.html3 CONSOLE MESSAGE: Not allowed to use restricted network port 25: http://localhost:25/security/resources/post-done.html 4 4 http://127.0.0.1:8000/resources/redirect.py?code=307&url=http://localhost:25/security/resources/post-done.html - didFailLoadingWithError: <NSError domain WebKitErrorDomain, code 103, failing URL "http://localhost:25/security/resources/post-done.html"> 5 5 This test produces output in the console. Only the initial URL should be logged. -
trunk/Source/WebCore/ChangeLog
r276192 r276193 1 2021-04-16 Brent Fulgham <bfulgham@apple.com> 2 3 Perform port blocking earlier in the load 4 https://bugs.webkit.org/show_bug.cgi?id=224525 5 <rdar://problem/75440591> 6 7 Reviewed by Darin Adler. 8 9 WebKit blocks loads to URLs with any of the prohibited ports defined in 10 the engine. This blocking happens late in the load process, allowing 11 connections to be made (and observed). Instead, we should stop the load 12 early, at the same time we perform other checks. 13 14 Test: http/tests/security/form-blocked-port.html 15 16 * html/HTMLMediaElement.cpp: 17 (WebCore::HTMLMediaElement::isSafeToLoadURL): Add a check for prohibited ports, 18 and block (with relevant logging) if a load to a denied port is attempted. 19 * loader/DocumentLoader.cpp: 20 (WebCore::DocumentLoader::willSendRequest): Ditto. 21 * loader/FrameLoader.cpp: 22 (WebCore::FrameLoader::loadFrameRequest): Ditto. 23 (WebCore::FrameLoader::reportBlockedLoadFailed): Ditto. 24 * loader/FrameLoader.h: 25 * loader/PingLoader.cpp: 26 (WebCore::PingLoader::loadImage): Ditto. 27 * loader/ResourceLoader.cpp: 28 (WebCore::ResourceLoader::init): Ditto. 29 * loader/SubframeLoader.cpp: 30 (WebCore::FrameLoader::SubframeLoader::pluginIsLoadable): Ditto. 31 (WebCore::FrameLoader::SubframeLoader::loadSubframe): Ditto. 32 * loader/cache/CachedResourceLoader.cpp: 33 (WebCore::CachedResourceLoader::canRequest): Ditto. 34 (WebCore::CachedResourceLoader::canRequestAfterRedirection const): Ditto. 35 1 36 2021-04-16 Basuke Suzuki <basuke.suzuki@sony.com> 2 37 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r275949 r276193 2015 2015 } 2016 2016 2017 if (!portAllowed(url)) { 2018 if (actionIfInvalid == Complain) { 2019 if (frame) 2020 FrameLoader::reportBlockedLoadFailed(*frame, url); 2021 ERROR_LOG(LOGIDENTIFIER, url , " was rejected because the port is not allowed"); 2022 } 2023 return false; 2024 } 2025 2017 2026 if (!isAllowedToLoadMediaURL(*this, url, isInUserAgentShadowTree())) { 2018 2027 ERROR_LOG(LOGIDENTIFIER, url, " was rejected by Content Security Policy"); -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r275817 r276193 632 632 } 633 633 if (!portAllowed(newRequest.url())) { 634 RELEASE_LOG_IF_ALLOWED("willSendRequest: canceling - port not allowed"); 635 if (m_frame) 636 m_frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to use restricted network port: " + newRequest.url().string()); 634 RELEASE_LOG_IF_ALLOWED("willSendRequest: canceling - redirecting to a URL with a blocked port"); 635 FrameLoader::reportBlockedLoadFailed(*m_frame, newRequest.url()); 637 636 cancelMainResourceLoad(frameLoader()->blockedError(newRequest)); 638 637 return completionHandler(WTFMove(newRequest)); -
trunk/Source/WebCore/loader/FrameLoader.cpp
r275078 r276193 1227 1227 ASSERT(m_frame.document()); 1228 1228 if (!request.requesterSecurityOrigin().canDisplay(url)) { 1229 FRAMELOADER_RELEASE_LOG_IF_ALLOWED(ResourceLoading, "loadFrameRequest: canceling - Not allowed to load local resource"); 1229 1230 reportLocalLoadFailed(&m_frame, url.stringCenterEllipsizedToLength()); 1230 1231 return; 1231 1232 } 1232 1233 1234 if (!portAllowed(url)) { 1235 FRAMELOADER_RELEASE_LOG_IF_ALLOWED(ResourceLoading, "loadFrameRequest: canceling - port not allowed"); 1236 reportBlockedLoadFailed(m_frame, url); 1237 return; 1238 } 1239 1233 1240 String argsReferrer = request.resourceRequest().httpReferrer(); 1234 1241 if (argsReferrer.isEmpty()) … … 1638 1645 1639 1646 frame->document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, "Not allowed to load local resource: " + url); 1647 } 1648 1649 void FrameLoader::reportBlockedLoadFailed(Frame& frame, const URL& url) 1650 { 1651 ASSERT(!url.isEmpty()); 1652 auto message = makeString("Not allowed to use restricted network port ", url.port().value(), ": ", url.stringCenterEllipsizedToLength()); 1653 frame.document()->addConsoleMessage(MessageSource::Security, MessageLevel::Error, message); 1640 1654 } 1641 1655 -
trunk/Source/WebCore/loader/FrameLoader.h
r272122 r276193 142 142 143 143 static void reportLocalLoadFailed(Frame*, const String& url); 144 static void reportBlockedLoadFailed(Frame&, const URL&); 144 145 145 146 // FIXME: These are all functions which stop loads. We have too many. -
trunk/Source/WebCore/loader/PingLoader.cpp
r275078 r276193 91 91 } 92 92 93 if (!portAllowed(url)) { 94 FrameLoader::reportBlockedLoadFailed(frame, url); 95 return; 96 } 97 93 98 ResourceRequest request(url); 94 99 #if ENABLE(CONTENT_EXTENSIONS) -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r275563 r276193 149 149 } 150 150 151 if (!portAllowed(clientRequest.url())) { 152 RELEASE_LOG_IF_ALLOWED("init: Cancelling load to a blocked port."); 153 FrameLoader::reportBlockedLoadFailed(*m_frame, clientRequest.url()); 154 releaseResources(); 155 return completionHandler(false); 156 } 157 151 158 // The various plug-in implementations call directly to ResourceLoader::load() instead of piping requests 152 159 // through FrameLoader. As a result, they miss the FrameLoader::addExtraFieldsToRequest() step which sets -
trunk/Source/WebCore/loader/SubframeLoader.cpp
r271013 r276193 141 141 } 142 142 143 if (!portAllowed(url)) { 144 FrameLoader::reportBlockedLoadFailed(m_frame, url); 145 return false; 146 } 147 143 148 if (!MixedContentChecker::canRunInsecureContent(m_frame, document->securityOrigin(), url)) 144 149 return false; … … 261 266 if (!document->securityOrigin().canDisplay(url)) { 262 267 FrameLoader::reportLocalLoadFailed(&m_frame, url.string()); 268 return nullptr; 269 } 270 271 if (!portAllowed(url)) { 272 FrameLoader::reportBlockedLoadFailed(m_frame, url); 263 273 return nullptr; 264 274 } -
trunk/Source/WebCore/loader/SubresourceLoader.cpp
r275563 r276193 283 283 } 284 284 285 if (!portAllowed(newRequest.url())) { 286 RELEASE_LOG_IF_ALLOWED("willSendRequestInternal: resource load (redirect) canceled because it attempted to use a blocked port"); 287 if (m_frame) 288 FrameLoader::reportBlockedLoadFailed(*m_frame, newRequest.url()); 289 cancel(frameLoader()->blockedError(newRequest)); 290 return completionHandler(WTFMove(newRequest)); 291 } 292 285 293 auto accessControlCheckResult = checkRedirectionCrossOriginAccessControl(request(), redirectResponse, newRequest); 286 294 if (!accessControlCheckResult) { -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r273897 r276193 898 898 } 899 899 900 if (!portAllowed(url)) { 901 if (forPreload == ForPreload::No) 902 FrameLoader::reportBlockedLoadFailed(frame, url); 903 RELEASE_LOG_IF_ALLOWED_WITH_FRAME("CachedResourceLoader::requestResource URL has a blocked port", frame); 904 return makeUnexpected(frame.loader().blockedError(request.resourceRequest())); 905 } 906 900 907 request.updateReferrerPolicy(document() ? document()->referrerPolicy() : ReferrerPolicy::NoReferrerWhenDowngrade); 901 908 -
trunk/Tools/ChangeLog
r276189 r276193 1 2021-04-16 Brent Fulgham <bfulgham@apple.com> 2 3 Perform port blocking earlier in the load 4 https://bugs.webkit.org/show_bug.cgi?id=224525 5 <rdar://problem/75440591> 6 7 Reviewed by Darin Adler. 8 9 Update URLScheme test to use a non-prohibited port for the test. Tests of 10 failed fetches are already handled in WPT and other tests, so using a valid 11 port here should continue to be a valid test. 12 13 * TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm: 14 (-[FrameSchemeHandler webView:startURLSchemeTask:]): Use allowed port or the test 15 instead of 123. 16 1 17 2021-04-16 Chris Dumez <cdumez@apple.com> 2 18 -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WKURLSchemeHandler-1.mm
r276037 r276193 1254 1254 case 1: 1255 1255 check(task, "frame://host1/main", true, "", "", "", 0); 1256 respond(task, "<iframe src='//host2:123 /iframe'></iframe>");1256 respond(task, "<iframe src='//host2:1234/iframe'></iframe>"); 1257 1257 return; 1258 1258 case 2: 1259 check(task, "frame://host2:123 /iframe", false, "", "frame", "host1", 0);1259 check(task, "frame://host2:1234/iframe", false, "", "frame", "host1", 0); 1260 1260 respond(task, "<script>fetch('subresource')</script>"); 1261 1261 return; 1262 1262 case 3: 1263 check(task, "frame://host2:123 /subresource", false, "frame://host2:123/iframe", "frame", "host2", 123);1263 check(task, "frame://host2:1234/subresource", false, "frame://host2:1234/iframe", "frame", "host2", 1234); 1264 1264 respond(task, "done!"); 1265 1265 return;
Note:
See TracChangeset
for help on using the changeset viewer.