mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
[PM-1397] Display a warning when a user attempts to auto-fill an iframe (#4994)
* add settingsService.getEquivalentDomains * check that an iframe URL matches cipher.login.uris before autofilling * disable autofill on page load if it doesn't match * show a warning to the user on regular autofill if it doesn't match --------- Co-authored-by: Todd Martin <106564991+trmartin4@users.noreply.github.com> Co-authored-by: Robyn MacCallum <robyntmaccallum@gmail.com>
This commit is contained in:
@@ -40,6 +40,27 @@ export class SettingsService implements SettingsServiceAbstraction {
|
||||
await this.stateService.setSettings(settings);
|
||||
}
|
||||
|
||||
getEquivalentDomains(url: string): string[] {
|
||||
const domain = Utils.getDomain(url);
|
||||
if (domain == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const settings = this._settings.getValue();
|
||||
|
||||
let result: string[] = [];
|
||||
|
||||
if (settings?.equivalentDomains != null) {
|
||||
settings.equivalentDomains
|
||||
.filter((ed) => ed.length > 0 && ed.includes(domain))
|
||||
.forEach((ed) => {
|
||||
result = result.concat(ed);
|
||||
});
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
async clear(userId?: string): Promise<void> {
|
||||
if (userId == null || userId == (await this.stateService.getUserId())) {
|
||||
this._settings.next({});
|
||||
|
||||
@@ -1585,7 +1585,7 @@ export class StateService<
|
||||
);
|
||||
}
|
||||
|
||||
async getEquivalentDomains(options?: StorageOptions): Promise<any> {
|
||||
async getEquivalentDomains(options?: StorageOptions): Promise<string[][]> {
|
||||
return (
|
||||
await this.getAccount(this.reconcileOptions(options, await this.defaultOnDiskOptions()))
|
||||
)?.settings?.equivalentDomains;
|
||||
|
||||
Reference in New Issue
Block a user