Bug 222141

Summary: PCM: Request server public key to generate secret token
Product: WebKit Reporter: Jiewen Tan <jiewen_tan>
Component: WebKit Misc.Assignee: Jiewen Tan <jiewen_tan>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, ews-watchlist, japhet, jiewen_tan, webkit-bug-importer, wilander
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 221291    
Attachments:
Description Flags
Patch
wilander: review+
Patch for landing none

Jiewen Tan
Reported 2021-02-18 16:25:57 PST
Request server public keys to generate secret token.
Attachments
Patch (37.39 KB, patch)
2021-02-18 16:34 PST, Jiewen Tan
wilander: review+
Patch for landing (38.36 KB, patch)
2021-02-19 00:03 PST, Jiewen Tan
no flags
Jiewen Tan
Comment 1 2021-02-18 16:26:44 PST
Jiewen Tan
Comment 2 2021-02-18 16:34:05 PST
John Wilander
Comment 3 2021-02-18 17:36:32 PST
Comment on attachment 420885 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420885&action=review r=me with comments. > Source/WebCore/ChangeLog:3 > + PCM: Request server public keys to generate secret token Nit: key, not keys > Source/WebKit/ChangeLog:28 > + Teaches the PCMM to send the token public key request. Nit: PCM, not PCMM. > Source/WebCore/loader/PrivateClickMeasurement.cpp:41 > +static const char privateClickMeasurementTokenPublicKeyPath[] = "/.well-known/private-click-measurement/unlinkable-token-public-key/"; We should formulate this as an action, so /get-unlinkable-token-public-key/. > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:95 > + request.setHTTPMethod(httpMethod); Nice. > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:119 > +static NetworkResourceLoadParameters generateNetworkResourceLoadParametersForPost(URL&& url, Ref<JSON::Object>&& jsonPayload, PrivateClickMeasurement::PcmDataCarried dataTypeCarried) I would add HTTP, so generateNetworkResourceLoadParametersForHTTPPost. > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:124 > +static NetworkResourceLoadParameters generateNetworkResourceLoadParametersForGet(URL&& url, PrivateClickMeasurement::PcmDataCarried dataTypeCarried) I would add HTTP, so generateNetworkResourceLoadParametersForHTTPGet. > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:129 > +void PrivateClickMeasurementManager::getTokenPublicKey(PrivateClickMeasurement&& attribution) I wonder if other WebKit developers will bark at this use of "get" as the leading verb? Maybe we should use the word "retrieve" instead just to avoid the potential complaint? In my personal view it *is* good use of the word "get" since we are getting things from the server. Naming it "fetch" instead doesn't help since it would lead people to think that this is tied to Fetch. > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:135 > + auto pcmDataCarried = PrivateClickMeasurement::PcmDataCarried::PersonallyIdentifiable; I would add a comment here saying "This is guaranteed to be close in time to the navigational click which makes it likely to be personally identifiable." > Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:159 > + getSignedUnlinkableToken(attribution); WTFMove(attribution)? > Tools/ChangeLog:3 > + PCM: Request server public keys to generate secret token Nit: key > LayoutTests/ChangeLog:14 > + * http/tests/privateClickMeasurement/store-private-click-measurement-with-source-nonce.html: Please explain briefly what changed in this test case. > LayoutTests/http/tests/privateClickMeasurement/resources/signToken.php:4 > +$tokenSigningFile = fopen($tokenSigningFilePath . ".tmp", 'a'); So this will open the file twice and only after the second append rename it so that the polling finds it? Trying to understand the logic. We should add a comment that explains this. Another way of doing it is having a dedicated PHP file for fetching the singing key.
Jiewen Tan
Comment 4 2021-02-18 18:02:15 PST
Comment on attachment 420885 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=420885&action=review Thanks John for r+ this patch. >> Source/WebCore/ChangeLog:3 >> + PCM: Request server public keys to generate secret token > > Nit: key, not keys Will fix. >> Source/WebKit/ChangeLog:28 >> + Teaches the PCMM to send the token public key request. > > Nit: PCM, not PCMM. It actually refers to PCM manager. >> Source/WebCore/loader/PrivateClickMeasurement.cpp:41 >> +static const char privateClickMeasurementTokenPublicKeyPath[] = "/.well-known/private-click-measurement/unlinkable-token-public-key/"; > > We should formulate this as an action, so /get-unlinkable-token-public-key/. Sure. >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:119 >> +static NetworkResourceLoadParameters generateNetworkResourceLoadParametersForPost(URL&& url, Ref<JSON::Object>&& jsonPayload, PrivateClickMeasurement::PcmDataCarried dataTypeCarried) > > I would add HTTP, so generateNetworkResourceLoadParametersForHTTPPost. Sure. >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:124 >> +static NetworkResourceLoadParameters generateNetworkResourceLoadParametersForGet(URL&& url, PrivateClickMeasurement::PcmDataCarried dataTypeCarried) > > I would add HTTP, so generateNetworkResourceLoadParametersForHTTPGet. Sure. >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:129 >> +void PrivateClickMeasurementManager::getTokenPublicKey(PrivateClickMeasurement&& attribution) > > I wonder if other WebKit developers will bark at this use of "get" as the leading verb? Maybe we should use the word "retrieve" instead just to avoid the potential complaint? In my personal view it *is* good use of the word "get" since we are getting things from the server. Naming it "fetch" instead doesn't help since it would lead people to think that this is tied to Fetch. I think get is good. >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:135 >> + auto pcmDataCarried = PrivateClickMeasurement::PcmDataCarried::PersonallyIdentifiable; > > I would add a comment here saying "This is guaranteed to be close in time to the navigational click which makes it likely to be personally identifiable." Sure. >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:159 >> + getSignedUnlinkableToken(attribution); > > WTFMove(attribution)? This one accepts a const &. Let me modify that. >> Tools/ChangeLog:3 >> + PCM: Request server public keys to generate secret token > > Nit: key Will fix. >> LayoutTests/ChangeLog:14 >> + * http/tests/privateClickMeasurement/store-private-click-measurement-with-source-nonce.html: > > Please explain briefly what changed in this test case. Sure. >> LayoutTests/http/tests/privateClickMeasurement/resources/signToken.php:4 >> +$tokenSigningFile = fopen($tokenSigningFilePath . ".tmp", 'a'); > > So this will open the file twice and only after the second append rename it so that the polling finds it? Trying to understand the logic. We should add a comment that explains this. Another way of doing it is having a dedicated PHP file for fetching the singing key. I can add a comment here. It's not necessary to duplicate that many code here.
John Wilander
Comment 5 2021-02-18 18:59:59 PST
(In reply to Jiewen Tan from comment #4) > Comment on attachment 420885 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=420885&action=review > > Thanks John for r+ this patch. > > >> Source/WebCore/ChangeLog:3 > >> + PCM: Request server public keys to generate secret token > > > > Nit: key, not keys > > Will fix. > > >> Source/WebKit/ChangeLog:28 > >> + Teaches the PCMM to send the token public key request. > > > > Nit: PCM, not PCMM. > > It actually refers to PCM manager. Ha, ha! Maybe PCM Mgr? No big deal. > >> Source/WebCore/loader/PrivateClickMeasurement.cpp:41 > >> +static const char privateClickMeasurementTokenPublicKeyPath[] = "/.well-known/private-click-measurement/unlinkable-token-public-key/"; > > > > We should formulate this as an action, so /get-unlinkable-token-public-key/. > > Sure. > > >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:119 > >> +static NetworkResourceLoadParameters generateNetworkResourceLoadParametersForPost(URL&& url, Ref<JSON::Object>&& jsonPayload, PrivateClickMeasurement::PcmDataCarried dataTypeCarried) > > > > I would add HTTP, so generateNetworkResourceLoadParametersForHTTPPost. > > Sure. > > >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:124 > >> +static NetworkResourceLoadParameters generateNetworkResourceLoadParametersForGet(URL&& url, PrivateClickMeasurement::PcmDataCarried dataTypeCarried) > > > > I would add HTTP, so generateNetworkResourceLoadParametersForHTTPGet. > > Sure. > > >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:129 > >> +void PrivateClickMeasurementManager::getTokenPublicKey(PrivateClickMeasurement&& attribution) > > > > I wonder if other WebKit developers will bark at this use of "get" as the leading verb? Maybe we should use the word "retrieve" instead just to avoid the potential complaint? In my personal view it *is* good use of the word "get" since we are getting things from the server. Naming it "fetch" instead doesn't help since it would lead people to think that this is tied to Fetch. > > I think get is good. OK, let's go with get then. > >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:135 > >> + auto pcmDataCarried = PrivateClickMeasurement::PcmDataCarried::PersonallyIdentifiable; > > > > I would add a comment here saying "This is guaranteed to be close in time to the navigational click which makes it likely to be personally identifiable." > > Sure. > > >> Source/WebKit/NetworkProcess/PrivateClickMeasurementManager.cpp:159 > >> + getSignedUnlinkableToken(attribution); > > > > WTFMove(attribution)? > > This one accepts a const &. Let me modify that. > > >> Tools/ChangeLog:3 > >> + PCM: Request server public keys to generate secret token > > > > Nit: key > > Will fix. > > >> LayoutTests/ChangeLog:14 > >> + * http/tests/privateClickMeasurement/store-private-click-measurement-with-source-nonce.html: > > > > Please explain briefly what changed in this test case. > > Sure. > > >> LayoutTests/http/tests/privateClickMeasurement/resources/signToken.php:4 > >> +$tokenSigningFile = fopen($tokenSigningFilePath . ".tmp", 'a'); > > > > So this will open the file twice and only after the second append rename it so that the polling finds it? Trying to understand the logic. We should add a comment that explains this. Another way of doing it is having a dedicated PHP file for fetching the singing key. > > I can add a comment here. It's not necessary to duplicate that many code > here. Sounds good.
Jiewen Tan
Comment 6 2021-02-19 00:03:13 PST
Created attachment 420930 [details] Patch for landing
EWS
Comment 7 2021-02-19 01:10:22 PST
Committed r273133: <https://commits.webkit.org/r273133> All reviewed patches have been landed. Closing bug and clearing flags on attachment 420930 [details].
Note You need to log in before you can comment on or make changes to this bug.