Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1711)

Issue 2767333006: Add Digital Asset Links verification for postMessage API (Closed)

Created:
3 years, 9 months ago by Yusuf
Modified:
3 years, 7 months ago
CC:
chromium-reviews, lizeb+watch-custom-tabs_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Add Digital Asset Links verification for postMessage API Adds DigitalAssetLinks handler which queries digitalassetlinks.googleapis.com/ for verifying the relationship between an Android app and a web domain. This is added in a new component digital_asset_links since this API is a generic web API for checking Android-Web relationships. It may be useful for iOS and ChromeOS as well. The component currently depends on base and net. Then custom tabs uses this handler for verifying postMessage origin declared by the client app when they send requestPostMessageChannel. This enabled third party apps to use postMessage related APIs with secure and verified origin declaration. BUG=704975 Review-Url: https://codereview.chromium.org/2767333006 Cr-Commit-Position: refs/heads/master@{#467791} Committed: https://chromium.googlesource.com/chromium/src/+/2f2c75134816ad67b3bab94cfff8347b53cbc7d3

Patch Set 1 #

Patch Set 2 : FindBugs fixes #

Patch Set 3 : Added caching #

Patch Set 4 : updated origin #

Patch Set 5 : moved digital_asset_links to a component #

Total comments: 32

Patch Set 6 : lizeb@ commetns #

Total comments: 22

Patch Set 7 : made clang happy and also added a test #

Patch Set 8 : lizeb@ comments #

Total comments: 14

Patch Set 9 : java comments #

Patch Set 10 : fix hex conversion logic #

Total comments: 16

Patch Set 11 : lizeb nits #

Patch Set 12 : added native unit tests #

Total comments: 8

Patch Set 13 : test fix and DEPS update #

Patch Set 14 : lizeb@ test comments #

Total comments: 106

Patch Set 15 : nyquist@ changes #

Patch Set 16 : fix OriginVerifierTest #

Patch Set 17 : tests fixed and the network request verified #

Patch Set 18 : unbreak other ClientManagerTests #

Patch Set 19 : unittests #

Patch Set 20 : moar unittests #

Total comments: 14

Patch Set 21 : nyquist final comments #

Patch Set 22 : destructor #

Unified diffs Side-by-side diffs Delta from patch set Stats (+915 lines, -5 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 5 chunks +24 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabsConnection.java View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +11 lines, -2 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/customtabs/OriginVerifier.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +227 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/customtabs/PostMessageHandler.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 5 chunks +54 lines, -1 line 0 comments Download
M chrome/android/java_sources.gni View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -0 lines 0 comments Download
M chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/ClientManagerTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 3 chunks +35 lines, -0 lines 0 comments Download
A chrome/android/javatests/src/org/chromium/chrome/browser/customtabs/OriginVerifierTest.java View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 1 chunk +34 lines, -0 lines 0 comments Download
M chrome/browser/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/android/chrome_jni_registrar.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +2 lines, -0 lines 0 comments Download
A chrome/browser/android/customtabs/OWNERS View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
A chrome/browser/android/customtabs/origin_verifier.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +54 lines, -0 lines 0 comments Download
A chrome/browser/android/customtabs/origin_verifier.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +91 lines, -0 lines 0 comments Download
A chrome/browser/android/digital_asset_links/DEPS View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +10 lines, -0 lines 0 comments Download
A chrome/browser/android/digital_asset_links/OWNERS View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
A chrome/browser/android/digital_asset_links/digital_asset_links_handler.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +76 lines, -0 lines 0 comments Download
A chrome/browser/android/digital_asset_links/digital_asset_links_handler.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1 chunk +145 lines, -0 lines 0 comments Download
A chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 chunk +140 lines, -0 lines 0 comments Download
M chrome/test/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 82 (53 generated)
Yusuf
Hi Benoit, PTAL at the current state of this CL. TODOs and things that would ...
3 years, 9 months ago (2017-03-24 22:58:45 UTC) #10
Yusuf
I am now leaning towards a per app lifecycle caching on the ClientManager side.
3 years, 9 months ago (2017-03-28 00:08:50 UTC) #11
Yusuf
This is now ready for review. @lizeb for customtabs/ bits and overall approach
3 years, 8 months ago (2017-03-29 23:40:33 UTC) #12
Benoit L
Sorry for the delay. Happy that we can add this! I have only looked at ...
3 years, 8 months ago (2017-03-31 15:38:43 UTC) #16
Yusuf
Moved this to chrome/android with a folder specific DEPS file, after a chat with jam@. ...
3 years, 8 months ago (2017-03-31 22:41:50 UTC) #17
Benoit L
Sorry for the delay, and for things I missed initially. A few minor comments about ...
3 years, 8 months ago (2017-04-04 18:44:12 UTC) #18
Yusuf
https://codereview.chromium.org/2767333006/diff/100001/chrome/browser/android/customtabs/origin_verifier.cc File chrome/browser/android/customtabs/origin_verifier.cc (right): https://codereview.chromium.org/2767333006/diff/100001/chrome/browser/android/customtabs/origin_verifier.cc#newcode21 chrome/browser/android/customtabs/origin_verifier.cc:21: Profile* profile = ProfileManager::GetPrimaryUserProfile(); On 2017/04/04 18:44:12, Benoit L ...
3 years, 8 months ago (2017-04-05 00:20:43 UTC) #19
Benoit L
Looked at the Java part as well. That's quite unfortunate that we have to deal ...
3 years, 8 months ago (2017-04-05 16:32:03 UTC) #20
Yusuf
https://codereview.chromium.org/2767333006/diff/140001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java File chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java (right): https://codereview.chromium.org/2767333006/diff/140001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java#newcode357 chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java:357: Uri getPostMessageOriginForSessionForTesting(CustomTabsSessionToken session) { On 2017/04/05 16:32:03, Benoit L ...
3 years, 8 months ago (2017-04-05 19:04:45 UTC) #21
Benoit L
lgtm, with a few nits. Is there a way to test the native side? https://codereview.chromium.org/2767333006/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/OriginVerifier.java ...
3 years, 8 months ago (2017-04-07 15:04:55 UTC) #30
Yusuf
https://codereview.chromium.org/2767333006/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/OriginVerifier.java File chrome/android/java/src/org/chromium/chrome/browser/customtabs/OriginVerifier.java (right): https://codereview.chromium.org/2767333006/diff/180001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/OriginVerifier.java#newcode33 chrome/android/java/src/org/chromium/chrome/browser/customtabs/OriginVerifier.java:33: * Uses Digital Asset Links to confirm that the ...
3 years, 8 months ago (2017-04-07 23:38:42 UTC) #31
Yusuf
Added native unit tests lizeb@ feel free to take another look nyquist@ for chrome/browser/android OWNERS
3 years, 8 months ago (2017-04-18 00:30:19 UTC) #33
Benoit L
Thanks for adding the tests! still lgtm. https://codereview.chromium.org/2767333006/diff/220001/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc File chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc (right): https://codereview.chromium.org/2767333006/diff/220001/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc#newcode40 chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc:40: CHECK(fetcher); nit: ...
3 years, 8 months ago (2017-04-18 16:14:31 UTC) #34
Yusuf
https://codereview.chromium.org/2767333006/diff/220001/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc File chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc (right): https://codereview.chromium.org/2767333006/diff/220001/chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc#newcode40 chrome/browser/android/digital_asset_links/digital_asset_links_handler_unittest.cc:40: CHECK(fetcher); On 2017/04/18 16:14:31, Benoit L wrote: > nit: ...
3 years, 8 months ago (2017-04-18 19:54:14 UTC) #35
Yusuf
Adding OWNERS from base/ and net/ because of the DEPS change I am making. For ...
3 years, 8 months ago (2017-04-18 20:00:25 UTC) #37
Yusuf
3 years, 8 months ago (2017-04-18 20:00:47 UTC) #39
sky
LGTM
3 years, 8 months ago (2017-04-18 22:28:28 UTC) #42
nyquist
Mostly just a few questions since I'm not super familiar with this area yet. https://codereview.chromium.org/2767333006/diff/260001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java ...
3 years, 8 months ago (2017-04-19 06:35:57 UTC) #45
Randy Smith (Not in Mondays)
chrome/browser/android/digital_asset_links/DEPS LGTM.
3 years, 8 months ago (2017-04-19 13:59:22 UTC) #46
gab
lgtm for chrome/browser/android/digital_asset_links/DEPS -> +base
3 years, 8 months ago (2017-04-19 18:46:43 UTC) #47
Yusuf
https://codereview.chromium.org/2767333006/diff/260001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java File chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java (right): https://codereview.chromium.org/2767333006/diff/260001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java#newcode346 chrome/android/java/src/org/chromium/chrome/browser/customtabs/ClientManager.java:346: public synchronized void verifyAndInitializeWithPostMessageOriginForSession( On 2017/04/19 06:35:55, nyquist wrote: ...
3 years, 8 months ago (2017-04-26 00:51:37 UTC) #48
Yusuf
This should be good to go now. Thanks a lot for the review nyquist@
3 years, 8 months ago (2017-04-26 18:56:34 UTC) #55
nyquist
lgtm % fixing OriginVerifier::VerifyOrigin callback when stuff fails before URLRequest starts. I think the fix ...
3 years, 8 months ago (2017-04-27 04:38:25 UTC) #68
Yusuf
https://codereview.chromium.org/2767333006/diff/380001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/PostMessageHandler.java File chrome/android/java/src/org/chromium/chrome/browser/customtabs/PostMessageHandler.java (right): https://codereview.chromium.org/2767333006/diff/380001/chrome/android/java/src/org/chromium/chrome/browser/customtabs/PostMessageHandler.java#newcode61 chrome/android/java/src/org/chromium/chrome/browser/customtabs/PostMessageHandler.java:61: mPackageName = packageName; On 2017/04/27 04:38:25, nyquist (nychthemeron ping) ...
3 years, 7 months ago (2017-04-27 17:38:56 UTC) #69
Yusuf
https://codereview.chromium.org/2767333006/diff/380001/chrome/browser/android/customtabs/origin_verifier.cc File chrome/browser/android/customtabs/origin_verifier.cc (right): https://codereview.chromium.org/2767333006/diff/380001/chrome/browser/android/customtabs/origin_verifier.cc#newcode51 chrome/browser/android/customtabs/origin_verifier.cc:51: asset_link_handler_->CheckDigitalAssetLinkRelationship( On 2017/04/27 04:38:25, nyquist (nychthemeron ping) wrote: > ...
3 years, 7 months ago (2017-04-27 18:31:06 UTC) #72
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2767333006/420001
3 years, 7 months ago (2017-04-27 18:31:59 UTC) #75
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_rel_ng/builds/440941)
3 years, 7 months ago (2017-04-27 19:34:12 UTC) #77
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2767333006/420001
3 years, 7 months ago (2017-04-27 19:53:59 UTC) #79
commit-bot: I haz the power
3 years, 7 months ago (2017-04-27 21:24:35 UTC) #82
Message was sent while issue was closed.
Committed patchset #22 (id:420001) as
https://chromium.googlesource.com/chromium/src/+/2f2c75134816ad67b3bab94cfff8...

Powered by Google App Engine
This is Rietveld 408576698