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

Malware protection: bump BSK #3617

Merged
merged 7 commits into from
Dec 3, 2024
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
2 changes: 1 addition & 1 deletion DuckDuckGo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11313,7 +11313,7 @@
repositoryURL = "https://github.com/DuckDuckGo/BrowserServicesKit";
requirement = {
kind = exactVersion;
version = 216.0.1;
version = 217.0.0;
};
};
9F8FE9472BAE50E50071E372 /* XCRemoteSwiftPackageReference "lottie-spm" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/DuckDuckGo/BrowserServicesKit",
"state" : {
"revision" : "59f8fb2f850f8a0482c604d07396e01e8de59d21",
"version" : "216.0.1"
"revision" : "befc1f1094353d8d88a99ac08885684c978b2016",
"version" : "217.0.0"
}
},
{
Expand Down Expand Up @@ -138,7 +138,7 @@
{
"identity" : "swift-argument-parser",
"kind" : "remoteSourceControl",
"location" : "https://github.com/apple/swift-argument-parser.git",
"location" : "https://github.com/apple/swift-argument-parser",
"state" : {
"revision" : "0fbc8848e389af3bb55c182bc19ca9d5dc2f255b",
"version" : "1.4.0"
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGo/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2837,11 +2837,11 @@ extension MainViewController: OnboardingDelegate {
}

extension MainViewController: OnboardingNavigationDelegate {
func navigateTo(url: URL) {
func navigateFromOnboarding(to url: URL) {
self.loadUrl(url, fromExternalLink: true)
}
func searchFor(_ query: String) {

func searchFromOnboarding(for query: String) {
self.loadQuery(query)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ final class UnifiedFeedbackFormViewModel: ObservableObject {

enum Error: String, Swift.Error {
case missingAccessToken
case invalidRequest
case invalidResponse
}

Expand Down Expand Up @@ -297,9 +296,7 @@ final class UnifiedFeedbackFormViewModel: ObservableObject {
problemSubCategory: selectedSubcategory ?? "",
customMetadata: metadata?.toString() ?? "")
let headers = APIRequestV2.HeadersV2(additionalHeaders: [HTTPHeaderKey.authorization: "Bearer \(accessToken)"])
guard let request = APIRequestV2(url: Self.feedbackEndpoint, method: .post, headers: headers, body: payload.toData()) else {
throw Error.invalidRequest
}
let request = APIRequestV2(url: Self.feedbackEndpoint, method: .post, headers: headers, body: payload.toData())

let response: Response = try await apiService.fetch(request: request).decodeBody()
if let error = response.error, !error.isEmpty {
Expand Down
28 changes: 12 additions & 16 deletions DuckDuckGo/TabViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1712,20 +1712,16 @@ extension TabViewController: WKNavigationDelegate {

private func loadSpecialErrorPageIfNeeded(error: NSError) {
guard featureFlagger.isFeatureOn(.sslCertificatesBypass),
error.code == NSURLErrorServerCertificateUntrusted,
let errorCode = error.userInfo["_kCFStreamErrorCodeKey"] as? Int32,
let failedURL = error.failedUrl else {
return
}
error.isServerCertificateUntrusted,
let errorType = error.sslErrorType,
let failedURL = error.failedUrl,
let host = failedURL.host else { return }

let tld = storageCache.tld
let errorType = SSLErrorType.forErrorCode(Int(errorCode))
self.failedURL = failedURL
errorData = SpecialErrorData(kind: .ssl,
errorType: errorType.rawValue,
domain: failedURL.host,
eTldPlus1: tld.eTLDplus1(failedURL.host))
errorData = SpecialErrorData.ssl(type: errorType, domain: host, eTldPlus1: tld.eTLDplus1(host))
loadSpecialErrorPage(url: failedURL)
Pixel.fire(pixel: .certificateWarningDisplayed(errorType.rawParameter))
Pixel.fire(pixel: .certificateWarningDisplayed(errorType.pixelParameter))
}

private func loadSpecialErrorPage(url: URL) {
Expand Down Expand Up @@ -3087,12 +3083,12 @@ extension TabViewController: SaveLoginViewControllerDelegate {
}

extension TabViewController: OnboardingNavigationDelegate {
func searchFor(_ query: String) {

func searchFromOnboarding(for query: String) {
delegate?.tab(self, didRequestLoadQuery: query)
}

func navigateTo(url: URL) {
func navigateFromOnboarding(to url: URL) {
delegate?.tab(self, didRequestLoadURL: url)
}

Expand Down Expand Up @@ -3145,7 +3141,7 @@ extension UserContentController {

extension TabViewController: SpecialErrorPageUserScriptDelegate {

func leaveSite() {
func leaveSiteAction() {
Pixel.fire(pixel: .certificateWarningLeaveClicked)
guard webView?.canGoBack == true else {
delegate?.tabDidRequestClose(self)
Expand All @@ -3154,7 +3150,7 @@ extension TabViewController: SpecialErrorPageUserScriptDelegate {
_ = webView?.goBack()
}

func visitSite() {
func visitSiteAction() {
Pixel.fire(pixel: .certificateWarningProceedClicked)
isSpecialErrorPageVisible = false
shouldBypassSSLError = true
Expand Down
6 changes: 3 additions & 3 deletions DuckDuckGoTests/ContextualDaxDialogsFactoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -485,12 +485,12 @@ final class ContextualOnboardingDelegateMock: ContextualOnboardingDelegate {
func didTapDismissContextualOnboardingAction() {
didCallDidTapDismissContextualOnboardingAction = true
}
func searchFor(_ query: String) {

func searchFromOnboarding(for query: String) {
didCallSearchForQuery = true
}

func navigateTo(url: URL) {
func navigateFromOnboarding(to url: URL) {
didCallNavigateToURL = true
urlToNavigateTo = url
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,11 @@ class CapturingOnboardingNavigationDelegate: OnboardingNavigationDelegate {
var suggestedSearchQuery: String?
var urlToNavigateTo: URL?

func searchFor(_ query: String) {
func searchFromOnboarding(for query: String) {
suggestedSearchQuery = query
}

func navigateTo(url: URL) {
func navigateFromOnboarding(to url: URL) {
urlToNavigateTo = url
}
}
4 changes: 2 additions & 2 deletions DuckDuckGoTests/ContextualOnboardingPresenterTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ final class TabViewControllerMock: UIViewController, TabViewOnboardingDelegate {
didCallDidTapDismissAction = true
}

func searchFor(_ query: String) {
func searchFromOnboarding(for query: String) {
didCallSearchForQuery = true
capturedQuery = query
}

func navigateTo(url: URL) {
func navigateFromOnboarding(to url: URL) {
didCallNavigateToURL = true
capturedURL = url
}
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGoTests/OnboardingNavigationDelegateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ final class OnboardingNavigationDelegateTests: XCTestCase {
let expectedUrl = try XCTUnwrap(URL.makeSearchURL(query: query, queryContext: nil))

// WHEN
mainVC.searchFor(query)
mainVC.searchFromOnboarding(for: query)

// THEN
assertExpected(queryURL: expectedUrl)
Expand All @@ -123,7 +123,7 @@ final class OnboardingNavigationDelegateTests: XCTestCase {
let expectedUrl = try XCTUnwrap(URL(string: site))

// WHEN
mainVC.navigateTo(url: expectedUrl)
mainVC.navigateFromOnboarding(to: expectedUrl)

// THEN
assertExpected(url: expectedUrl)
Expand Down
4 changes: 2 additions & 2 deletions DuckDuckGoTests/TabViewControllerDaxDialogTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ final class TabViewControllerDaxDialogTests: XCTestCase {
XCTAssertNil(delegateMock.capturedQuery)

// WHEN
sut.searchFor(query)
sut.searchFromOnboarding(for: query)

// THEN
XCTAssertTrue(delegateMock.didRequestLoadQueryCalled)
Expand All @@ -70,7 +70,7 @@ final class TabViewControllerDaxDialogTests: XCTestCase {
XCTAssertNil(delegateMock.capturedURL)

// WHEN
sut.navigateTo(url: .ddg)
sut.navigateFromOnboarding(to: .ddg)

// THEN
XCTAssertTrue(delegateMock.didRequestLoadURLCalled)
Expand Down
Loading