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

Unified Diff: components/password_manager/core/browser/login_database.cc

Issue 2634163002: Fetch federated PSL-matches from the password store. (Closed)
Patch Set: Addressed comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/login_database.cc
diff --git a/components/password_manager/core/browser/login_database.cc b/components/password_manager/core/browser/login_database.cc
index 82ec036ac2b0be4bcdd56d6a3d6a74f48c49d42c..7b5424cb0d87b55ca2e3cf9ab38f6232210929c5 100644
--- a/components/password_manager/core/browser/login_database.cc
+++ b/components/password_manager/core/browser/login_database.cc
@@ -1087,7 +1087,16 @@ bool LoginDatabase::GetLogins(
registered_domain + "(:" + port + ")?\\/$";
s.BindString(placeholder++, regexp);
}
- if (should_federated_apply) {
+
+ if (should_PSL_matching_apply && should_federated_apply) {
+ // This regex matches any subdomain of registered_domain, in particular it
+ // matches the empty subdomain. Hence exact domain matches are also
vasilii 2017/01/17 16:05:05 Optionally: move the code into the previous if (sh
+ // retrieved.
+ // Periods in registered_domain were already escaped in the previous block.
+ // Therefore they do not need to be escaped again.
+ s.BindString(placeholder++,
+ "^federation://([\\w-]+\\.)*" + registered_domain + "/.+$");
+ } else if (should_federated_apply) {
std::string expression =
base::StringPrintf("federation://%s/%%", form.origin.host().c_str());
s.BindString(placeholder++, expression);
@@ -1221,6 +1230,11 @@ bool LoginDatabase::StatementToForms(
} else if (!new_form->federation_origin.unique() &&
IsFederatedMatch(new_form->signon_realm,
matched_form->origin)) {
+ } else if (!new_form->federation_origin.unique() &&
+ IsFederatedPSLMatch(new_form->signon_realm,
+ matched_form->origin)) {
+ psl_domain_match_metric = PSL_DOMAIN_MATCH_FOUND_FEDERATED;
+ new_form->is_public_suffix_match = true;
} else {
continue;
}
@@ -1277,13 +1291,15 @@ void LoginDatabase::InitializeStatementStrings(const SQLTableBuilder& builder) {
std::string psl_statement = "OR signon_realm REGEXP ? ";
std::string federated_statement =
"OR (signon_realm LIKE ? AND password_type == 2) ";
+ std::string psl_federated_statement =
+ "OR (signon_realm REGEXP ? AND password_type == 2) ";
DCHECK(get_statement_psl_.empty());
get_statement_psl_ = get_statement_ + psl_statement;
DCHECK(get_statement_federated_.empty());
get_statement_federated_ = get_statement_ + federated_statement;
DCHECK(get_statement_psl_federated_.empty());
get_statement_psl_federated_ =
- get_statement_ + psl_statement + federated_statement;
+ get_statement_ + psl_statement + psl_federated_statement;
DCHECK(created_statement_.empty());
created_statement_ =
"SELECT " + all_column_names +

Powered by Google App Engine
This is Rietveld 408576698