Commit 50103493 authored by Dominic Battre's avatar Dominic Battre Committed by Commit Bot

Ignore numéro.*réservation as CC number

On https://www.transavia.com/fr-FR/mon-transavia/compte/logon/ the string
"Numéro de réservation" matched the regular expression for credit cards.
It looked for "Numéro" followed by a blacklist of terms. This CL adds
"réservation" to this blacklist.

TBR=olivierrobin@chromium.org

Bug: 966406
Change-Id: I63f8baa4c46ec549ff8c143d7799b5466d4cac9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1778869
Commit-Queue: Dominic Battré <battre@chromium.org>
Reviewed-by: default avatarOlivier Robin <olivierrobin@chromium.org>
Reviewed-by: default avatarMaxim Kolosovskiy <kolos@chromium.org>
Reviewed-by: default avatarRoger McFarlane <rogerm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697938}
parent 40958d8f
......@@ -478,6 +478,7 @@ jumbo_static_library("test_support") {
"//testing/gtest",
"//third_party/libaddressinput:test_support",
"//third_party/libaddressinput:util",
"//third_party/re2:re2",
"//ui/accessibility",
"//ui/gfx:test_support",
"//ui/gfx/geometry",
......
......@@ -9,6 +9,7 @@
#include "base/strings/string_util.h"
#include "base/threading/thread_restrictions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/re2/src/re2/re2.h"
namespace autofill {
namespace {
......@@ -30,6 +31,24 @@ bool WriteFile(const base::FilePath& file, const std::string& content) {
return write_size == static_cast<int>(content.length());
}
// Removes lines starting with (optional) whitespace and a #.
void StripComments(std::string* content) {
RE2::GlobalReplace(
content,
// Enable multi-line mode, ^ and $ match begin/end line in addition to
// begin/end text.
"(?m)"
// Search for start of lines (^), ignore spaces (\\s*), and then look for
// '#'.
"^\\s*#"
// Consume all characters (.*) until end of line ($).
".*$"
// Consume the line wrapping so that the entire line is gone.
"[\\r\\n]*",
// Replace entire line with empty string.
"");
}
} // namespace
void DataDrivenTest::RunDataDrivenTest(
......@@ -81,6 +100,8 @@ void DataDrivenTest::RunOneDataDrivenTest(
ASSERT_TRUE(WriteFile(output_file, output));
return;
}
// Remove comment lines (lead by '#' character).
StripComments(&output_file_contents);
if (is_expected_to_pass) {
EXPECT_EQ(output_file_contents, output);
......
......@@ -176,13 +176,14 @@ const char kNameOnCardRe[] =
const char kNameOnCardContextualRe[] = "name";
const char kCardNumberRe[] =
"(add)?(?:card|cc|acct).?(?:number|#|no|num|field)"
"|(?<!telefon|haus)nummer" // de-DE
"|カード番号" // ja-JP
"|Номер.*карты" // ru
"|信用卡号|信用卡号码" // zh-CN
"|信用卡卡號" // zh-TW
"|카드" // ko-KR
"|(numero|número|numéro)(?!.*(document|fono|phone))"; // es/pt/fr
"|(?<!telefon|haus)nummer" // de-DE
"|カード番号" // ja-JP
"|Номер.*карты" // ru
"|信用卡号|信用卡号码" // zh-CN
"|信用卡卡號" // zh-TW
"|카드" // ko-KR
// es/pt/fr
"|(numero|número|numéro)(?!.*(document|fono|phone|réservation))";
const char kCardCvcRe[] =
"verification|card.?identification|security.?code|card.?code"
......
This source diff could not be displayed because it is too large. You can view the blob instead.
UNKNOWN_TYPE | terms | Par ex. Comment puis-je m'enregistrer en ligne ? | | terms_1-default
EMAIL_ADDRESS | loginID | Adresse e-mail | | loginID_1-default
UNKNOWN_TYPE | password | Mot de passe | | loginID_1-default
UNKNOWN_TYPE | retrieveBookingByLastname.RecordLocator | Numéro de réservation | | retrieveBookingByLastname.RecordLocator_1-default
# INCORRECT: This should be a last name, but the parser cannot return a last name without a first name
NAME_FULL | retrieveBookingByLastname.LastName | Nom de famille | | retrieveBookingByLastname.RecordLocator_1-default
UNKNOWN_TYPE | retrieveBookingByLastname.Day | Jour | | retrieveBookingByLastname.RecordLocator_1-default
UNKNOWN_TYPE | retrieveBookingByLastname.Month | Mois | | retrieveBookingByLastname.RecordLocator_1-default
UNKNOWN_TYPE | retrieveBookingByLastname.Year | Année | | retrieveBookingByLastname.RecordLocator_1-default
UNKNOWN_TYPE | terms | Par ex. Comment puis-je m'enregistrer en ligne ? | | terms_1-default
......@@ -331,6 +331,7 @@ bundle_data("unit_tests_bundle_data") {
"//components/test/data/autofill/heuristics/input/155_fmm-ja_inm.gob.mx.html",
"//components/test/data/autofill/heuristics/input/156_buyAlbum_bandcamp.com_price.html",
"//components/test/data/autofill/heuristics/input/157_bug_971402_opentable_checkout.html",
"//components/test/data/autofill/heuristics/input/159_bug_966406_transavia.com.html",
"//components/test/data/autofill/heuristics/output/000_i18n_de.out",
"//components/test/data/autofill/heuristics/output/001_i18n_de2.out",
"//components/test/data/autofill/heuristics/output/002_i18n_en.out",
......@@ -488,6 +489,7 @@ bundle_data("unit_tests_bundle_data") {
"//components/test/data/autofill/heuristics/output/155_fmm-ja_inm.gob.mx.out",
"//components/test/data/autofill/heuristics/output/156_buyAlbum_bandcamp.com_price.out",
"//components/test/data/autofill/heuristics/output/157_bug_971402_opentable_checkout.out",
"//components/test/data/autofill/heuristics/output/159_bug_966406_transavia.com.out",
]
outputs = [
"{{bundle_resources_dir}}/" +
......
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