Browse Source

fix(iot-hub): prevent browser autofill of TB credentials in device install form

The SHOW_FORM step renders a text input right before an
<input type="password"> and no input set autocomplete, so browsers and
password managers took it for a ThingsBoard login form on the same origin.
Saved TB credentials were filled into fields such as WiFi SSID / WiFi
Password and ended up in the generated firmware sketch (PROD-9020).

- PASSWORD input: autocomplete="new-password". With no current-password
  field in the form, Chrome's password manager no longer fills it on load.
- Text and number inputs: autocomplete="off".
- All inputs: data-lpignore="true", data-1p-ignore, data-bwignore. These are
  vendor-specific opt-outs for the LastPass, 1Password and Bitwarden
  extensions, which do their own field detection and ignore the standard
  autocomplete hint. They are set on the text inputs as well, so an
  extension cannot put the saved email into the field in front of the
  password (e.g. SSID). Do not remove them as noise.
feature/lts-4.2/iot-hub-devices
dpinkevych 1 month ago
parent
commit
fca141d463
  1. 9
      ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html

9
ui-ngx/src/app/modules/home/components/iot-hub/device-install-dialog/install-form-renderer/install-form-renderer.component.html

@ -33,7 +33,8 @@
<mat-form-field appearance="outline">
<mat-label>{{ field.label }}</mat-label>
<input matInput [type]="passwordVisible[field.key] ? 'text' : 'password'"
[formControlName]="field.key">
[formControlName]="field.key"
autocomplete="new-password" data-lpignore="true" data-1p-ignore data-bwignore>
<button mat-icon-button matSuffix type="button"
(click)="togglePasswordVisible(field.key)">
<mat-icon>{{ passwordVisible[field.key] ? 'visibility_off' : 'visibility' }}</mat-icon>
@ -60,7 +61,8 @@
@case (FormFieldType.INTEGER) {
<mat-form-field appearance="outline">
<mat-label>{{ field.label }}</mat-label>
<input matInput type="number" [formControlName]="field.key">
<input matInput type="number" [formControlName]="field.key"
autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
@if (field.helpText) {
<mat-hint>{{ field.helpText }}</mat-hint>
}
@ -75,7 +77,8 @@
@default {
<mat-form-field appearance="outline">
<mat-label>{{ field.label }}</mat-label>
<input matInput [formControlName]="field.key">
<input matInput [formControlName]="field.key"
autocomplete="off" data-lpignore="true" data-1p-ignore data-bwignore>
@if (field.randomGenerator) {
<button mat-icon-button matSuffix type="button"
[matTooltip]="'iot-hub.generate-random-value' | translate"

Loading…
Cancel
Save