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

Fix fingerprinting test #129

Merged
merged 5 commits into from
Aug 23, 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
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ jobs:
extension-mv2:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: 'reference-tests'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: 'duckduckgo/duckduckgo-privacy-extension'
path: 'extension'
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
Expand All @@ -39,14 +39,14 @@ jobs:
ddg2dnr:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: 'reference-tests'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
repository: 'duckduckgo/duckduckgo-privacy-extension'
path: 'extension'
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'
Expand All @@ -64,18 +64,18 @@ jobs:
BrowserServicesKit:
name: BSK unit tests

runs-on: macos-13
runs-on: macos-14-xlarge
timeout-minutes: 30

steps:
- name: Check out the code
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: 'duckduckgo/BrowserServicesKit'
path: 'BrowserServicesKit'
submodules: recursive
- name: Check out the tests
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: 'BrowserServicesKit/Tests/BrowserServicesKitTests/Resources/privacy-reference-tests'

Expand All @@ -91,7 +91,7 @@ jobs:

- name: Cache SPM
if: env.cache_key_hash
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ./BrowserServicesKit/build
key: ${{ runner.os }}-spm-${{ env.cache_key_hash }}
Expand All @@ -110,15 +110,15 @@ jobs:
run: set -o pipefail && swift test | tee build-log.txt | xcbeautify --report junit --report-path . --junit-report-filename tests.xml

- name: Publish Unit Tests Report
uses: mikepenz/action-junit-report@v3
uses: mikepenz/action-junit-report@v4
if: always()
with:
check_name: BSK Test Report
report_paths: ./BrowserServicesKit/tests.xml
require_tests: true

- name: Upload logs
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: build-log.txt
Expand Down
5 changes: 3 additions & 2 deletions fingerprinting-protections/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Test suite specific fields:
## Pseudo-code implementation

```
$page.injectOnLoad('init.js')
$page.injectOnLoad('C-S-S')

for $testSet in test.json
loadReferenceConfig('config_reference.json')

Expand All @@ -35,8 +38,6 @@ for $testSet in test.json
siteURL = $test.siteURL,
)

$page.load('init.js')

$value = $page.eval($test.property)

if ($value instanceof Promise)
Expand Down
10 changes: 6 additions & 4 deletions fingerprinting-protections/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ function init(window) {
Object.defineProperty(window.Screen.prototype, 'colorDepth', { get: () => 12345, configurable: true });
Object.defineProperty(window.Screen.prototype, 'pixelDepth', { get: () => 12345, configurable: true });

window.navigator.webkitTemporaryStorage = {
queryUsageAndQuota: callback => {
callback(0, 9999999999)
}
if (!window.navigator.webkitTemporaryStorage) {
window.navigator.webkitTemporaryStorage = {};
}

window.navigator.webkitTemporaryStorage.queryUsageAndQuota = function queryUsageAndQuota(callback, _) {
callback(0, 9999999999);
};

window.DeviceOrientationEvent = window.Event; // we only need the constructor in tests
Expand Down
Loading