Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix TOTP detection that are password fields (like HackerOne) #2333

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion keepassxc-browser/content/fields.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ kpxcFields.getAllCombinations = async function(inputs) {
continue;
}

if (input.getLowerCaseAttribute('type') === 'password') {
if (input.getLowerCaseAttribute('type') === 'password' && !kpxcTOTPIcons.isAcceptedTOTPField(input)) {
const combination = {
username: (!usernameField || usernameField.size < 1) ? null : usernameField,
password: input,
Expand Down
4 changes: 2 additions & 2 deletions keepassxc-browser/content/totp-field.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

const ignoreRegex = /(bank|coupon|postal|user|zip).*code|comment|author|error/i;
const ignoredTypes = [ 'email', 'password', 'username' ];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why password was removed. Standard TOTP fields aren't password fields, so this should be kept.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #2332 solution one, sometimes TOTP fields do have type=password.
Another solution would be the second one (an explicit accept), then the type!=password would also be bypassed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of making this change global, I'd suggest adding an exception for this site's TOTP detection to the sites.js.

const ignoreRegex = /(bank|coupon|postal|user|zip)((?!(\b|_)totp(\b|_)).)*code|comment|author|error/i;
const ignoredTypes = [ 'email', 'username'];

const acceptedOTPFields = [
'2fa',
Expand Down