Skip to content

Commit

Permalink
PCM: Add early return when unlinkable token is used and add more happ…
Browse files Browse the repository at this point in the history
…y 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.


Canonical link: https://commits.webkit.org/239751@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@280009 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
johnwilander committed Jul 16, 2021
1 parent 04841c1 commit d25c25a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
26 changes: 26 additions & 0 deletions Source/WebKit/ChangeLog
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 10 additions & 4 deletions Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ void PrivateClickMeasurementManager::storeUnattributed(PrivateClickMeasurement&&
#endif

getSignedUnlinkableToken(WTFMove(attribution));
return;
});
}

Expand Down Expand Up @@ -174,6 +175,8 @@ void PrivateClickMeasurementManager::getTokenPublicKey(PrivateClickMeasurement&&
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));
});

Expand Down Expand Up @@ -216,9 +219,10 @@ void PrivateClickMeasurementManager::getSignedUnlinkableToken(PrivateClickMeasur
}

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 });
Expand Down Expand Up @@ -251,15 +255,17 @@ void PrivateClickMeasurementManager::handleAttribution(AttributionTriggerData&&
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));
}

Expand Down

0 comments on commit d25c25a

Please sign in to comment.