[PM-4415] Detect password submissions on forms that do not emit submit
This commit is contained in:
parent
9853c2180d
commit
377fae713c
|
@ -227,6 +227,7 @@ export type OverlayBackgroundExtensionMessageHandlers = {
|
||||||
addEditCipherSubmitted: () => void;
|
addEditCipherSubmitted: () => void;
|
||||||
editedCipher: () => void;
|
editedCipher: () => void;
|
||||||
deletedCipher: () => void;
|
deletedCipher: () => void;
|
||||||
|
bgSaveCipher: () => void;
|
||||||
fido2AbortRequest: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
fido2AbortRequest: ({ message, sender }: BackgroundOnMessageHandlerParams) => void;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -173,6 +173,7 @@ export class OverlayBackground implements OverlayBackgroundInterface {
|
||||||
addEditCipherSubmitted: () => this.updateOverlayCiphers(),
|
addEditCipherSubmitted: () => this.updateOverlayCiphers(),
|
||||||
editedCipher: () => this.updateOverlayCiphers(),
|
editedCipher: () => this.updateOverlayCiphers(),
|
||||||
deletedCipher: () => this.updateOverlayCiphers(),
|
deletedCipher: () => this.updateOverlayCiphers(),
|
||||||
|
bgSaveCipher: () => this.updateOverlayCiphers(),
|
||||||
fido2AbortRequest: ({ sender }) => this.abortFido2ActiveRequest(sender.tab.id),
|
fido2AbortRequest: ({ sender }) => this.abortFido2ActiveRequest(sender.tab.id),
|
||||||
};
|
};
|
||||||
private readonly inlineMenuButtonPortMessageHandlers: InlineMenuButtonPortMessageHandlers = {
|
private readonly inlineMenuButtonPortMessageHandlers: InlineMenuButtonPortMessageHandlers = {
|
||||||
|
|
|
@ -289,10 +289,22 @@ export class InlineMenuFieldQualificationService
|
||||||
field: AutofillField,
|
field: AutofillField,
|
||||||
pageDetails: AutofillPageDetails,
|
pageDetails: AutofillPageDetails,
|
||||||
): boolean {
|
): boolean {
|
||||||
|
const parentForm = pageDetails.forms[field.form];
|
||||||
|
|
||||||
// If the provided field is set with an autocomplete value of "current-password", we should assume that
|
// If the provided field is set with an autocomplete value of "current-password", we should assume that
|
||||||
// the page developer intends for this field to be interpreted as a password field for a login form.
|
// the page developer intends for this field to be interpreted as a password field for a login form.
|
||||||
if (this.fieldContainsAutocompleteValues(field, this.currentPasswordAutocompleteValue)) {
|
if (this.fieldContainsAutocompleteValues(field, this.currentPasswordAutocompleteValue)) {
|
||||||
return pageDetails.fields.filter(this.isNewPasswordField).length === 0;
|
if (!parentForm) {
|
||||||
|
return (
|
||||||
|
pageDetails.fields.filter(this.isNewPasswordField).filter((f) => f.viewable).length === 0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
pageDetails.fields
|
||||||
|
.filter(this.isNewPasswordField)
|
||||||
|
.filter((f) => f.viewable && f.form === field.form).length === 0
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const usernameFieldsInPageDetails = pageDetails.fields.filter(this.isUsernameField);
|
const usernameFieldsInPageDetails = pageDetails.fields.filter(this.isUsernameField);
|
||||||
|
@ -306,7 +318,6 @@ export class InlineMenuFieldQualificationService
|
||||||
|
|
||||||
// If the field is not structured within a form, we need to identify if the field is present on
|
// If the field is not structured within a form, we need to identify if the field is present on
|
||||||
// a page with multiple password fields. If that isn't the case, we can assume this is a login form field.
|
// a page with multiple password fields. If that isn't the case, we can assume this is a login form field.
|
||||||
const parentForm = pageDetails.forms[field.form];
|
|
||||||
if (!parentForm) {
|
if (!parentForm) {
|
||||||
// If no parent form is found, and multiple password fields are present, we should assume that
|
// If no parent form is found, and multiple password fields are present, we should assume that
|
||||||
// the passed field belongs to a user account creation form.
|
// the passed field belongs to a user account creation form.
|
||||||
|
|
Loading…
Reference in New Issue