From 057ab8c779e6e2ec2d449ec29a882b4a43412e11 Mon Sep 17 00:00:00 2001 From: Emanuele Feliziani Date: Tue, 31 Oct 2023 09:17:02 +0100 Subject: [PATCH 1/2] Workaround for pcsretirement Signed-off-by: Emanuele Feliziani --- dist/autofill-debug.js | 2 +- dist/autofill.js | 2 +- .../__generated__/compiled-matching-config.js | 2 +- .../matching-config/matching-config-source.js | 2 +- src/Form/test-cases/index.json | 1 + .../test-cases/pcsretirementcom_login.html | 54 +++++++++++++++++++ .../Resources/assets/autofill-debug.js | 2 +- swift-package/Resources/assets/autofill.js | 2 +- 8 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 src/Form/test-cases/pcsretirementcom_login.html diff --git a/dist/autofill-debug.js b/dist/autofill-debug.js index 1219902de..36be387dc 100644 --- a/dist/autofill-debug.js +++ b/dist/autofill-debug.js @@ -12332,7 +12332,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint/iu, + skip: /email|one-time|error|hint|username/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { diff --git a/dist/autofill.js b/dist/autofill.js index a517dd179..9a4c9a8f4 100644 --- a/dist/autofill.js +++ b/dist/autofill.js @@ -8166,7 +8166,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint/iu, + skip: /email|one-time|error|hint|username/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { diff --git a/src/Form/matching-config/__generated__/compiled-matching-config.js b/src/Form/matching-config/__generated__/compiled-matching-config.js index bb768c2a7..ceedc221d 100644 --- a/src/Form/matching-config/__generated__/compiled-matching-config.js +++ b/src/Form/matching-config/__generated__/compiled-matching-config.js @@ -245,7 +245,7 @@ const matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint/iu, + skip: /email|one-time|error|hint|username/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { diff --git a/src/Form/matching-config/matching-config-source.js b/src/Form/matching-config/matching-config-source.js index 006ab34ab..cfe5141e2 100644 --- a/src/Form/matching-config/matching-config-source.js +++ b/src/Form/matching-config/matching-config-source.js @@ -264,7 +264,7 @@ const matchingConfiguration = { '|clave|contraseña' + // Swedish '|lösenord', - skip: 'email|one-time|error|hint', + skip: 'email|one-time|error|hint|username', forceUnknown: 'captcha|mfa|2fa|two factor|otp|pin' }, username: { diff --git a/src/Form/test-cases/index.json b/src/Form/test-cases/index.json index 7517bfbd0..64a7788d2 100644 --- a/src/Form/test-cases/index.json +++ b/src/Form/test-cases/index.json @@ -503,5 +503,6 @@ { "html": "alrincon_login.html" }, { "html": "metalarchives_login.html" }, { "html": "accor_hotel-booking.html" }, + { "html": "pcsretirementcom_login.html", "expectedSubmitFalsePositives": 3 }, { "html": "flytap_login.html" } ] diff --git a/src/Form/test-cases/pcsretirementcom_login.html b/src/Form/test-cases/pcsretirementcom_login.html new file mode 100644 index 000000000..e1636b896 --- /dev/null +++ b/src/Form/test-cases/pcsretirementcom_login.html @@ -0,0 +1,54 @@ + + + +
+ + + +
+ + + +
+ +
+ + + + +
+ + +
+
+ + +
+
+ + + +
+
+
+ +
+
+
+
Don't have credentials
+
+
+ + + + + +
diff --git a/swift-package/Resources/assets/autofill-debug.js b/swift-package/Resources/assets/autofill-debug.js index 1219902de..36be387dc 100644 --- a/swift-package/Resources/assets/autofill-debug.js +++ b/swift-package/Resources/assets/autofill-debug.js @@ -12332,7 +12332,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint/iu, + skip: /email|one-time|error|hint|username/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { diff --git a/swift-package/Resources/assets/autofill.js b/swift-package/Resources/assets/autofill.js index a517dd179..9a4c9a8f4 100644 --- a/swift-package/Resources/assets/autofill.js +++ b/swift-package/Resources/assets/autofill.js @@ -8166,7 +8166,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint/iu, + skip: /email|one-time|error|hint|username/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { From 40a035f3384b22ea55b993b125640196182387a3 Mon Sep 17 00:00:00 2001 From: Emanuele Feliziani Date: Tue, 31 Oct 2023 09:27:50 +0100 Subject: [PATCH 2/2] Better fix Signed-off-by: Emanuele Feliziani --- dist/autofill-debug.js | 6 ++++-- dist/autofill.js | 6 ++++-- .../__generated__/compiled-matching-config.js | 2 +- src/Form/matching-config/matching-config-source.js | 2 +- src/Form/matching.js | 3 ++- src/Form/test-cases/pcsretirementcom_login.html | 3 ++- swift-package/Resources/assets/autofill-debug.js | 6 ++++-- swift-package/Resources/assets/autofill.js | 6 ++++-- 8 files changed, 22 insertions(+), 12 deletions(-) diff --git a/dist/autofill-debug.js b/dist/autofill-debug.js index 36be387dc..1469cd992 100644 --- a/dist/autofill-debug.js +++ b/dist/autofill-debug.js @@ -12332,7 +12332,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint|username/iu, + skip: /email|one-time|error|hint/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { @@ -12869,7 +12869,9 @@ class Matching { if (this.subtypeFromMatchers('password', input)) { // Any other input type is likely a false match // Arguably "text" should be as well, but it can be used for password reveal fields - if (['password', 'text'].includes(input.type) && input.name !== 'email' && input.placeholder !== 'Username') { + if (['password', 'text'].includes(input.type) && input.name !== 'email' && + // pcsretirement.com, improper use of the for attribute + input.name !== 'Username') { return 'credentials.password'; } } diff --git a/dist/autofill.js b/dist/autofill.js index 9a4c9a8f4..ca382cd2a 100644 --- a/dist/autofill.js +++ b/dist/autofill.js @@ -8166,7 +8166,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint|username/iu, + skip: /email|one-time|error|hint/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { @@ -8703,7 +8703,9 @@ class Matching { if (this.subtypeFromMatchers('password', input)) { // Any other input type is likely a false match // Arguably "text" should be as well, but it can be used for password reveal fields - if (['password', 'text'].includes(input.type) && input.name !== 'email' && input.placeholder !== 'Username') { + if (['password', 'text'].includes(input.type) && input.name !== 'email' && + // pcsretirement.com, improper use of the for attribute + input.name !== 'Username') { return 'credentials.password'; } } diff --git a/src/Form/matching-config/__generated__/compiled-matching-config.js b/src/Form/matching-config/__generated__/compiled-matching-config.js index ceedc221d..bb768c2a7 100644 --- a/src/Form/matching-config/__generated__/compiled-matching-config.js +++ b/src/Form/matching-config/__generated__/compiled-matching-config.js @@ -245,7 +245,7 @@ const matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint|username/iu, + skip: /email|one-time|error|hint/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { diff --git a/src/Form/matching-config/matching-config-source.js b/src/Form/matching-config/matching-config-source.js index cfe5141e2..006ab34ab 100644 --- a/src/Form/matching-config/matching-config-source.js +++ b/src/Form/matching-config/matching-config-source.js @@ -264,7 +264,7 @@ const matchingConfiguration = { '|clave|contraseña' + // Swedish '|lösenord', - skip: 'email|one-time|error|hint|username', + skip: 'email|one-time|error|hint', forceUnknown: 'captcha|mfa|2fa|two factor|otp|pin' }, username: { diff --git a/src/Form/matching.js b/src/Form/matching.js index e5fdb6c1f..bb488549d 100644 --- a/src/Form/matching.js +++ b/src/Form/matching.js @@ -258,7 +258,8 @@ class Matching { if ( ['password', 'text'].includes(input.type) && input.name !== 'email' && - input.placeholder !== 'Username' + // pcsretirement.com, improper use of the for attribute + input.name !== 'Username' ) { return 'credentials.password' } diff --git a/src/Form/test-cases/pcsretirementcom_login.html b/src/Form/test-cases/pcsretirementcom_login.html index e1636b896..d5e982d4f 100644 --- a/src/Form/test-cases/pcsretirementcom_login.html +++ b/src/Form/test-cases/pcsretirementcom_login.html @@ -51,4 +51,5 @@ - + + diff --git a/swift-package/Resources/assets/autofill-debug.js b/swift-package/Resources/assets/autofill-debug.js index 36be387dc..1469cd992 100644 --- a/swift-package/Resources/assets/autofill-debug.js +++ b/swift-package/Resources/assets/autofill-debug.js @@ -12332,7 +12332,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint|username/iu, + skip: /email|one-time|error|hint/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { @@ -12869,7 +12869,9 @@ class Matching { if (this.subtypeFromMatchers('password', input)) { // Any other input type is likely a false match // Arguably "text" should be as well, but it can be used for password reveal fields - if (['password', 'text'].includes(input.type) && input.name !== 'email' && input.placeholder !== 'Username') { + if (['password', 'text'].includes(input.type) && input.name !== 'email' && + // pcsretirement.com, improper use of the for attribute + input.name !== 'Username') { return 'credentials.password'; } } diff --git a/swift-package/Resources/assets/autofill.js b/swift-package/Resources/assets/autofill.js index 9a4c9a8f4..ca382cd2a 100644 --- a/swift-package/Resources/assets/autofill.js +++ b/swift-package/Resources/assets/autofill.js @@ -8166,7 +8166,7 @@ const matchingConfiguration = exports.matchingConfiguration = { }, password: { match: /password|passwort|kennwort|wachtwoord|mot de passe|clave|contraseña|lösenord/iu, - skip: /email|one-time|error|hint|username/iu, + skip: /email|one-time|error|hint/iu, forceUnknown: /captcha|mfa|2fa|two factor|otp|pin/iu }, username: { @@ -8703,7 +8703,9 @@ class Matching { if (this.subtypeFromMatchers('password', input)) { // Any other input type is likely a false match // Arguably "text" should be as well, but it can be used for password reveal fields - if (['password', 'text'].includes(input.type) && input.name !== 'email' && input.placeholder !== 'Username') { + if (['password', 'text'].includes(input.type) && input.name !== 'email' && + // pcsretirement.com, improper use of the for attribute + input.name !== 'Username') { return 'credentials.password'; } }