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

Issue 2815763002: Prevent usage of web payments API over insecure HTTPS. (Closed)

Created:
3 years, 8 months ago by please use gerrit instead
Modified:
3 years, 8 months ago
Reviewers:
palmer, Mathieu, gogerald1, Moe
CC:
agrieve+watch_chromium.org, anthonyvd, chromium-reviews, gogerald+paymentswatch_chromium.org, mahmadi+paymentswatch_chromium.org, rouslan+payments_chromium.org, sebsg+paymentswatch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Prevent usage of web payments API over insecure HTTPS. Before this patch, the web payments UI would allow user to make payments easily on pages with invalid HTTPS certificates. Even if the URL bar showed a red, crossed-out "https", the web payments UI would show a green "https" with a green lock icon. This patch fixes the problem by checking the security level of the page. An HTTPS page that's not EV_SECURE, SECURE, or SECURE_WITH_POLICY_INSTALLED_CERT is prevented from using any payment apps. After this patch, invoking PaymentRequest.show() will always return NotSupportedError on pages with invalid HTTPS certificates. This is because Chrome is not providing any payment apps for such pages. Invoking PaymentRequest.canMakePayment() will always return "false" for the same reason. Caveat: Pages with invalid HTTPS certificates are still considered "SecureContext" in web platform, so throwing "SecurityError" in the PaymentRequest constructor is not an option. To test an invalid HTTPS certificate: 1) Visit https://edellroot.badssl.com/input/web-payment. 2) Bypass the interstitial. 3) Tap [Initiate payment] button. Observe: The web payments UI does not show. To test a valid HTTPS certificate: 1) Visit https://badssl.com/input/web-payment. 2) Tap [Initiate payment] button. Observe: The web payments UI shows. BUG=678764 Review-Url: https://codereview.chromium.org/2815763002 Cr-Commit-Position: refs/heads/master@{#465022} Committed: https://chromium.googlesource.com/chromium/src/+/6e3cf7c6d281cff41cae5aa4d764f6fd7854c75e

Patch Set 1 #

Total comments: 8

Patch Set 2 : Crossplatform #

Patch Set 3 : Add a test #

Patch Set 4 : Self-review #

Total comments: 15

Patch Set 5 : Mathieu's comments #

Total comments: 2

Patch Set 6 : Ganggui's comment. #

Total comments: 4

Patch Set 7 : Fix typo #

Unified diffs Side-by-side diffs Delta from patch set Stats (+574 lines, -162 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java View 1 2 3 4 5 4 chunks +26 lines, -9 lines 0 comments Download
A chrome/android/java/src/org/chromium/chrome/browser/payments/SslValidityChecker.java View 1 2 3 4 5 1 chunk +26 lines, -0 lines 0 comments Download
M chrome/android/java_sources.gni View 1 2 1 chunk +1 line, -0 lines 0 comments Download
M chrome/browser/BUILD.gn View 1 2 3 4 3 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/payments/android/chrome_payments_jni_registrar.cc View 1 1 chunk +2 lines, -0 lines 0 comments Download
A chrome/browser/payments/android/ssl_validity_checker_android.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
A chrome/browser/payments/android/ssl_validity_checker_android.cc View 1 2 3 4 5 1 chunk +27 lines, -0 lines 0 comments Download
M chrome/browser/payments/chrome_payment_request_delegate.h View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/payments/chrome_payment_request_delegate.cc View 1 2 3 4 5 2 chunks +9 lines, -0 lines 0 comments Download
A chrome/browser/payments/ssl_validity_checker.h View 1 2 3 4 5 1 chunk +29 lines, -0 lines 0 comments Download
A chrome/browser/payments/ssl_validity_checker.cc View 1 2 3 4 5 1 chunk +29 lines, -0 lines 0 comments Download
M chrome/browser/ui/views/payments/cvc_unmask_view_controller_browsertest.cc View 1 2 1 chunk +1 line, -2 lines 0 comments Download
M chrome/browser/ui/views/payments/order_summary_view_controller.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/views/payments/payment_request_browsertest.cc View 1 2 3 4 1 chunk +33 lines, -14 lines 0 comments Download
M chrome/browser/ui/views/payments/payment_request_browsertest_base.h View 1 2 3 4 4 chunks +7 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/payments/payment_request_browsertest_base.cc View 1 2 3 4 7 chunks +27 lines, -8 lines 0 comments Download
M chrome/browser/ui/views/payments/payment_request_can_make_payment_browsertest.cc View 1 2 3 4 3 chunks +20 lines, -6 lines 0 comments Download
M chrome/browser/ui/views/payments/payment_request_dialog_view.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
A chrome/browser/ui/views/payments/payment_request_payment_app_browsertest.cc View 1 2 1 chunk +29 lines, -0 lines 0 comments Download
M chrome/browser/ui/views/payments/payment_request_payment_response_browsertest.cc View 1 2 4 chunks +23 lines, -38 lines 0 comments Download
M chrome/browser/ui/views/payments/payment_sheet_view_controller.h View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/views/payments/shipping_option_view_controller.h View 1 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/views/payments/test_chrome_payment_request_delegate.h View 1 2 3 4 5 3 chunks +5 lines, -2 lines 0 comments Download
M chrome/browser/ui/views/payments/test_chrome_payment_request_delegate.cc View 1 2 3 4 5 2 chunks +9 lines, -3 lines 0 comments Download
M chrome/test/BUILD.gn View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M components/payments/content/BUILD.gn View 1 2 3 4 1 chunk +2 lines, -0 lines 0 comments Download
M components/payments/content/android/BUILD.gn View 1 2 3 4 3 chunks +4 lines, -0 lines 0 comments Download
M components/payments/content/android/component_jni_registrar.cc View 1 2 chunks +2 lines, -0 lines 0 comments Download
A components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java View 1 2 3 4 5 6 1 chunk +37 lines, -0 lines 0 comments Download
A components/payments/content/android/origin_security_checker_android.h View 1 1 chunk +16 lines, -0 lines 0 comments Download
A components/payments/content/android/origin_security_checker_android.cc View 1 2 3 4 5 1 chunk +41 lines, -0 lines 0 comments Download
A components/payments/content/origin_security_checker.h View 1 2 3 4 5 1 chunk +29 lines, -0 lines 0 comments Download
A components/payments/content/origin_security_checker.cc View 1 2 3 4 5 1 chunk +22 lines, -0 lines 0 comments Download
M components/payments/content/payment_request.h View 1 2 3 4 2 chunks +1 line, -1 line 0 comments Download
M components/payments/content/payment_request.cc View 1 2 3 4 5 6 chunks +45 lines, -14 lines 0 comments Download
M components/payments/content/payment_request_spec.h View 1 2 3 4 2 chunks +0 lines, -5 lines 0 comments Download
M components/payments/content/payment_request_spec.cc View 1 2 3 3 chunks +3 lines, -20 lines 0 comments Download
M components/payments/content/payment_request_spec_unittest.cc View 1 2 3 4 9 chunks +1 line, -16 lines 0 comments Download
M components/payments/content/payment_request_state.h View 1 2 3 4 1 chunk +6 lines, -0 lines 0 comments Download
M components/payments/content/payment_request_state.cc View 1 2 3 4 1 chunk +10 lines, -3 lines 0 comments Download
M components/payments/content/payment_response_helper_unittest.cc View 1 2 3 4 5 3 chunks +10 lines, -1 line 0 comments Download
M components/payments/core/payment_request_data_util.h View 1 2 1 chunk +3 lines, -4 lines 0 comments Download
M components/payments/core/payment_request_data_util.cc View 1 2 3 chunks +2 lines, -3 lines 0 comments Download
M components/payments/core/payment_request_delegate.h View 1 2 3 4 5 2 chunks +9 lines, -0 lines 0 comments Download
M ios/chrome/browser/payments/payment_request.mm View 1 1 chunk +4 lines, -7 lines 0 comments Download

Messages

Total messages: 47 (34 generated)
please use gerrit instead
Chris, security PTAL. Ganggui, Java PTAL. Anthony, test cases FYI. Eventually these test cases should ...
3 years, 8 months ago (2017-04-11 22:45:46 UTC) #4
palmer
https://codereview.chromium.org/2815763002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java File chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java (right): https://codereview.chromium.org/2815763002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java#newcode423 chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java:423: boolean isLocalhost = "localhost".equalsIgnoreCase(uri.getHost()) Unfortunately, sigh, the name localhost ...
3 years, 8 months ago (2017-04-11 23:30:19 UTC) #7
gogerald1
https://codereview.chromium.org/2815763002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java File chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java (right): https://codereview.chromium.org/2815763002/diff/1/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java#newcode443 chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java:443: if (!isLocalhost && !isLocalFile && !isSecureHttps) { would it ...
3 years, 8 months ago (2017-04-12 17:04:50 UTC) #8
please use gerrit instead
Chris and Ganggui: PTAL patch 3. Sorry it became huge after making the behavior crossplatform. ...
3 years, 8 months ago (2017-04-14 15:09:57 UTC) #21
please use gerrit instead
Moe: PTAL iOS in ptach 3.
3 years, 8 months ago (2017-04-14 15:10:51 UTC) #23
Mathieu
Colossal work! lgtm with tests added https://codereview.chromium.org/2815763002/diff/80001/chrome/browser/payments/chrome_payment_request_delegate.cc File chrome/browser/payments/chrome_payment_request_delegate.cc (right): https://codereview.chromium.org/2815763002/diff/80001/chrome/browser/payments/chrome_payment_request_delegate.cc#newcode60 chrome/browser/payments/chrome_payment_request_delegate.cc:60: return SslValidityChecker::IsValidSslCertificate(web_contents_); This ...
3 years, 8 months ago (2017-04-17 03:20:45 UTC) #30
Moe
On 2017/04/17 03:20:45, Mathieu wrote: > Colossal work! lgtm with tests added > > https://codereview.chromium.org/2815763002/diff/80001/chrome/browser/payments/chrome_payment_request_delegate.cc ...
3 years, 8 months ago (2017-04-17 13:26:18 UTC) #31
gogerald1
lgtm with a nit suggestion, https://codereview.chromium.org/2815763002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/payments/SslValidityChecker.java File chrome/android/java/src/org/chromium/chrome/browser/payments/SslValidityChecker.java (right): https://codereview.chromium.org/2815763002/diff/100001/chrome/android/java/src/org/chromium/chrome/browser/payments/SslValidityChecker.java#newcode19 chrome/android/java/src/org/chromium/chrome/browser/payments/SslValidityChecker.java:19: public static boolean isValidSslCertificate(WebContents ...
3 years, 8 months ago (2017-04-17 17:26:41 UTC) #34
please use gerrit instead
https://codereview.chromium.org/2815763002/diff/80001/chrome/browser/payments/chrome_payment_request_delegate.cc File chrome/browser/payments/chrome_payment_request_delegate.cc (right): https://codereview.chromium.org/2815763002/diff/80001/chrome/browser/payments/chrome_payment_request_delegate.cc#newcode60 chrome/browser/payments/chrome_payment_request_delegate.cc:60: return SslValidityChecker::IsValidSslCertificate(web_contents_); On 2017/04/17 03:20:45, Mathieu wrote: > This ...
3 years, 8 months ago (2017-04-17 18:19:55 UTC) #37
palmer
LGTM % nit and question. https://codereview.chromium.org/2815763002/diff/120001/components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java File components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java (right): https://codereview.chromium.org/2815763002/diff/120001/components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java#newcode24 components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java:24: * Returns true for ...
3 years, 8 months ago (2017-04-17 19:30:06 UTC) #40
please use gerrit instead
https://codereview.chromium.org/2815763002/diff/120001/components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java File components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java (right): https://codereview.chromium.org/2815763002/diff/120001/components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java#newcode24 components/payments/content/android/java/src/org/chromium/components/payments/OriginSecurityChecker.java:24: * Returns true for a valid URL with a ...
3 years, 8 months ago (2017-04-17 20:06:10 UTC) #41
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/2815763002/140001
3 years, 8 months ago (2017-04-17 20:06:46 UTC) #44
commit-bot: I haz the power
3 years, 8 months ago (2017-04-17 21:23:48 UTC) #47
Message was sent while issue was closed.
Committed patchset #7 (id:140001) as
https://chromium.googlesource.com/chromium/src/+/6e3cf7c6d281cff41cae5aa4d764...

Powered by Google App Engine
This is Rietveld 408576698