Title: [256578] trunk/Source/WebKit
Revision
256578
Author
[email protected]
Date
2020-02-13 17:54:59 -0800 (Thu, 13 Feb 2020)

Log Message

Protect WebSWServerConnection::scheduleJobInServer from bad scopeURL
https://bugs.webkit.org/show_bug.cgi?id=207722

Reviewed by Chris Dumez.

* NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
(WebKit::WebSWServerConnection::scheduleJobInServer):
In case of bad scope, fail the job early on.
* WebProcess/Storage/WebSWClientConnection.cpp:
(WebKit::WebSWClientConnection::scheduleJobInServer):
Remove the RELEASE_ASSERT from now since we defend in Network process.
We will add it back in ServiceWorkerRegistration::getOrCreate as a follow-up.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (256577 => 256578)


--- trunk/Source/WebKit/ChangeLog	2020-02-14 01:31:05 UTC (rev 256577)
+++ trunk/Source/WebKit/ChangeLog	2020-02-14 01:54:59 UTC (rev 256578)
@@ -1,3 +1,18 @@
+2020-02-13  Youenn Fablet  <[email protected]>
+
+        Protect WebSWServerConnection::scheduleJobInServer from bad scopeURL
+        https://bugs.webkit.org/show_bug.cgi?id=207722
+
+        Reviewed by Chris Dumez.
+
+        * NetworkProcess/ServiceWorker/WebSWServerConnection.cpp:
+        (WebKit::WebSWServerConnection::scheduleJobInServer):
+        In case of bad scope, fail the job early on.
+        * WebProcess/Storage/WebSWClientConnection.cpp:
+        (WebKit::WebSWClientConnection::scheduleJobInServer):
+        Remove the RELEASE_ASSERT from now since we defend in Network process.
+        We will add it back in ServiceWorkerRegistration::getOrCreate as a follow-up.
+
 2020-02-13  Ben Nham  <[email protected]>
 
         Flash of white can occur if JS forces an early layout

Modified: trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp (256577 => 256578)


--- trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-14 01:31:05 UTC (rev 256577)
+++ trunk/Source/WebKit/NetworkProcess/ServiceWorker/WebSWServerConnection.cpp	2020-02-14 01:54:59 UTC (rev 256578)
@@ -272,6 +272,12 @@
 
 void WebSWServerConnection::scheduleJobInServer(ServiceWorkerJobData&& jobData)
 {
+    ASSERT(!jobData.scopeURL.isNull());
+    if (jobData.scopeURL.isNull()) {
+        rejectJobInClient(jobData.identifier().jobIdentifier, ExceptionData { InvalidStateError, "Scope URL is empty"_s });
+        return;
+    }
+
     SWSERVERCONNECTION_RELEASE_LOG_IF_ALLOWED("Scheduling ServiceWorker job %s in server", jobData.identifier().loggingString().utf8().data());
     ASSERT(identifier() == jobData.connectionIdentifier());
 

Modified: trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp (256577 => 256578)


--- trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2020-02-14 01:31:05 UTC (rev 256577)
+++ trunk/Source/WebKit/WebProcess/Storage/WebSWClientConnection.cpp	2020-02-14 01:54:59 UTC (rev 256578)
@@ -73,7 +73,6 @@
 
 void WebSWClientConnection::scheduleJobInServer(const ServiceWorkerJobData& jobData)
 {
-    RELEASE_ASSERT(!jobData.scopeURL.isNull());
     runOrDelayTaskForImport([this, jobData] {
         send(Messages::WebSWServerConnection::ScheduleJobInServer { jobData });
     });
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to