-
Notifications
You must be signed in to change notification settings - Fork 430
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/main' into alex/malware-protection
- Loading branch information
Showing
56 changed files
with
1,475 additions
and
945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# local-storage.yaml | ||
appId: com.duckduckgo.mobile.ios | ||
tags: | ||
- release | ||
|
||
--- | ||
|
||
# Set up | ||
- runFlow: | ||
file: ../shared/setup.yaml | ||
|
||
# Load Site | ||
- assertVisible: | ||
id: "searchEntry" | ||
- tapOn: | ||
id: "searchEntry" | ||
- inputText: "https://privacy-test-pages.site/features/local-storage.html" | ||
- pressKey: Enter | ||
|
||
# Add a cookie | ||
- assertVisible: "Storage Counter: undefined" | ||
- assertVisible: "Cookie Counter:" | ||
- assertNotVisible: "Cookie Counter: 1" | ||
- assertNotVisible: "Storage Counter: 1" | ||
- assertVisible: "Manual Increment" | ||
- tapOn: "Manual Increment" | ||
- tapOn: "Manual Increment" | ||
- assertVisible: "Cookie Counter: 2" | ||
- assertVisible: "Storage Counter: 2" | ||
|
||
# Fireproofing | ||
- tapOn: "Browsing menu" | ||
- tapOn: "Fireproof This Site" | ||
- tapOn: "Fireproof" | ||
|
||
# Fire button | ||
- tapOn: "Close Tabs and Clear Data" | ||
- tapOn: "Close Tabs and Clear Data" | ||
|
||
- assertNotVisible: "https://privacy-test-pages.site/features/local-storage.html" | ||
|
||
# Load Site | ||
- assertVisible: | ||
id: "searchEntry" | ||
- tapOn: | ||
id: "searchEntry" | ||
|
||
- inputText: "https://privacy-test-pages.site/features/local-storage.html" | ||
- pressKey: Enter | ||
- assertVisible: "Storage Counter: 2" | ||
- assertVisible: "Cookie Counter: 2" | ||
|
||
# Remove Fireproofing | ||
- tapOn: "Browsing menu" | ||
- tapOn: "Remove Fireproofing" | ||
|
||
# Fire button | ||
- tapOn: "Close Tabs and Clear Data" | ||
- tapOn: "Close Tabs and Clear Data" | ||
|
||
- assertNotVisible: "https://privacy-test-pages.site/features/local-storage.html" | ||
|
||
# Load Site | ||
- assertVisible: | ||
id: "searchEntry" | ||
- tapOn: | ||
id: "searchEntry" | ||
|
||
- inputText: "https://privacy-test-pages.site/features/local-storage.html" | ||
- pressKey: Enter | ||
- assertVisible: "Storage Counter: undefined" | ||
- assertVisible: "Cookie Counter:" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
MARKETING_VERSION = 7.147.0 | ||
MARKETING_VERSION = 7.148.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
// | ||
// DataStoreIDManager.swift | ||
// DuckDuckGo | ||
// | ||
// Copyright © 2024 DuckDuckGo. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
|
||
import WebKit | ||
import Persistence | ||
|
||
/// Supports an existing ID set in previous versions of the app, but moving forward does not allocate an ID. We have gone back to using the default | ||
/// peristence for the webview storage so that we can fireproof types that don't have an API for accessing their data. (e.g. localStorage) | ||
public protocol DataStoreIDManaging { | ||
|
||
var currentID: UUID? { get } | ||
|
||
func invalidateCurrentID() | ||
} | ||
|
||
public class DataStoreIDManager: DataStoreIDManaging { | ||
|
||
enum Constants: String { | ||
case currentWebContainerID = "com.duckduckgo.ios.webcontainer.id" | ||
} | ||
|
||
public static let shared = DataStoreIDManager() | ||
|
||
private let store: KeyValueStoring | ||
init(store: KeyValueStoring = UserDefaults.app) { | ||
self.store = store | ||
} | ||
|
||
public var currentID: UUID? { | ||
guard let uuidString = store.object(forKey: Constants.currentWebContainerID.rawValue) as? String else { | ||
return nil | ||
} | ||
return UUID(uuidString: uuidString) | ||
} | ||
|
||
public func invalidateCurrentID() { | ||
store.removeObject(forKey: Constants.currentWebContainerID.rawValue) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// | ||
// HTTPCookieExtension.swift | ||
// DuckDuckGo | ||
// | ||
// Copyright © 2024 DuckDuckGo. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import WebKit | ||
|
||
extension HTTPCookie { | ||
|
||
/// Checks that the `cookieDomain` (provided by a cookie) matches a given domain. e.g. | ||
/// * cookie domain example.com would match a domain called example.com | ||
/// * cookie domain `.example.com` would also match a domain called example.com and also any subdomain, e.g. `docs.example.com` | ||
/// | ||
/// See `UserDefaultsFireproofingTests` for more examples. | ||
static func cookieDomain(_ cookieDomain: String, matchesTestDomain testDomain: String) -> Bool { | ||
return testDomain == cookieDomain | ||
|| ".\(testDomain)" == cookieDomain | ||
|| (cookieDomain.hasPrefix(".") && testDomain.hasSuffix(cookieDomain)) | ||
} | ||
|
||
} |
Oops, something went wrong.