Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add FXIOS-5207 [v108] Telemetry for logins component key regeneration logic #12306

Merged
merged 1 commit into from
Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Storage/Rust/RustLogins.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import Foundation
import Shared
import Glean
@_exported import MozillaAppServices

private let log = Logger.syncLogger
Expand Down Expand Up @@ -908,6 +909,7 @@ public class RustLogins {
return key!
} else {
SentryIntegration.shared.sendWithStacktrace(message: "Logins key was corrupted, new one generated", tag: SentryTag.rustLogins, severity: .warning)
GleanMetrics.LoginsStoreKeyRegeneration.corrupt.record()
_ = self.wipeLocalEngine()
return try rustKeys.createAndStoreKey()
}
Expand All @@ -918,6 +920,7 @@ public class RustLogins {
// The key is present, but we didn't expect it to be there.
do {
SentryIntegration.shared.sendWithStacktrace(message: "Logins key lost due to storage malfunction, new one generated", tag: SentryTag.rustLogins, severity: .warning)
GleanMetrics.LoginsStoreKeyRegeneration.other.record()
_ = self.wipeLocalEngine()
return try rustKeys.createAndStoreKey()
} catch let err as NSError {
Expand All @@ -927,6 +930,7 @@ public class RustLogins {
// We expected the key to be present, but it's gone missing on us.
do {
SentryIntegration.shared.sendWithStacktrace(message: "Logins key lost, new one generated", tag: SentryTag.rustLogins, severity: .warning)
GleanMetrics.LoginsStoreKeyRegeneration.lost.record()
_ = self.wipeLocalEngine()
return try rustKeys.createAndStoreKey()
} catch let err as NSError {
Expand Down
49 changes: 49 additions & 0 deletions Storage/metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,52 @@ history:
- [email protected]
- [email protected]
expires: never

logins_store_key_regeneration:
# These track when we need to regenerate the encryption key which causes all
# local data to be lost
lost:
type: event
description: >
The encryption key was regenerated because it was lost
bugs:
- https://github.com/mozilla/application-services/issues/5221
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/12306
data_sensitivity:
- technical
notification_emails:
- [email protected]
- [email protected]
expires: never

corrupt:
type: event
description: >
The encryption key was regenerated because it didn't match the encrypted
data
bugs:
- https://github.com/mozilla/application-services/issues/5221
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/12306
data_sensitivity:
- technical
notification_emails:
- [email protected]
- [email protected]
expires: never

other:
type: event
description: >
The encryption key was regenerated for an unknown reason
bugs:
- https://github.com/mozilla/application-services/issues/5221
data_reviews:
- https://github.com/mozilla-mobile/firefox-ios/pull/12306
data_sensitivity:
- technical
notification_emails:
- [email protected]
- [email protected]
expires: never