Title: [256083] trunk/Source/WebKit
Revision
256083
Author
[email protected]
Date
2020-02-07 16:51:40 -0800 (Fri, 07 Feb 2020)

Log Message

[IPC Hardening] Convert some debug assertions into MESSAGE_CHECKs in WebPaymentCoordinatorProxy
https://bugs.webkit.org/show_bug.cgi?id=207414
<rdar://problem/58507177>

Reviewed by Andy Estes.

* Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
(WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
(WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
(WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
(WebKit::WebPaymentCoordinatorProxy::completeMerchantValidation):
(WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
(WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
(WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (256082 => 256083)


--- trunk/Source/WebKit/ChangeLog	2020-02-08 00:47:03 UTC (rev 256082)
+++ trunk/Source/WebKit/ChangeLog	2020-02-08 00:51:40 UTC (rev 256083)
@@ -1,3 +1,20 @@
+2020-02-07  Chris Dumez  <[email protected]>
+
+        [IPC Hardening] Convert some debug assertions into MESSAGE_CHECKs in WebPaymentCoordinatorProxy
+        https://bugs.webkit.org/show_bug.cgi?id=207414
+        <rdar://problem/58507177>
+
+        Reviewed by Andy Estes.
+
+        * Shared/ApplePay/WebPaymentCoordinatorProxy.cpp:
+        (WebKit::WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard):
+        (WebKit::WebPaymentCoordinatorProxy::openPaymentSetup):
+        (WebKit::WebPaymentCoordinatorProxy::showPaymentUI):
+        (WebKit::WebPaymentCoordinatorProxy::completeMerchantValidation):
+        (WebKit::WebPaymentCoordinatorProxy::completeShippingMethodSelection):
+        (WebKit::WebPaymentCoordinatorProxy::completeShippingContactSelection):
+        (WebKit::WebPaymentCoordinatorProxy::completePaymentMethodSelection):
+
 2020-02-07  Alex Christensen  <[email protected]>
 
         Harden HashTable IPC decoders

Modified: trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp (256082 => 256083)


--- trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2020-02-08 00:47:03 UTC (rev 256082)
+++ trunk/Source/WebKit/Shared/ApplePay/WebPaymentCoordinatorProxy.cpp	2020-02-08 00:51:40 UTC (rev 256083)
@@ -35,6 +35,8 @@
 #include "WebProcessProxy.h"
 #include <WebCore/PaymentAuthorizationStatus.h>
 
+#define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, messageSenderConnection())
+
 namespace WebKit {
 
 static WeakPtr<WebPaymentCoordinatorProxy>& activePaymentCoordinatorProxy()
@@ -76,11 +78,15 @@
 
 void WebPaymentCoordinatorProxy::canMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
 {
+    MESSAGE_CHECK(!merchantIdentifier.isNull());
+    MESSAGE_CHECK(!domainName.isNull());
     platformCanMakePaymentsWithActiveCard(merchantIdentifier, domainName, WTFMove(completionHandler));
 }
 
 void WebPaymentCoordinatorProxy::openPaymentSetup(const String& merchantIdentifier, const String& domainName, CompletionHandler<void(bool)>&& completionHandler)
 {
+    MESSAGE_CHECK(!merchantIdentifier.isNull());
+    MESSAGE_CHECK(!domainName.isNull());
     platformOpenPaymentSetup(merchantIdentifier, domainName, WTFMove(completionHandler));
 }
 
@@ -90,10 +96,9 @@
         coordinator->didCancelPaymentSession();
     activePaymentCoordinatorProxy() = makeWeakPtr(this);
 
-    // FIXME: Make this a message check.
-    ASSERT(canBegin());
-    ASSERT(!m_destinationID);
-    ASSERT(!m_authorizationPresenter);
+    MESSAGE_CHECK(canBegin());
+    MESSAGE_CHECK(!m_destinationID);
+    MESSAGE_CHECK(!m_authorizationPresenter);
 
     m_destinationID = destinationID;
     m_state = State::Activating;
@@ -133,8 +138,7 @@
     if (m_state == State::Idle)
         return;
 
-    // FIXME: This should be a MESSAGE_CHECK.
-    ASSERT(m_merchantValidationState == MerchantValidationState::Validating);
+    MESSAGE_CHECK(m_merchantValidationState == MerchantValidationState::Validating);
 
     platformCompleteMerchantValidation(paymentMerchantSession);
     m_merchantValidationState = MerchantValidationState::ValidationComplete;
@@ -146,8 +150,7 @@
     if (m_state == State::Idle)
         return;
 
-    // FIXME: This should be a MESSAGE_CHECK.
-    ASSERT(m_state == State::ShippingMethodSelected);
+    MESSAGE_CHECK(m_state == State::ShippingMethodSelected);
 
     platformCompleteShippingMethodSelection(update);
     m_state = State::Active;
@@ -159,8 +162,7 @@
     if (m_state == State::Idle)
         return;
 
-    // FIXME: This should be a MESSAGE_CHECK.
-    ASSERT(m_state == State::ShippingContactSelected);
+    MESSAGE_CHECK(m_state == State::ShippingContactSelected);
 
     platformCompleteShippingContactSelection(update);
     m_state = State::Active;
@@ -172,8 +174,7 @@
     if (m_state == State::Idle)
         return;
 
-    // FIXME: This should be a MESSAGE_CHECK.
-    ASSERT(m_state == State::PaymentMethodSelected);
+    MESSAGE_CHECK(m_state == State::PaymentMethodSelected);
 
     platformCompletePaymentMethodSelection(update);
     m_state = State::Active;
@@ -346,4 +347,6 @@
 
 }
 
+#undef MESSAGE_CHECK
+
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to