-
-
Notifications
You must be signed in to change notification settings - Fork 203
Description
The current (far from ideal) HackerOne TOTP:
<input autocomplete="off" class="text-field__input" id="sign_in_totp_code" maxlength="6" name="user[totp_code]" type="password" value="">Of course they should use autocomplete="one-time-code". However the /\btotp\b/ match in combination with maxlength=6, I think KeePassXC-browser should be enough hints to correctly detect TOTP here.
Expected Behavior
Detect TOTP field.
Current Behavior
The field is detected as password field.
Possible Solution
kpxcTOTPIcons.isAcceptedTOTPField(document.getElementById("sign_in_totp_code"))is true, however because it's detected as a password field first, it seems the field is no longer detected as TOTP:
keepassxc-browser/keepassxc-browser/content/fields.js
Lines 23 to 33 in aa288ff
| if (input.getLowerCaseAttribute('type') === 'password') { | |
| const combination = { | |
| username: (!usernameField || usernameField.size < 1) ? null : usernameField, | |
| password: input, | |
| passwordInputs: [ input ], | |
| form: input.form | |
| }; | |
| combinations.push(combination); | |
| usernameField = null; | |
| } else if (kpxcTOTPIcons.isValid(input)) { |
So I tried adding an explicit !isAcceptedTOTPField on line 23:
- if (input.getLowerCaseAttribute('type') === 'password') {
+ if (input.getLowerCaseAttribute('type') === 'password' && !kpxcTOTPIcons.isAcceptedTOTPField(input)) {- However
passwordwas added as a negative check in TOTP icon improvements #786 because of my complaining in Improvement: No "Fill TOTP from KeePassXC" in postal/zip_code fields #768.
This results in two solutions:
- Remove
passwordfromignoredTypesplus changingignoreRegexto/(bank|coupon|postal|user|zip)((?!(\b|_)totp(\b|_)).)*code|comment|author|error/i(note:user.*codeis probably to strict for negative, in this case it isuser[totp_code]but I can also imagineuser_mfa_codeetc.). - Adding an explicit
allowRegexwith strong indicators, e.g./\b(totp|otp|2fa|mfa)\b/i, in which case other soft checks are not performed (e.g.ignoredTypesandignoreRegex).
Steps to Reproduce (for bugs)
Enable 2FA on https://hackerone.com/ and sign in.
Debug info
KeePassXC - 2.7.9
KeePassXC-Browser - 1.9.3
Operating system: Linux x86_64
Browser: Mozilla Firefox 131.0