@whotracksme/reporting 5.1.24 → 5.1.26
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/release.yml +2 -2
- package/.github/workflows/tests.yml +4 -5
- package/.tool-versions +1 -1
- package/CHANGELOG.md +32 -0
- package/package.json +3 -2
- package/reporting/karma.conf.cjs +2 -0
- package/reporting/package.json +4 -1
- package/reporting/src/bloom-filters.js +4 -4
- package/reporting/src/fixed-size-cache.js +1 -1
- package/reporting/src/logger.js +0 -1
- package/reporting/src/md5.js +1 -1
- package/reporting/src/network.js +1 -1
- package/reporting/src/pages.js +84 -21
- package/reporting/src/persisted-bitarray.js +2 -2
- package/reporting/src/request/config.js +2 -2
- package/reporting/src/request/hash.js +2 -2
- package/reporting/src/request/index.js +30 -29
- package/reporting/src/request/page-telemetry.js +2 -2
- package/reporting/src/request/qs-whitelist2.js +3 -3
- package/reporting/src/request/steps/cookie-context.js +6 -6
- package/reporting/src/request/steps/oauth-detector.js +3 -3
- package/reporting/src/request/steps/page-logger.js +5 -2
- package/reporting/src/request/steps/redirect-tagger.js +1 -1
- package/reporting/src/request/steps/token-checker/index.js +3 -3
- package/reporting/src/request/steps/token-checker/token-domain.js +3 -3
- package/reporting/src/request/steps/token-examiner.js +5 -5
- package/reporting/src/request/steps/token-telemetry/cached-entry-pipeline.js +3 -3
- package/reporting/src/request/steps/token-telemetry/index.js +4 -4
- package/reporting/src/request/steps/token-telemetry/key-pipeline.js +1 -1
- package/reporting/src/request/steps/token-telemetry/token-pipeline.js +1 -1
- package/reporting/src/request/utils/bloom-filter-packed.js +1 -1
- package/reporting/src/request/utils/chrome-storage-map.js +13 -1
- package/reporting/src/request/utils/subject.js +1 -1
- package/reporting/src/request/utils/temp-set.js +1 -1
- package/reporting/src/request-reporter.js +3 -3
- package/reporting/src/sanitizer.js +11 -3
- package/reporting/src/utils/pacemaker.js +1 -1
- package/reporting/src/utils/url.js +0 -29
- package/reporting/src/webrequest-pipeline/cname-uncloak.js +2 -2
- package/reporting/src/webrequest-pipeline/index.js +10 -11
- package/reporting/src/webrequest-pipeline/logger.js +1 -1
- package/reporting/src/webrequest-pipeline/page-store.js +23 -20
- package/reporting/src/webrequest-pipeline/page.js +81 -104
- package/reporting/src/webrequest-pipeline/pipeline.js +1 -1
- package/reporting/src/webrequest-pipeline/utils/webrequest.js +63 -57
- package/reporting/src/webrequest-pipeline/webrequest-context.js +6 -5
- package/reporting/test/helpers/fetch-mock.js +2 -2
- package/reporting/test/helpers/scenarios.js +85 -0
- package/reporting/test/pages.spec.js +52 -4
- package/reporting/test/request-reporter.test.js +251 -0
- package/reporting/test/sanitizer.spec.js +16 -0
- package/reporting/test/setup.unit.js +17 -0
- package/reporting/test/utils/url.spec.js +1 -26
- package/reporting/test/webrequest-pipeline/index.test.js +147 -0
- package/reporting/test/webrequest-pipeline/page-store.test.js +135 -0
|
@@ -7,13 +7,13 @@ on:
|
|
|
7
7
|
jobs:
|
|
8
8
|
release:
|
|
9
9
|
name: Trigger release
|
|
10
|
-
runs-on: ubuntu-
|
|
10
|
+
runs-on: ubuntu-24.04
|
|
11
11
|
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')"
|
|
12
12
|
steps:
|
|
13
13
|
- uses: actions/checkout@v2
|
|
14
14
|
- uses: actions/setup-node@v2
|
|
15
15
|
with:
|
|
16
|
-
node-version: '
|
|
16
|
+
node-version: '22'
|
|
17
17
|
cache: 'npm'
|
|
18
18
|
|
|
19
19
|
- name: Prepare repository
|
|
@@ -12,9 +12,8 @@ jobs:
|
|
|
12
12
|
|
|
13
13
|
steps:
|
|
14
14
|
- uses: actions/checkout@v2
|
|
15
|
-
- uses:
|
|
16
|
-
with:
|
|
17
|
-
node-version: '18'
|
|
18
|
-
cache: 'npm'
|
|
15
|
+
- uses: jdx/mise-action@v2
|
|
19
16
|
- run: npm ci
|
|
20
|
-
- run: npm
|
|
17
|
+
- run: npm run lint
|
|
18
|
+
- run: npm run test
|
|
19
|
+
- run: npm run test.unit
|
package/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nodejs
|
|
1
|
+
nodejs 22.8.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
# v5.1.26 (Wed Oct 02 2024)
|
|
2
|
+
|
|
3
|
+
#### 🐛 Bug Fix
|
|
4
|
+
|
|
5
|
+
- Basic tp_events integration test [#103](https://github.com/whotracksme/webextension-packages/pull/103) ([@chrmod](https://github.com/chrmod))
|
|
6
|
+
- Preserve "openedFrom" information during redirects that are openend in a new tab. [#97](https://github.com/whotracksme/webextension-packages/pull/97) ([@philipp-classen](https://github.com/philipp-classen))
|
|
7
|
+
- Filter out uncommon URLs where the hostname is an IPv4 address. [#101](https://github.com/whotracksme/webextension-packages/pull/101) ([@philipp-classen](https://github.com/philipp-classen))
|
|
8
|
+
- Unit test: play pre-recorded events [#98](https://github.com/whotracksme/webextension-packages/pull/98) ([@chrmod](https://github.com/chrmod))
|
|
9
|
+
|
|
10
|
+
#### Authors: 2
|
|
11
|
+
|
|
12
|
+
- Krzysztof Modras ([@chrmod](https://github.com/chrmod))
|
|
13
|
+
- Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# v5.1.25 (Mon Sep 23 2024)
|
|
18
|
+
|
|
19
|
+
#### 🐛 Bug Fix
|
|
20
|
+
|
|
21
|
+
- The new tests assume Node 22. Also, upgrade to Ubuntu 24.04. [#100](https://github.com/whotracksme/webextension-packages/pull/100) ([@philipp-classen](https://github.com/philipp-classen))
|
|
22
|
+
- Fix page store persistance [#99](https://github.com/whotracksme/webextension-packages/pull/99) ([@chrmod](https://github.com/chrmod))
|
|
23
|
+
- Fix storage values [#99](https://github.com/whotracksme/webextension-packages/pull/99) ([@chrmod](https://github.com/chrmod))
|
|
24
|
+
- Basic unit test setup [#94](https://github.com/whotracksme/webextension-packages/pull/94) ([@chrmod](https://github.com/chrmod))
|
|
25
|
+
|
|
26
|
+
#### Authors: 2
|
|
27
|
+
|
|
28
|
+
- Krzysztof Modras ([@chrmod](https://github.com/chrmod))
|
|
29
|
+
- Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
1
33
|
# v5.1.24 (Fri Sep 13 2024)
|
|
2
34
|
|
|
3
35
|
#### 🐛 Bug Fix
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whotracksme/reporting",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.26",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"lint": "eslint reporting/ communication/",
|
|
8
8
|
"lint.fix": "eslint --fix reporting/ communication/",
|
|
9
|
-
"test": "npm run
|
|
9
|
+
"test": "npm run test --workspaces --if-present ",
|
|
10
|
+
"test.unit": "npm run test.unit --workspaces --if-present",
|
|
10
11
|
"release": "auto shipit"
|
|
11
12
|
},
|
|
12
13
|
"publishConfig": {
|
package/reporting/karma.conf.cjs
CHANGED
|
@@ -17,6 +17,8 @@ module.exports = function (config) {
|
|
|
17
17
|
client: {
|
|
18
18
|
TEST_FIXTURES_URL: process.env.TEST_FIXTURES_URL, // for test/search-extractor.spec.js
|
|
19
19
|
REPLAY_FIXTURES_URL: process.env.REPLAY_FIXTURES_URL, // for test/pages.spec.js
|
|
20
|
+
VERBOSE_REPLAY: process.env.VERBOSE_REPLAY, // for test/pages.spec.js (better debugging)
|
|
21
|
+
ENABLE_SELF_CHECKS: process.env.ENABLE_SELF_CHECKS, // for test/pages.spec.js (might catch different bugs)
|
|
20
22
|
},
|
|
21
23
|
});
|
|
22
24
|
};
|
package/reporting/package.json
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
"start.firefox": "cp example/manifests/firefox.json example/manifest.json && web-ext run -s ./example -t firefox-desktop",
|
|
8
8
|
"build": "rollup -c",
|
|
9
9
|
"watch": "rollup -c -w",
|
|
10
|
+
"test.unit": "mocha --file ./test/setup.unit.js './test/**/*.test.js'",
|
|
11
|
+
"test.unit.watch": "npm run test.unit -- --node-option=watch",
|
|
10
12
|
"test": "karma start --single-run --browsers ChromeHeadless karma.conf.cjs"
|
|
11
13
|
},
|
|
12
14
|
"author": "Ghostery GmbH",
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
18
20
|
"chai": "^4.3.6",
|
|
19
21
|
"chai-as-promised": "^7.1.1",
|
|
22
|
+
"fake-indexeddb": "^6.0.0",
|
|
20
23
|
"fast-check": "^3.3.0",
|
|
21
24
|
"karma": "^6.4.1",
|
|
22
25
|
"karma-chai": "^0.1.0",
|
|
@@ -25,7 +28,7 @@
|
|
|
25
28
|
"karma-mocha-reporter": "^2.2.5",
|
|
26
29
|
"karma-rollup-preprocessor": "^7.0.8",
|
|
27
30
|
"karma-sinon": "^1.0.5",
|
|
28
|
-
"mocha": "^
|
|
31
|
+
"mocha": "^10.7.3",
|
|
29
32
|
"rollup": "^2.79.1",
|
|
30
33
|
"rollup-plugin-polyfill-node": "^0.8.0",
|
|
31
34
|
"rollup-plugin-sourcemaps": "^0.6.3",
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import logger from './logger';
|
|
13
|
-
import { fastHash } from './utils';
|
|
14
|
-
import PersistedBitarray from './persisted-bitarray';
|
|
15
|
-
import SelfCheck from './self-check';
|
|
12
|
+
import logger from './logger.js';
|
|
13
|
+
import { fastHash } from './utils.js';
|
|
14
|
+
import PersistedBitarray from './persisted-bitarray.js';
|
|
15
|
+
import SelfCheck from './self-check.js';
|
|
16
16
|
|
|
17
17
|
const SECOND = 1000;
|
|
18
18
|
const MINUTE = 60 * SECOND;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import LRU from './LRU';
|
|
12
|
+
import LRU from './LRU.js';
|
|
13
13
|
|
|
14
14
|
/* Fixed length lookup cache. Allows expensive operations to be cached for later lookup. Once
|
|
15
15
|
* the cache limit is exceeded, least recently used values are removed.
|
package/reporting/src/logger.js
CHANGED
package/reporting/src/md5.js
CHANGED
package/reporting/src/network.js
CHANGED
package/reporting/src/pages.js
CHANGED
|
@@ -975,6 +975,10 @@ export default class Pages {
|
|
|
975
975
|
windowId,
|
|
976
976
|
lastUpdatedAt: now,
|
|
977
977
|
};
|
|
978
|
+
if (!entry.pageId || entry.url !== oldTabEntry.url) {
|
|
979
|
+
entry.pageId = ++this._pageIdGenerator;
|
|
980
|
+
}
|
|
981
|
+
|
|
978
982
|
this._initAllOptionalFields(tabId, entry, now);
|
|
979
983
|
this.openTabs.set(tabId, entry);
|
|
980
984
|
return;
|
|
@@ -1035,6 +1039,19 @@ export default class Pages {
|
|
|
1035
1039
|
}
|
|
1036
1040
|
}
|
|
1037
1041
|
|
|
1042
|
+
// Note that 'redirecting' did not originate from the browser API; it is
|
|
1043
|
+
// a meta state that represents the transition of an old to a new page.
|
|
1044
|
+
// If a link opened in a new tab, we need to merge the opener.
|
|
1045
|
+
if (
|
|
1046
|
+
entry.openedFrom?.status === 'redirecting' &&
|
|
1047
|
+
entry.openedFrom.openerTab
|
|
1048
|
+
) {
|
|
1049
|
+
entry.openedFrom = {
|
|
1050
|
+
...entry.openedFrom.openerTab,
|
|
1051
|
+
...entry.openedFrom,
|
|
1052
|
+
};
|
|
1053
|
+
}
|
|
1054
|
+
|
|
1038
1055
|
const previousUrl = entry.openedFrom?.url;
|
|
1039
1056
|
if (isRealPage(previousUrl)) {
|
|
1040
1057
|
entry.previousUrl = previousUrl;
|
|
@@ -1233,6 +1250,7 @@ export default class Pages {
|
|
|
1233
1250
|
const entry = {
|
|
1234
1251
|
status: 'created',
|
|
1235
1252
|
...oldEntry,
|
|
1253
|
+
pageId: ++this._pageIdGenerator,
|
|
1236
1254
|
windowId,
|
|
1237
1255
|
lastUpdatedAt: Date.now(),
|
|
1238
1256
|
openerTab: { ...openerTab },
|
|
@@ -1241,9 +1259,8 @@ export default class Pages {
|
|
|
1241
1259
|
}
|
|
1242
1260
|
|
|
1243
1261
|
chrome_webNavigation_onBeforeNavigate(details) {
|
|
1244
|
-
if (details.frameId !== 0)
|
|
1245
|
-
|
|
1246
|
-
}
|
|
1262
|
+
if (details.frameId !== 0) return; // not top-level frame (of the active page)
|
|
1263
|
+
|
|
1247
1264
|
const { tabId, url } = details;
|
|
1248
1265
|
const oldEntry = this.openTabs.get(tabId);
|
|
1249
1266
|
if (oldEntry && oldEntry.url !== url) {
|
|
@@ -1265,9 +1282,8 @@ export default class Pages {
|
|
|
1265
1282
|
// Safari quirks:
|
|
1266
1283
|
// * The API exists, but "transitionType" is not supported
|
|
1267
1284
|
chrome_webNavigation_onCommitted(details) {
|
|
1268
|
-
if (details.frameId !== 0)
|
|
1269
|
-
|
|
1270
|
-
}
|
|
1285
|
+
if (details.frameId !== 0) return; // not top-level frame (of the active page)
|
|
1286
|
+
|
|
1271
1287
|
const isBackOrForward =
|
|
1272
1288
|
details.transitionQualifiers?.includes('forward_back');
|
|
1273
1289
|
|
|
@@ -1294,12 +1310,17 @@ export default class Pages {
|
|
|
1294
1310
|
}
|
|
1295
1311
|
}
|
|
1296
1312
|
|
|
1297
|
-
// TODO: this needs to be thought through (the timing between chrome.tab and webNavigation might be subtle)
|
|
1298
|
-
//
|
|
1299
1313
|
// Safari quirks:
|
|
1300
1314
|
// * This API is not available
|
|
1315
|
+
//
|
|
1316
|
+
// Firefox quirks (https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webNavigation/TransitionQualifier):
|
|
1317
|
+
// * 'server_redirect' is limited to top-level frames
|
|
1318
|
+
// * 'client_redirect' is not supplied when redirections are created by JavaScript.
|
|
1301
1319
|
chrome_webNavigation_onHistoryStateUpdated(details) {
|
|
1302
|
-
const { tabId } = details;
|
|
1320
|
+
const { tabId, frameId, parentFrameId } = details;
|
|
1321
|
+
if (frameId !== 0) return; // not top-level frame (of the active page)
|
|
1322
|
+
if (parentFrameId !== -1) return; // not main frame
|
|
1323
|
+
|
|
1303
1324
|
const entry = this.openTabs.get(tabId);
|
|
1304
1325
|
if (!entry) {
|
|
1305
1326
|
logger.warn('Navigation event in a non-existing tab detected!');
|
|
@@ -1360,25 +1381,22 @@ export default class Pages {
|
|
|
1360
1381
|
}
|
|
1361
1382
|
}
|
|
1362
1383
|
|
|
1363
|
-
_initVisibility(tabId, entry) {
|
|
1384
|
+
_initVisibility(tabId, entry, now) {
|
|
1364
1385
|
if (!entry.visibility) {
|
|
1365
1386
|
const { visibility, search } = this._checkPageVisibility(entry.url);
|
|
1366
1387
|
entry.visibility = visibility;
|
|
1367
|
-
if (visibility !== 'private') {
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
};
|
|
1375
|
-
}
|
|
1388
|
+
if (visibility !== 'private' && search) {
|
|
1389
|
+
entry.search = {
|
|
1390
|
+
category: search.category,
|
|
1391
|
+
query: search.query,
|
|
1392
|
+
depth: 0,
|
|
1393
|
+
lastUpdatedAt: now,
|
|
1394
|
+
};
|
|
1376
1395
|
}
|
|
1377
1396
|
}
|
|
1378
1397
|
}
|
|
1379
1398
|
|
|
1380
|
-
_initAllOptionalFields(tabId, entry) {
|
|
1381
|
-
const now = Date.now();
|
|
1399
|
+
_initAllOptionalFields(tabId, entry, now) {
|
|
1382
1400
|
const { pageId } = entry;
|
|
1383
1401
|
this._initVisibility(tabId, entry, now);
|
|
1384
1402
|
this._tryAnalyzePageStructure(tabId, entry, now);
|
|
@@ -1791,6 +1809,51 @@ export default class Pages {
|
|
|
1791
1809
|
if (pageIdClashes.length > 0) {
|
|
1792
1810
|
check.warn('Found a pageId clash', Object.fromEntries(pageIdClashes));
|
|
1793
1811
|
}
|
|
1812
|
+
|
|
1813
|
+
// checks for the active tab
|
|
1814
|
+
if (this.activeTab.tabId !== TAB_ID_NONE && this.activeTab.windowId) {
|
|
1815
|
+
const entry = this.openTabs.get(this.activeTab.tabId);
|
|
1816
|
+
if (entry?.windowId !== this.activeTab.windowId) {
|
|
1817
|
+
check.fail('mismatch between the activeTab and the openTabs', {
|
|
1818
|
+
activeTab: {
|
|
1819
|
+
tabId: this.activeTab.tabId,
|
|
1820
|
+
windowId: this.activeTab.windowId,
|
|
1821
|
+
},
|
|
1822
|
+
entry: entry ? { ...entry } : `<tab not found>`,
|
|
1823
|
+
});
|
|
1824
|
+
}
|
|
1825
|
+
}
|
|
1826
|
+
|
|
1827
|
+
// checks for the "search" attribute
|
|
1828
|
+
for (const [tabId, entry] of this.openTabs.entries()) {
|
|
1829
|
+
if (isNil(entry.search)) {
|
|
1830
|
+
continue;
|
|
1831
|
+
}
|
|
1832
|
+
const fail = (msg) => {
|
|
1833
|
+
check.fail(`inconsistency: ${msg}`, { tabId, entry: { ...entry } });
|
|
1834
|
+
};
|
|
1835
|
+
|
|
1836
|
+
if (isRealPage(entry.ref) && isRealPage(entry.url)) {
|
|
1837
|
+
if (
|
|
1838
|
+
entry.search.depth === 1 &&
|
|
1839
|
+
this.urlAnalyzer.parseSearchLinks(entry.ref).category !==
|
|
1840
|
+
entry.search.category &&
|
|
1841
|
+
sameHostname(entry.ref, entry.url)
|
|
1842
|
+
) {
|
|
1843
|
+
fail(
|
|
1844
|
+
'depth=1 search landing must not include internal page navigation',
|
|
1845
|
+
);
|
|
1846
|
+
} else if (
|
|
1847
|
+
entry.search.depth === 2 &&
|
|
1848
|
+
!sameHostname(entry.ref, entry.url)
|
|
1849
|
+
) {
|
|
1850
|
+
fail('depth=2 search landings must stay on the same domains');
|
|
1851
|
+
}
|
|
1852
|
+
}
|
|
1853
|
+
if (![0, 1, 2].includes(entry.search.depth)) {
|
|
1854
|
+
fail('depth must be in { 0, 1, 2 }');
|
|
1855
|
+
}
|
|
1856
|
+
}
|
|
1794
1857
|
})();
|
|
1795
1858
|
await Promise.all([
|
|
1796
1859
|
myChecks,
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import pacemaker from '../utils/pacemaker';
|
|
13
|
-
import logger from '../logger';
|
|
12
|
+
import pacemaker from '../utils/pacemaker.js';
|
|
13
|
+
import logger from '../logger.js';
|
|
14
14
|
|
|
15
15
|
const RETRY_TIMEOUT = 30 * 1000;
|
|
16
16
|
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
/* eslint no-param-reassign: 'off' */
|
|
13
13
|
|
|
14
|
-
import { isIpv4Address } from '../utils/url';
|
|
15
|
-
import prob from './resources/prob';
|
|
14
|
+
import { isIpv4Address } from '../utils/url.js';
|
|
15
|
+
import prob from './resources/prob.js';
|
|
16
16
|
|
|
17
17
|
export class HashProb {
|
|
18
18
|
constructor() {
|
|
@@ -10,36 +10,36 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/* eslint-disable no-param-reassign */
|
|
13
|
-
import Pipeline from '../webrequest-pipeline/pipeline';
|
|
14
|
-
import {
|
|
15
|
-
import pacemaker from '../utils/pacemaker';
|
|
16
|
-
|
|
17
|
-
import { truncatedHash } from '../md5';
|
|
18
|
-
import logger from '../logger';
|
|
19
|
-
|
|
20
|
-
import * as datetime from './time';
|
|
21
|
-
import QSWhitelist2 from './qs-whitelist2';
|
|
22
|
-
import TempSet from './utils/temp-set';
|
|
23
|
-
import { HashProb, shouldCheckToken } from './hash';
|
|
24
|
-
import { VERSION, COOKIE_MODE } from './config';
|
|
25
|
-
import { shuffle } from './utils';
|
|
26
|
-
import buildPageLoadObject from './page-telemetry';
|
|
27
|
-
import getTrackingStatus from './dnt';
|
|
28
|
-
import random from '../random';
|
|
29
|
-
|
|
30
|
-
import BlockRules from './steps/block-rules';
|
|
31
|
-
import CookieContext from './steps/cookie-context';
|
|
32
|
-
import PageLogger from './steps/page-logger';
|
|
33
|
-
import RedirectTagger from './steps/redirect-tagger';
|
|
34
|
-
import TokenChecker from './steps/token-checker/index';
|
|
35
|
-
import TokenExaminer from './steps/token-examiner';
|
|
36
|
-
import TokenTelemetry from './steps/token-telemetry/index';
|
|
37
|
-
import OAuthDetector from './steps/oauth-detector';
|
|
13
|
+
import Pipeline from '../webrequest-pipeline/pipeline.js';
|
|
14
|
+
import { isLocalIP } from '../network.js';
|
|
15
|
+
import pacemaker from '../utils/pacemaker.js';
|
|
16
|
+
|
|
17
|
+
import { truncatedHash } from '../md5.js';
|
|
18
|
+
import logger from '../logger.js';
|
|
19
|
+
|
|
20
|
+
import * as datetime from './time.js';
|
|
21
|
+
import QSWhitelist2 from './qs-whitelist2.js';
|
|
22
|
+
import TempSet from './utils/temp-set.js';
|
|
23
|
+
import { HashProb, shouldCheckToken } from './hash.js';
|
|
24
|
+
import { VERSION, COOKIE_MODE } from './config.js';
|
|
25
|
+
import { shuffle } from './utils.js';
|
|
26
|
+
import buildPageLoadObject from './page-telemetry.js';
|
|
27
|
+
import getTrackingStatus from './dnt.js';
|
|
28
|
+
import random from '../random.js';
|
|
29
|
+
|
|
30
|
+
import BlockRules from './steps/block-rules.js';
|
|
31
|
+
import CookieContext from './steps/cookie-context.js';
|
|
32
|
+
import PageLogger from './steps/page-logger.js';
|
|
33
|
+
import RedirectTagger from './steps/redirect-tagger.js';
|
|
34
|
+
import TokenChecker from './steps/token-checker/index.js';
|
|
35
|
+
import TokenExaminer from './steps/token-examiner.js';
|
|
36
|
+
import TokenTelemetry from './steps/token-telemetry/index.js';
|
|
37
|
+
import OAuthDetector from './steps/oauth-detector.js';
|
|
38
38
|
|
|
39
39
|
import {
|
|
40
40
|
checkValidContext,
|
|
41
41
|
checkSameGeneralDomain,
|
|
42
|
-
} from './steps/check-context';
|
|
42
|
+
} from './steps/check-context.js';
|
|
43
43
|
|
|
44
44
|
const DAY_CHANGE_INTERVAL = 20 * 1000;
|
|
45
45
|
const RECENTLY_MODIFIED_TTL = 30 * 1000;
|
|
@@ -55,7 +55,7 @@ export default class RequestMonitor {
|
|
|
55
55
|
communication,
|
|
56
56
|
getBrowserInfo,
|
|
57
57
|
onTrackerInteraction = (event, state) => {
|
|
58
|
-
logger.
|
|
58
|
+
logger.info('Tracker', event, 'with url:', state.url);
|
|
59
59
|
},
|
|
60
60
|
isRequestAllowed = () => false,
|
|
61
61
|
},
|
|
@@ -524,7 +524,8 @@ export default class RequestMonitor {
|
|
|
524
524
|
// check for tracking status headers for first party
|
|
525
525
|
const trackingStatus = getTrackingStatus(state);
|
|
526
526
|
if (trackingStatus) {
|
|
527
|
-
state.page.
|
|
527
|
+
state.page.tsv = trackingStatus.value;
|
|
528
|
+
state.page.tsvId = trackingStatus.statusId;
|
|
528
529
|
}
|
|
529
530
|
return false;
|
|
530
531
|
}
|
|
@@ -639,7 +640,7 @@ export default class RequestMonitor {
|
|
|
639
640
|
spec: 'break',
|
|
640
641
|
fn: (state) => {
|
|
641
642
|
if (state.isMainFrame && state.ip) {
|
|
642
|
-
if (
|
|
643
|
+
if (isLocalIP(state.ip)) {
|
|
643
644
|
state.page.isPrivateServer = true;
|
|
644
645
|
}
|
|
645
646
|
return false;
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { truncatedHash } from '../md5';
|
|
13
|
-
import { parse } from '../utils/url';
|
|
12
|
+
import { truncatedHash } from '../md5.js';
|
|
13
|
+
import { parse } from '../utils/url.js';
|
|
14
14
|
|
|
15
15
|
function truncatePath(path) {
|
|
16
16
|
// extract the first part of the page path
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
import { differenceInDays, parseISO, getUnixTime, sub } from 'date-fns';
|
|
13
13
|
|
|
14
|
-
import PackedBloomFilter from './utils/bloom-filter-packed';
|
|
15
|
-
import pacemaker from '../utils/pacemaker';
|
|
16
|
-
import logger from '../logger';
|
|
14
|
+
import PackedBloomFilter from './utils/bloom-filter-packed.js';
|
|
15
|
+
import pacemaker from '../utils/pacemaker.js';
|
|
16
|
+
import logger from '../logger.js';
|
|
17
17
|
|
|
18
18
|
const STORAGE_CONFIG_KEY = 'qs_config';
|
|
19
19
|
const STORAGE_BLOOM_FILTER_KEY = 'qs_bloom_filter';
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { truncatedHash } from '../../md5';
|
|
13
|
-
import pacemaker from '../../utils/pacemaker';
|
|
14
|
-
import { parse } from '../../utils/url';
|
|
15
|
-
import { sameGeneralDomain, getGeneralDomain } from '../utils/tlds';
|
|
16
|
-
import logger from '../../logger';
|
|
17
|
-
import ChromeStorageMap from '../utils/chrome-storage-map';
|
|
12
|
+
import { truncatedHash } from '../../md5.js';
|
|
13
|
+
import pacemaker from '../../utils/pacemaker.js';
|
|
14
|
+
import { parse } from '../../utils/url.js';
|
|
15
|
+
import { sameGeneralDomain, getGeneralDomain } from '../utils/tlds.js';
|
|
16
|
+
import logger from '../../logger.js';
|
|
17
|
+
import ChromeStorageMap from '../utils/chrome-storage-map.js';
|
|
18
18
|
|
|
19
19
|
const TIME_AFTER_LINK = 5 * 1000;
|
|
20
20
|
const TIME_CLEANING_CACHE = 3 * 60 * 1000; // 3 minutes
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import { parse } from '../../utils/url';
|
|
13
|
-
import Subject from '../utils/subject';
|
|
14
|
-
import ChromeStorageMap from '../utils/chrome-storage-map';
|
|
12
|
+
import { parse } from '../../utils/url.js';
|
|
13
|
+
import Subject from '../utils/subject.js';
|
|
14
|
+
import ChromeStorageMap from '../utils/chrome-storage-map.js';
|
|
15
15
|
|
|
16
16
|
const DEFAULT_OPTIONS = {
|
|
17
17
|
CLICK_TIMEOUT: 5 * 60 * 1000,
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/* eslint no-param-reassign: 'off' */
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
import { truncateDomain } from '../utils.js';
|
|
15
|
+
import { getStatsForDomain } from '../../webrequest-pipeline/page.js';
|
|
14
16
|
|
|
15
17
|
// maps string (web-ext) to int (FF cpt). Anti-tracking still uses these legacy types.
|
|
16
18
|
const TYPE_LOOKUP = {
|
|
@@ -44,7 +46,8 @@ export default class PageLogger {
|
|
|
44
46
|
}
|
|
45
47
|
|
|
46
48
|
_attachCounters(state) {
|
|
47
|
-
const stats =
|
|
49
|
+
const stats = getStatsForDomain(
|
|
50
|
+
state.page,
|
|
48
51
|
truncateDomain(state.urlParts.domainInfo, 2),
|
|
49
52
|
);
|
|
50
53
|
state.reqLog = stats;
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
|
|
12
12
|
/* eslint no-param-reassign: 'off' */
|
|
13
13
|
|
|
14
|
-
import md5, { truncatedHash } from '../../../md5';
|
|
15
|
-
import { tryDecodeURIComponent } from '../../../utils/url';
|
|
16
|
-
import TokenDomain from './token-domain';
|
|
14
|
+
import md5, { truncatedHash } from '../../../md5.js';
|
|
15
|
+
import { tryDecodeURIComponent } from '../../../utils/url.js';
|
|
16
|
+
import TokenDomain from './token-domain.js';
|
|
17
17
|
|
|
18
18
|
function decodeToken(token) {
|
|
19
19
|
let decodedToken = tryDecodeURIComponent(token);
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import * as datetime from '../../time';
|
|
13
|
-
import logger from '../../../logger';
|
|
14
|
-
import ChromeStorageMap from '../../utils/chrome-storage-map';
|
|
12
|
+
import * as datetime from '../../time.js';
|
|
13
|
+
import logger from '../../../logger.js';
|
|
14
|
+
import ChromeStorageMap from '../../utils/chrome-storage-map.js';
|
|
15
15
|
|
|
16
16
|
const DAYS_EXPIRE = 7;
|
|
17
17
|
const STAGED_TOKEN_EXPIRY = 1000 * 60 * 60 * 24 * 2; // 2 days
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
|
|
12
12
|
/* eslint no-param-reassign: 'off' */
|
|
13
13
|
|
|
14
|
-
import * as datetime from '../time';
|
|
15
|
-
import md5, { truncatedHash } from '../../md5';
|
|
16
|
-
import pacemaker from '../../utils/pacemaker';
|
|
17
|
-
import ChromeStorageMap from '../utils/chrome-storage-map';
|
|
18
|
-
import logger from '../../logger';
|
|
14
|
+
import * as datetime from '../time.js';
|
|
15
|
+
import md5, { truncatedHash } from '../../md5.js';
|
|
16
|
+
import pacemaker from '../../utils/pacemaker.js';
|
|
17
|
+
import ChromeStorageMap from '../utils/chrome-storage-map.js';
|
|
18
|
+
import logger from '../../logger.js';
|
|
19
19
|
|
|
20
20
|
const SYNC_DB_INTERVAL = 20 * 1000;
|
|
21
21
|
|
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import logger from '../../../logger';
|
|
13
|
-
import Subject from '../../utils/subject';
|
|
14
|
-
import ChromeStorageMap from '../../utils/chrome-storage-map';
|
|
12
|
+
import logger from '../../../logger.js';
|
|
13
|
+
import Subject from '../../utils/subject.js';
|
|
14
|
+
import ChromeStorageMap from '../../utils/chrome-storage-map.js';
|
|
15
15
|
|
|
16
16
|
const CACHE_TTL = 2 * 24 * 60 * 60 * 1000; // 2 days
|
|
17
17
|
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
* file, You can obtain one at http://mozilla.org/MPL/2.0
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import md5, { truncatedHash } from '../../../md5';
|
|
13
|
-
import Subject from '../../utils/subject';
|
|
14
|
-
import KeyPipeline, { getSiteTokensMap } from './key-pipeline';
|
|
15
|
-
import TokenPipeline from './token-pipeline';
|
|
12
|
+
import md5, { truncatedHash } from '../../../md5.js';
|
|
13
|
+
import Subject from '../../utils/subject.js';
|
|
14
|
+
import KeyPipeline, { getSiteTokensMap } from './key-pipeline.js';
|
|
15
|
+
import TokenPipeline from './token-pipeline.js';
|
|
16
16
|
|
|
17
17
|
const DEFAULT_CONFIG = {
|
|
18
18
|
// token batchs, max 720 messages/hour
|