Bug 1577808: add telemetry for breached logins r=MattN

Differential Revision: https://phabricator.services.mozilla.com/D44524

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Luke Crouch 2019-09-05 23:01:02 +00:00
Родитель 540a742986
Коммит 010f500b2d
6 изменённых файлов: 80 добавлений и 15 удалений

Просмотреть файл

@ -131,12 +131,14 @@ class AboutLoginsChild extends ActorChild {
break;
}
case "AboutLoginsRecordTelemetryEvent": {
let { method, object } = event.detail;
let { method, object, extra = {} } = event.detail;
try {
Services.telemetry.recordEvent(
TELEMETRY_EVENT_CATEGORY,
method,
object
object,
null,
extra
);
} catch (ex) {
Cu.reportError(

Просмотреть файл

@ -120,6 +120,10 @@ this.LoginBreaches = {
breachesByLoginGUID.set(login.guid, breach);
}
}
Services.telemetry.scalarSet(
"pwmgr.potentially_breached_passwords",
breachesByLoginGUID.size
);
return breachesByLoginGUID;
},

Просмотреть файл

@ -65,6 +65,9 @@ export default class LoginItem extends HTMLElement {
this._timeChanged = this.shadowRoot.querySelector(".time-changed");
this._timeUsed = this.shadowRoot.querySelector(".time-used");
this._breachAlert = this.shadowRoot.querySelector(".breach-alert");
this._breachAlertLink = this._breachAlert.querySelector(
".breach-alert-link"
);
this._dismissBreachAlert = this.shadowRoot.querySelector(
".dismiss-breach-alert"
);
@ -82,6 +85,7 @@ export default class LoginItem extends HTMLElement {
this._originInput.addEventListener("click", this);
this._revealCheckbox.addEventListener("click", this);
this._originInput.addEventListener("auxclick", this);
this._breachAlertLink.addEventListener("click", this);
window.addEventListener("AboutLoginsInitialLoginSelected", this);
window.addEventListener("AboutLoginsLoadInitialFavicon", this);
window.addEventListener("AboutLoginsLoginSelected", this);
@ -109,10 +113,7 @@ export default class LoginItem extends HTMLElement {
});
if (this._breachesMap && this._breachesMap.has(this._login.guid)) {
const breachDetails = this._breachesMap.get(this._login.guid);
const breachAlertLink = this._breachAlert.querySelector(
".breach-alert-link"
);
breachAlertLink.href = breachDetails.breachAlertURL;
this._breachAlertLink.href = breachDetails.breachAlertURL;
document.l10n.setAttributes(
this._dismissBreachAlert,
"breach-alert-dismiss"
@ -177,6 +178,10 @@ export default class LoginItem extends HTMLElement {
detail: this._login,
})
);
this._recordTelemetryEvent({
object: "existing_login",
method: "dismiss_breach_alert",
});
}
showLoginItemError(error) {
@ -253,7 +258,7 @@ export default class LoginItem extends HTMLElement {
this._updatePasswordRevealState();
let method = this._revealCheckbox.checked ? "show" : "hide";
recordTelemetryEvent({ object: "password", method });
this._recordTelemetryEvent({ object: "password", method });
return;
}
@ -269,7 +274,7 @@ export default class LoginItem extends HTMLElement {
}
} else if (!this.hasPendingChanges()) {
window.dispatchEvent(new CustomEvent("AboutLoginsClearSelection"));
recordTelemetryEvent({
this._recordTelemetryEvent({
object: "new_login",
method: "cancel",
});
@ -317,7 +322,7 @@ export default class LoginItem extends HTMLElement {
this._copyUsernameTimeoutId = timeoutId;
}
recordTelemetryEvent({
this._recordTelemetryEvent({
object: copyButton.dataset.telemetryObject,
method: "copy",
});
@ -342,12 +347,21 @@ export default class LoginItem extends HTMLElement {
this._toggleEditing();
this.render();
recordTelemetryEvent({ object: "existing_login", method: "edit" });
this._recordTelemetryEvent({
object: "existing_login",
method: "edit",
});
return;
}
if (classList.contains("origin-input")) {
this._handleOriginClick();
}
if (classList.contains("breach-alert-link")) {
this._recordTelemetryEvent({
object: "existing_login",
method: "learn_more_breach",
});
}
break;
}
case "submit": {
@ -366,7 +380,10 @@ export default class LoginItem extends HTMLElement {
})
);
recordTelemetryEvent({ object: "existing_login", method: "save" });
this._recordTelemetryEvent({
object: "existing_login",
method: "save",
});
} else {
document.dispatchEvent(
new CustomEvent("AboutLoginsCreateLogin", {
@ -375,7 +392,7 @@ export default class LoginItem extends HTMLElement {
})
);
recordTelemetryEvent({ object: "new_login", method: "save" });
this._recordTelemetryEvent({ object: "new_login", method: "save" });
}
}
}
@ -440,7 +457,7 @@ export default class LoginItem extends HTMLElement {
try {
onConfirm();
} catch (ex) {}
recordTelemetryEvent({
this._recordTelemetryEvent({
object: wasExistingLogin ? "existing_login" : "new_login",
method,
});
@ -565,7 +582,10 @@ export default class LoginItem extends HTMLElement {
})
);
recordTelemetryEvent({ object: "existing_login", method: "open_site" });
this._recordTelemetryEvent({
object: "existing_login",
method: "open_site",
});
}
/**
@ -602,6 +622,15 @@ export default class LoginItem extends HTMLElement {
};
}
_recordTelemetryEvent(eventObject) {
const extra = eventObject.hasOwnProperty("extra") ? eventObject.extra : {};
if (this._breachesMap && this._breachesMap.has(this._login.guid)) {
Object.assign(extra, { breached: "true" });
eventObject.extra = extra;
}
recordTelemetryEvent(eventObject);
}
/**
* Toggles the login-item view from editing to non-editing mode.
*

Просмотреть файл

@ -146,7 +146,14 @@ export default class LoginList extends HTMLElement {
})
);
recordTelemetryEvent({ object: "existing_login", method: "select" });
const extra = listItem.classList.contains("breached")
? { breached: "true" }
: {};
recordTelemetryEvent({
object: "existing_login",
method: "select",
extra,
});
break;
}
case "change": {

Просмотреть файл

@ -574,6 +574,9 @@ pwmgr:
description: >
These events record interactions on the about:logins page. Sort methods have an accompanying
value that specifies what order the list of logins is sorted with: {last_changed, last_used, title}.
extra_keys:
breached: >
Whether the login is marked as breached or not.
objects: [
"existing_login",
"list",
@ -585,9 +588,11 @@ pwmgr:
"cancel",
"copy",
"delete",
"dismiss_breach_alert",
"edit",
"filter",
"hide",
"learn_more_breach",
"new",
"open_site",
"save",

Просмотреть файл

@ -607,6 +607,24 @@ security:
record_in_processes:
- main
pwmgr:
potentially_breached_passwords:
bug_numbers:
- 1577808
description: >
The number of potentially breached passwords, as determined by
LoginBreaches.getPotentialBreachesByLoginGUID.
expires: never
kind: uint
notification_emails:
- seceng-telemetry@mozilla.com
- passwords-dev@mozilla.org
release_channel_collection: opt-out
products:
- 'firefox'
record_in_processes:
- main
contentblocking:
cryptomining_blocking_enabled:
bug_numbers: