Skip to content

Commit

Permalink
Merge branch 'main' into tespach/phishing-detection-data-embedding
Browse files Browse the repository at this point in the history
  • Loading branch information
not-a-rootkit committed Aug 30, 2024
2 parents 4356518 + e54dd42 commit a2070a5
Show file tree
Hide file tree
Showing 249 changed files with 11,917 additions and 9,893 deletions.
25 changes: 0 additions & 25 deletions .github/actions/asana-extract-task-assignee/action.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ outputs:
value: ${{ steps.extract-automation-task-id.outputs.automation-task-id }}
assignee-id:
description: "Release task assignee ID"
value: ${{ steps.extract-assignee-id.outputs.assignee-id }}
value: ${{ steps.extract-assignee-id.outputs.asana_assignee_id }}
runs:
using: "composite"
steps:
Expand All @@ -24,10 +24,10 @@ runs:
run: bundle exec fastlane run asana_extract_task_id task_url:"${{ inputs.task-url }}"

- id: extract-assignee-id
uses: ./.github/actions/asana-extract-task-assignee
with:
task-id: ${{ steps.extract-task-id.outputs.asana_task_id }}
access-token: ${{ inputs.access-token }}
shell: bash
env:
ASANA_ACCESS_TOKEN: ${{ inputs.access-token }}
run: bundle exec fastlane run asana_extract_task_assignee task_id:"${{ steps.extract-task-id.outputs.asana_task_id }}"

- id: extract-automation-task-id
run: |
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ jobs:
with:
check_name: "Test Report: ${{ matrix.flavor }}"
report_paths: '${{ matrix.flavor }}*.xml'
check_retries: true

- name: Update Asana with failed unit tests
if: always() # always run even if the previous step fails
Expand Down
2 changes: 1 addition & 1 deletion Configuration/BuildNumber.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 250
CURRENT_PROJECT_VERSION = 251
363 changes: 258 additions & 105 deletions DuckDuckGo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/BrowserServicesKit",
"state" : {
"revision" : "4a55217003ad7b2d44a1ac616d47596c0bda69dc",
"version" : "186.0.0"
"revision" : "ac53011582abcca4aefd66f15308332273eecb49",
"version" : "190.0.0"
}
},
{
"identity" : "content-scope-scripts",
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/content-scope-scripts",
"state" : {
"revision" : "f97053d24c21ea301d4067adbbe0899ff940526a",
"version" : "6.7.0"
"revision" : "5876a5d2e2e7f5a2e11f6419c6c3fafb7cafdfca",
"version" : "6.12.0"
}
},
{
Expand Down Expand Up @@ -104,8 +104,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/duckduckgo/privacy-dashboard",
"state" : {
"revision" : "36dc07cba4bc1e7e0c1d1fb679c3cd077694a072",
"version" : "5.0.0"
"revision" : "665b23dc656c9f787494620494f8e56098a900b2",
"version" : "5.1.1"
}
},
{
Expand Down
10 changes: 5 additions & 5 deletions DuckDuckGo/Application/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import Subscription
import NetworkProtectionIPC
import DataBrokerProtection
import RemoteMessaging
import os.log

final class AppDelegate: NSObject, NSApplicationDelegate {

Expand All @@ -65,7 +66,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
let fileStore: FileStore

#if APPSTORE
private let crashCollection = CrashCollection(platform: .macOSAppStore, log: .default)
private let crashCollection = CrashCollection(platform: .macOSAppStore)
#else
private let crashReporter = CrashReporter()
#endif
Expand Down Expand Up @@ -164,7 +165,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
let encryptionKey = NSApplication.runType.requiresEnvironment ? try keyStore.readKey() : nil
fileStore = EncryptedFileStore(encryptionKey: encryptionKey)
} catch {
os_log("App Encryption Key could not be read: %s", "\(error)")
Logger.general.error("App Encryption Key could not be read: \(error.localizedDescription)")
fileStore = EncryptedFileStore()
}

Expand Down Expand Up @@ -545,7 +546,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
dataProvidersSource: syncDataProviders,
errorEvents: SyncErrorHandler(),
privacyConfigurationManager: ContentBlocking.shared.privacyConfigurationManager,
log: OSLog.sync,
environment: environment
)
syncService.initializeIfNeeded()
Expand Down Expand Up @@ -620,10 +620,10 @@ final class AppDelegate: NSObject, NSApplicationDelegate {
return
}
if isLocked {
os_log(.debug, log: .sync, "Screen is locked")
Logger.sync.debug("Screen is locked")
syncService.scheduler.cancelSyncAndSuspendSyncQueue()
} else {
os_log(.debug, log: .sync, "Screen is unlocked")
Logger.sync.debug("Screen is unlocked")
syncService.scheduler.resumeSyncQueue()
}
}
Expand Down
3 changes: 2 additions & 1 deletion DuckDuckGo/Application/DockCustomizer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import Foundation
import Common
import os.log

protocol DockCustomization {
var isAddedToDock: Bool { get }
Expand Down Expand Up @@ -104,7 +105,7 @@ final class DockCustomizer: DockCustomization {
}
return true
} catch {
os_log(.error, "Error writing to Dock plist: %{public}@", error.localizedDescription)
Logger.general.error("Error writing to Dock plist: \(error.localizedDescription, privacy: .public)")
return false
}
}
Expand Down
6 changes: 4 additions & 2 deletions DuckDuckGo/Application/URLEventHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import Subscription
import NetworkProtectionUI
import VPNAppLauncher
import DataBrokerProtection
import os.log
import BrowserServicesKit

// @MainActor
final class URLEventHandler {
Expand Down Expand Up @@ -64,14 +66,14 @@ final class URLEventHandler {

@objc func handleUrlEvent(event: NSAppleEventDescriptor, reply: NSAppleEventDescriptor) {
guard let stringValue = event.paramDescriptor(forKeyword: keyDirectObject)?.stringValue else {
os_log("UrlEventListener: unable to determine path", type: .error)
Logger.general.error("UrlEventListener: unable to determine path")
let error = NSError(domain: "CouldNotGetPath", code: -1, userInfo: nil)
PixelKit.fire(DebugEvent(GeneralPixel.appOpenURLFailed, error: error))
return
}

guard let url = URL.makeURL(from: stringValue) else {
os_log("UrlEventListener: failed to construct URL from path %s", type: .error, stringValue)
Logger.general.debug("UrlEventListener: failed to construct URL from path \(stringValue)")
let error = NSError(domain: "CouldNotConstructURL", code: -1, userInfo: nil)
PixelKit.fire(DebugEvent(GeneralPixel.appOpenURLFailed, error: error))
return
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"images" : [
{
"filename" : "Privacy-Pro-16D.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"preserves-vector-representation" : true,
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions DuckDuckGo/Autoconsent/AutoconsentExperiment.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@

import Foundation
import Common
import os.log

enum AutoconsentFilterlistExperiment: String, CaseIterable {
static var logic = AutoconsentExperimentLogic()
static var cohort: AutoconsentFilterlistExperiment? {
os_log("🚧 requesting CPM cohort", log: .autoconsent, type: .debug)
Logger.autoconsent.debug("🚧 requesting CPM cohort")
return logic.experimentCohort
}

Expand All @@ -36,11 +37,11 @@ final internal class AutoconsentExperimentLogic {
// if the stored cohort doesn't match, allocate a new one
let cohort = AutoconsentFilterlistExperiment(rawValue: allocatedExperimentCohort)
{
os_log("🚧 existing CPM cohort: %s", log: .autoconsent, type: .debug, String(describing: cohort.rawValue))
Logger.autoconsent.debug("🚧 existing CPM cohort: \(String(describing: cohort.rawValue))")
return cohort
}
let cohort = AutoconsentFilterlistExperiment.allCases.randomElement()!
os_log("🚧 new CPM cohort: %s", log: .autoconsent, type: .debug, String(describing: cohort.rawValue))
Logger.autoconsent.debug("🚧 new CPM cohort: \(String(describing: cohort.rawValue))")
allocatedExperimentCohort = cohort.rawValue
return cohort
}
Expand Down
35 changes: 18 additions & 17 deletions DuckDuckGo/Autoconsent/AutoconsentUserScript.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import BrowserServicesKit
import Common
import UserScript
import PrivacyDashboard
import os.log

protocol AutoconsentUserScriptDelegate: AnyObject {
func autoconsentUserScript(consentStatus: CookieConsentInfo)
Expand Down Expand Up @@ -50,7 +51,7 @@ final class AutoconsentUserScript: NSObject, WKScriptMessageHandlerWithReply, Us
weak var delegate: AutoconsentUserScriptDelegate?

init(scriptSource: ScriptSourceProviding, config: PrivacyConfiguration) {
os_log("Initialising autoconsent userscript", log: .autoconsent, type: .debug)
Logger.autoconsent.debug("Initialising autoconsent userscript")
source = Self.loadJS("autoconsent-bundle", from: .main, withReplacements: [:])
self.config = config
}
Expand All @@ -65,15 +66,15 @@ final class AutoconsentUserScript: NSObject, WKScriptMessageHandlerWithReply, Us
let consentStatus = CookieConsentInfo(
consentManaged: consentManaged, cosmetic: cosmetic, optoutFailed: optoutFailed, selftestFailed: selftestFailed
)
os_log("Refreshing dashboard state: %s", log: .autoconsent, type: .debug, String(describing: consentStatus))
Logger.autoconsent.debug("Refreshing dashboard state: \(String(describing: consentStatus))")
self.delegate?.autoconsentUserScript(consentStatus: consentStatus)
}

@MainActor
func userContentController(_ userContentController: WKUserContentController,
didReceive message: WKScriptMessage,
replyHandler: @escaping (Any?, String?) -> Void) {
os_log("Message received: %s", log: .autoconsent, type: .debug, String(describing: message.body))
Logger.autoconsent.debug("Message received: \(String(describing: message.body))")
return handleMessage(replyHandler: replyHandler, message: message)
}
}
Expand Down Expand Up @@ -149,7 +150,7 @@ extension AutoconsentUserScript {
let json = try JSONSerialization.data(withJSONObject: message)
return try JSONDecoder().decode(Target.self, from: json)
} catch {
os_log(.error, "Error decoding message body: %{public}@", error.localizedDescription)
Logger.autoconsent.error("Error decoding message body: \(error.localizedDescription, privacy: .public)")
return nil
}
}
Expand All @@ -170,13 +171,13 @@ extension AutoconsentUserScript {
case MessageName.eval:
handleEval(message: message, replyHandler: replyHandler)
case MessageName.popupFound:
os_log("Autoconsent popup found", log: .autoconsent)
Logger.autoconsent.debug("Autoconsent popup found")
replyHandler([ "type": "ok" ], nil) // this is just to prevent a Promise rejection
case MessageName.optOutResult:
handleOptOutResult(message: message, replyHandler: replyHandler)
case MessageName.optInResult:
// this is not supported in browser
os_log("ignoring optInResult: %s", log: .autoconsent, type: .debug, String(describing: message.body))
Logger.autoconsent.debug("ignoring optInResult: \(String(describing: message.body))")
replyHandler(nil, "opt-in is not supported")
case MessageName.cmpDetected:
// no need to do anything here
Expand All @@ -186,7 +187,7 @@ extension AutoconsentUserScript {
case MessageName.autoconsentDone:
handleAutoconsentDone(message: message, replyHandler: replyHandler)
case MessageName.autoconsentError:
os_log("Autoconsent error: %s", log: .autoconsent, String(describing: message.body))
Logger.autoconsent.debug("Autoconsent error: \(String(describing: message.body))")
replyHandler([ "type": "ok" ], nil) // this is just to prevent a Promise rejection
}
}
Expand All @@ -204,7 +205,7 @@ extension AutoconsentUserScript {

guard url.navigationalScheme?.isHypertextScheme == true else {
// ignore special schemes
os_log("Ignoring special URL scheme: %s", log: .autoconsent, type: .debug, messageData.url)
Logger.autoconsent.debug("Ignoring special URL scheme: \(messageData.url)")
replyHandler([ "type": "ok" ], nil) // this is just to prevent a Promise rejection
return
}
Expand All @@ -217,7 +218,7 @@ extension AutoconsentUserScript {

let topURLDomain = message.webView?.url?.host
guard config.isFeature(.autoconsent, enabledForDomain: topURLDomain) else {
os_log("disabled for site: %s", log: .autoconsent, type: .info, String(describing: url.absoluteString))
Logger.autoconsent.info("disabled for site: \(String(describing: url.absoluteString))")
replyHandler([ "type": "ok" ], nil) // this is just to prevent a Promise rejection
return
}
Expand Down Expand Up @@ -297,7 +298,7 @@ extension AutoconsentUserScript {
replyHandler(nil, "cannot decode message")
return
}
os_log("opt-out result: %s", log: .autoconsent, type: .debug, String(describing: messageData))
Logger.autoconsent.debug("opt-out result: \(String(describing: messageData))")

if !messageData.result {
refreshDashboardState(consentManaged: true, cosmetic: nil, optoutFailed: true, selftestFailed: nil)
Expand All @@ -317,7 +318,7 @@ extension AutoconsentUserScript {
replyHandler(nil, "cannot decode message")
return
}
os_log("opt-out successful: %s", log: .autoconsent, type: .debug, String(describing: messageData))
Logger.autoconsent.debug("opt-out successful: \(String(describing: messageData))")

guard let url = URL(string: messageData.url),
let host = url.host else {
Expand All @@ -329,7 +330,7 @@ extension AutoconsentUserScript {

// trigger popup once per domain
if !management.sitesNotifiedCache.contains(host) {
os_log("bragging that we closed a popup", log: .autoconsent, type: .debug)
Logger.autoconsent.debug("bragging that we closed a popup")
management.sitesNotifiedCache.insert(host)
// post popover notification on main thread
DispatchQueue.main.async {
Expand All @@ -344,22 +345,22 @@ extension AutoconsentUserScript {

if let selfTestWebView = selfTestWebView,
let selfTestFrameInfo = selfTestFrameInfo {
os_log("requesting self-test in: %s", log: .autoconsent, type: .debug, messageData.url)
Logger.autoconsent.debug("requesting self-test in: \(messageData.url)")
selfTestWebView.evaluateJavaScript(
"window.autoconsentMessageCallback({ type: 'selfTest' })",
in: selfTestFrameInfo,
in: WKContentWorld.defaultClient,
completionHandler: { (result) in
switch result {
case.failure(let error):
os_log("Error running self-test: %s", log: .autoconsent, type: .debug, String(describing: error))
Logger.autoconsent.error("Error running self-test: \(error.localizedDescription, privacy: .public)")
case.success:
os_log("self-test requested", log: .autoconsent, type: .debug)
Logger.autoconsent.debug("self-test requested")
}
}
)
} else {
os_log("no self-test scheduled in this tab", log: .autoconsent, type: .debug)
Logger.autoconsent.debug("no self-test scheduled in this tab")
}
selfTestWebView = nil
selfTestFrameInfo = nil
Expand All @@ -372,7 +373,7 @@ extension AutoconsentUserScript {
return
}
// store self-test result
os_log("self-test result: %s", log: .autoconsent, type: .debug, String(describing: messageData))
Logger.autoconsent.debug("self-test result: \(String(describing: messageData))")
refreshDashboardState(consentManaged: true, cosmetic: nil, optoutFailed: false, selftestFailed: messageData.result)
replyHandler([ "type": "ok" ], nil) // this is just to prevent a Promise rejection
}
Expand Down
Loading

0 comments on commit a2070a5

Please sign in to comment.