Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into alex/malware-protecti…
Browse files Browse the repository at this point in the history
…on-pixels
  • Loading branch information
mallexxx committed Dec 20, 2024
2 parents 1734ae3 + 26699be commit 1ba01d0
Show file tree
Hide file tree
Showing 25 changed files with 237 additions and 130 deletions.
1 change: 0 additions & 1 deletion .eslintignore

This file was deleted.

25 changes: 0 additions & 25 deletions .eslintrc

This file was deleted.

2 changes: 1 addition & 1 deletion .xcode-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
16.1
16.2
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import SwiftUI
import BrowserServicesKit
import Core
import Common
import os.log

class CredentialProviderViewController: ASCredentialProviderViewController {

Expand All @@ -37,7 +38,11 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
tld: tld)

private lazy var secureVault: (any AutofillSecureVault)? = {
try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter())
if findKeychainItemsWithV4() {
return try? AutofillSecureVaultFactory.makeVault(reporter: SecureVaultReporter())
} else {
return nil
}
}()

private lazy var tld: TLD = TLD()
Expand Down Expand Up @@ -110,7 +115,9 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
installChildViewController(hostingController)

Task {
await credentialIdentityStoreManager.populateCredentialStore()
if findKeychainItemsWithV4() {
await credentialIdentityStoreManager.populateCredentialStore()
}
}

Pixel.fire(pixel: .autofillExtensionEnabled)
Expand Down Expand Up @@ -203,4 +210,31 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
}
}
}

private func findKeychainItemsWithV4() -> Bool {
var itemsWithV4: [String] = []

let query: [String: Any] = [
kSecClass as String: kSecClassGenericPassword,
kSecReturnAttributes as String: kCFBooleanTrue!,
kSecMatchLimit as String: kSecMatchLimitAll
]

var result: AnyObject?

let status = SecItemCopyMatching(query as CFDictionary, &result)

if status == errSecSuccess, let items = result as? [[String: Any]] {
for item in items {
if let service = item[kSecAttrService as String] as? String,
service.contains("v4") {
itemsWithV4.append(service)
}
}
} else {
Logger.autofill.debug("No items found or error: \(status)")
}

return !itemsWithV4.isEmpty
}
}
2 changes: 1 addition & 1 deletion Configuration/Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MARKETING_VERSION = 7.150.0
MARKETING_VERSION = 7.149.1
5 changes: 5 additions & 0 deletions Core/PixelEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,9 @@ extension Pixel {
case dbCrashDetectedDaily
case crashOnCrashHandlersSetUp

case crashReportCRCIDMissing
case crashReportingSubmissionFailed

case dbMigrationError
case dbRemovalError
case dbDestroyError
Expand Down Expand Up @@ -1456,6 +1459,8 @@ extension Pixel.Event {

case .dbCrashDetected: return "m_d_crash"
case .dbCrashDetectedDaily: return "m_d_crash_daily"
case .crashReportCRCIDMissing: return "m_crashreporting_crcid-missing"
case .crashReportingSubmissionFailed: return "m_crashreporting_submission-failed"
case .crashOnCrashHandlersSetUp: return "m_d_crash_on_handlers_setup"
case .dbMigrationError: return "m_d_dbme"
case .dbRemovalError: return "m_d_dbre"
Expand Down
Loading

0 comments on commit 1ba01d0

Please sign in to comment.