Commit d2c99f0c authored by Aidan Beggs's avatar Aidan Beggs Committed by Commit Bot

Change autofill trust logic to match omnibox security level shown.

Before this change, autofill had its own logic for determining a page
was secure. This CL changes the behavior to match the security state
shown in the omnibox.

Bug: 701018
Change-Id: Idd38fc77f93155412961c29a85f237c42ad21563
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808226
Commit-Queue: Aidan Beggs <beggs@google.com>
Reviewed-by: default avatarJoe DeBlasio <jdeblasio@chromium.org>
Reviewed-by: default avatarTed Choc <tedchoc@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698536}
parent e87c68ca
...@@ -261,9 +261,9 @@ bool AwAutofillClient::IsContextSecure() { ...@@ -261,9 +261,9 @@ bool AwAutofillClient::IsContextSecure() {
return false; return false;
ssl_status = navigation_entry->GetSSL(); ssl_status = navigation_entry->GetSSL();
// Note: The implementation below is a copy of the one in // Note: As of crbug.com/701018, Chrome relies on SecurityStateTabHelper to
// ChromeAutofillClient::IsContextSecure, and should be kept in sync // determine whether the page is secure, but WebView has no equivalent class.
// until crbug.com/505388 gets implemented.
return navigation_entry->GetURL().SchemeIsCryptographic() && return navigation_entry->GetURL().SchemeIsCryptographic() &&
ssl_status.certificate && ssl_status.certificate &&
!net::IsCertStatusError(ssl_status.cert_status) && !net::IsCertStatusError(ssl_status.cert_status) &&
......
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "components/password_manager/core/browser/password_manager_metrics_util.h" #include "components/password_manager/core/browser/password_manager_metrics_util.h"
#include "components/password_manager/core/browser/password_requirements_service.h" #include "components/password_manager/core/browser/password_requirements_service.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
#include "components/security_state/core/security_state.h"
#include "components/signin/public/base/signin_metrics.h" #include "components/signin/public/base/signin_metrics.h"
#include "components/signin/public/identity_manager/account_info.h" #include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h" #include "components/signin/public/identity_manager/identity_manager.h"
...@@ -501,20 +502,15 @@ void ChromeAutofillClient::DidFillOrPreviewField( ...@@ -501,20 +502,15 @@ void ChromeAutofillClient::DidFillOrPreviewField(
} }
bool ChromeAutofillClient::IsContextSecure() { bool ChromeAutofillClient::IsContextSecure() {
content::SSLStatus ssl_status; // Note: Defer to SecurityStateTabHelper to determine what pages
content::NavigationEntry* navigation_entry = // are secure so that autofill behavior matches that shown in the omnibox.
web_contents()->GetController().GetLastCommittedEntry();
if (!navigation_entry) SecurityStateTabHelper* helper =
return false; SecurityStateTabHelper::FromWebContents(web_contents());
ssl_status = navigation_entry->GetSSL(); // There may be no SecurityStateTabHelper attached in some tests.
// Note: If changing the implementation below, also change return helper &&
// AwAutofillClient::IsContextSecure. See crbug.com/505388 security_state::IsSslCertificateValid(helper->GetSecurityLevel());
return navigation_entry->GetURL().SchemeIsCryptographic() &&
ssl_status.certificate &&
!net::IsCertStatusError(ssl_status.cert_status) &&
!(ssl_status.content_status &
content::SSLStatus::RAN_INSECURE_CONTENT);
} }
bool ChromeAutofillClient::ShouldShowSigninPromo() { bool ChromeAutofillClient::ShouldShowSigninPromo() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment