Title: [280009] trunk/Source/WebKit
Revision
280009
Author
[email protected]
Date
2021-07-16 16:53:23 -0700 (Fri, 16 Jul 2021)

Log Message

PCM: Add early return when unlinkable token is used and add more happy path Web Inspector logging
https://bugs.webkit.org/show_bug.cgi?id=228039
<rdar://problem/80705989>

Reviewed by Kate Cheney.

There's a missing return after an accepted unlinkable token transaction. The
attribution object is therefore moved and stored twice.

This patch also adds more Web Inspector logging to the happy path for better
developer feedback.

No new tests.

* NetworkProcess/PrivateClickMeasurementManager.cpp:
(WebKit::PrivateClickMeasurementManager::storeUnattributed):
    Add the missing return.
(WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
    Add Web Inspector logging.
(WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
    Add Web Inspector logging.
(WebKit::PrivateClickMeasurementManager::handleAttribution):
    Add Web Inspector logging.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (280008 => 280009)


--- trunk/Source/WebKit/ChangeLog	2021-07-16 23:40:00 UTC (rev 280008)
+++ trunk/Source/WebKit/ChangeLog	2021-07-16 23:53:23 UTC (rev 280009)
@@ -1,3 +1,29 @@
+2021-07-16  John Wilander  <[email protected]>
+
+        PCM: Add early return when unlinkable token is used and add more happy path Web Inspector logging
+        https://bugs.webkit.org/show_bug.cgi?id=228039
+        <rdar://problem/80705989>
+
+        Reviewed by Kate Cheney.
+
+        There's a missing return after an accepted unlinkable token transaction. The
+        attribution object is therefore moved and stored twice.
+
+        This patch also adds more Web Inspector logging to the happy path for better
+        developer feedback.
+
+        No new tests.
+
+        * NetworkProcess/PrivateClickMeasurementManager.cpp:
+        (WebKit::PrivateClickMeasurementManager::storeUnattributed):
+            Add the missing return.
+        (WebKit::PrivateClickMeasurementManager::getTokenPublicKey):
+            Add Web Inspector logging.
+        (WebKit::PrivateClickMeasurementManager::getSignedUnlinkableToken):
+            Add Web Inspector logging.
+        (WebKit::PrivateClickMeasurementManager::handleAttribution):
+            Add Web Inspector logging.
+
 2021-07-16  Wenson Hsieh  <[email protected]>
 
         REGRESSION (r277820): Can't scroll up and down using trackpad in Mail message viewer when in Slide Over

Modified: trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp (280008 => 280009)


--- trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp	2021-07-16 23:40:00 UTC (rev 280008)
+++ trunk/Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp	2021-07-16 23:53:23 UTC (rev 280009)
@@ -97,6 +97,7 @@
 #endif
 
             getSignedUnlinkableToken(WTFMove(attribution));
+            return;
         });
     }
 
@@ -174,6 +175,8 @@
             return;
         }
 
+        m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, makeString("[Private Click Measurement] Got JSON response for token public key request."_s));
+
         callback(WTFMove(attribution), jsonObject->getString("token_public_key"_s));
     });
 
@@ -216,9 +219,10 @@
         }
 
         auto signatureBase64URL = jsonObject->getString("unlinkable_token"_s);
-        if (signatureBase64URL.isEmpty())
+        if (signatureBase64URL.isEmpty()) {
+            m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Error, makeString("[Private Click Measurement] JSON response doesn't have the key 'unlinkable_token' for token signing request."_s));
             return;
-
+        }
         // FIX NOW!
         if (m_fraudPreventionValuesForTesting)
             attribution.setSourceSecretToken({ m_fraudPreventionValuesForTesting->secretToken, m_fraudPreventionValuesForTesting->signature, m_fraudPreventionValuesForTesting->keyID });
@@ -251,15 +255,17 @@
     auto& firstPartyURL = redirectRequest.firstPartyForCookies();
 
     if (!redirectDomain.matches(requestURL)) {
-        m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Warning, "[Private Click Measurement] Attribution was not accepted because the HTTP redirect was not same-site."_s);
+        m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Warning, "[Private Click Measurement] Triggering event was not accepted because the HTTP redirect was not same-site."_s);
         return;
     }
 
     if (redirectDomain.matches(firstPartyURL)) {
-        m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Warning, "[Private Click Measurement] Attribution was not accepted because it was requested in an HTTP redirect that is same-site as the first-party."_s);
+        m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Warning, "[Private Click Measurement] Triggering event was not accepted because it was requested in an HTTP redirect that is same-site as the first-party."_s);
         return;
     }
 
+    m_networkProcess->broadcastConsoleMessage(m_sessionID, MessageSource::PrivateClickMeasurement, MessageLevel::Log, "[Private Click Measurement] Triggering event accepted."_s);
+
     attribute(SourceSite { WTFMove(redirectDomain) }, AttributionDestinationSite { firstPartyURL }, WTFMove(attributionTriggerData));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to