@whotracksme/reporting 7.9.0 β 7.11.0
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 +7 -3
- package/.tool-versions +1 -1
- package/CHANGELOG.md +40 -0
- package/communication/src/utils.js +5 -1
- package/communication/test/utils.spec.js +20 -0
- package/package.json +2 -2
- package/reporting/src/http.js +1 -1
- package/reporting/src/network.js +132 -10
- package/reporting/src/request/index.js +22 -14
- package/reporting/test/setup.js +15 -0
- package/reporting/test/setup.unit.js +16 -0
|
@@ -9,12 +9,16 @@ jobs:
|
|
|
9
9
|
name: Trigger release
|
|
10
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
|
+
permissions:
|
|
13
|
+
id-token: write
|
|
14
|
+
contents: write
|
|
12
15
|
steps:
|
|
13
16
|
- uses: actions/checkout@v4
|
|
14
17
|
- uses: actions/setup-node@v4
|
|
15
18
|
with:
|
|
16
|
-
node-version: '
|
|
19
|
+
node-version: '24'
|
|
17
20
|
cache: 'npm'
|
|
21
|
+
registry-url: 'https://registry.npmjs.org'
|
|
18
22
|
|
|
19
23
|
- name: Prepare repository
|
|
20
24
|
run: git fetch --unshallow --tags
|
|
@@ -27,8 +31,8 @@ jobs:
|
|
|
27
31
|
|
|
28
32
|
- name: Create release
|
|
29
33
|
env:
|
|
34
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
30
35
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
31
|
-
|
|
36
|
+
NPM_CONFIG_PROVENANCE: true
|
|
32
37
|
run: |
|
|
33
|
-
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
|
|
34
38
|
npm run release
|
package/.tool-versions
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
nodejs
|
|
1
|
+
nodejs 24.13.0
|
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,43 @@
|
|
|
1
|
+
# v7.11.0 (Fri Feb 06 2026)
|
|
2
|
+
|
|
3
|
+
#### π Enhancement
|
|
4
|
+
|
|
5
|
+
- Fix request listeners setup [#179](https://github.com/whotracksme/webextension-packages/pull/179) ([@philipp-classen](https://github.com/philipp-classen))
|
|
6
|
+
|
|
7
|
+
#### π Bug Fix
|
|
8
|
+
|
|
9
|
+
- CI: fix npm publishing [#181](https://github.com/whotracksme/webextension-packages/pull/181) ([@chrmod](https://github.com/chrmod))
|
|
10
|
+
- Update release workflow for npm registry settings [#180](https://github.com/whotracksme/webextension-packages/pull/180) ([@chrmod](https://github.com/chrmod))
|
|
11
|
+
|
|
12
|
+
#### β οΈ Pushed to `main`
|
|
13
|
+
|
|
14
|
+
- Nodejs update ([@chrmod](https://github.com/chrmod))
|
|
15
|
+
- Update repo name ([@chrmod](https://github.com/chrmod))
|
|
16
|
+
- Enable OIDC (intended to fix the NPM publishing errors) ([@philipp-classen](https://github.com/philipp-classen))
|
|
17
|
+
|
|
18
|
+
#### Authors: 2
|
|
19
|
+
|
|
20
|
+
- Krzysztof Modras ([@chrmod](https://github.com/chrmod))
|
|
21
|
+
- Philipp ClaΓen ([@philipp-classen](https://github.com/philipp-classen))
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# v7.10.0 (Mon Dec 01 2025)
|
|
26
|
+
|
|
27
|
+
#### π Enhancement
|
|
28
|
+
|
|
29
|
+
- More robust detection of private networks for high traffic websites [#178](https://github.com/whotracksme/webextension-packages/pull/178) ([@philipp-classen](https://github.com/philipp-classen))
|
|
30
|
+
|
|
31
|
+
#### π Bug Fix
|
|
32
|
+
|
|
33
|
+
- Handle edge cases like "toString: null" fields [#176](https://github.com/whotracksme/webextension-packages/pull/176) ([@philipp-classen](https://github.com/philipp-classen))
|
|
34
|
+
|
|
35
|
+
#### Authors: 1
|
|
36
|
+
|
|
37
|
+
- Philipp ClaΓen ([@philipp-classen](https://github.com/philipp-classen))
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
1
41
|
# v7.9.0 (Mon Nov 10 2025)
|
|
2
42
|
|
|
3
43
|
#### π Enhancement
|
|
@@ -24,5 +24,9 @@
|
|
|
24
24
|
* to recursively sort the object keys.
|
|
25
25
|
*/
|
|
26
26
|
export function sortObjectKeys(obj) {
|
|
27
|
-
|
|
27
|
+
const sortByKeys = (x, y) => {
|
|
28
|
+
if (x[0] === y[0]) return 0;
|
|
29
|
+
return x[0] < y[0] ? -1 : 1;
|
|
30
|
+
};
|
|
31
|
+
return Object.fromEntries(Object.entries(obj).sort(sortByKeys));
|
|
28
32
|
}
|
|
@@ -40,4 +40,24 @@ describe('#sortObjectKeys', function () {
|
|
|
40
40
|
}),
|
|
41
41
|
);
|
|
42
42
|
});
|
|
43
|
+
|
|
44
|
+
it('should support object with "toString" property', function () {
|
|
45
|
+
// Note: used to throw (found by QuickCheck)
|
|
46
|
+
const obj1 = {
|
|
47
|
+
x: {
|
|
48
|
+
toString: null,
|
|
49
|
+
},
|
|
50
|
+
y: {},
|
|
51
|
+
};
|
|
52
|
+
const obj2 = {
|
|
53
|
+
y: {},
|
|
54
|
+
x: {
|
|
55
|
+
toString: null,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const obj1Json = JSON.stringify(sortObjectKeys(obj1));
|
|
60
|
+
const obj2Json = JSON.stringify(sortObjectKeys(obj2));
|
|
61
|
+
expect(obj1Json).to.eql(obj2Json);
|
|
62
|
+
});
|
|
43
63
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@whotracksme/reporting",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.11.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "",
|
|
6
6
|
"scripts": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"repository": {
|
|
17
17
|
"type": "git",
|
|
18
|
-
"url": "
|
|
18
|
+
"url": "https://github.com/whotracksme/webextension-packages"
|
|
19
19
|
},
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/whotracksme/webextension-packages/issues"
|
package/reporting/src/http.js
CHANGED
|
@@ -190,7 +190,7 @@ function headerOverrideViaWebRequestAPI({ url, headers, requestType }) {
|
|
|
190
190
|
details.method !== 'GET' ||
|
|
191
191
|
!matchesWebRequestApiType(requestType, details.type)
|
|
192
192
|
) {
|
|
193
|
-
// does
|
|
193
|
+
// does not match the request that we intended to trigger
|
|
194
194
|
return {};
|
|
195
195
|
}
|
|
196
196
|
|
package/reporting/src/network.js
CHANGED
|
@@ -16,6 +16,123 @@ const MINUTE = 60 * SECOND;
|
|
|
16
16
|
const HOUR = 60 * MINUTE;
|
|
17
17
|
const DAY = 24 * HOUR;
|
|
18
18
|
|
|
19
|
+
// This list is not intended to be complete. For missing entries, the
|
|
20
|
+
// DnsResolver class will fallback to dynamic mappings learned from
|
|
21
|
+
// observing network requests (hostname -> IP).
|
|
22
|
+
//
|
|
23
|
+
// Why include explicit mappings at all? Because it provides stronger
|
|
24
|
+
// guarantees during the bootstrapping phase. In a web extension context,
|
|
25
|
+
// where no DNS resolution API is available, we otherwise could not guarantee
|
|
26
|
+
// that the critical IP addresses would be always resolvable.
|
|
27
|
+
const WELL_KNOWN_HOSTNAME_IS_PRIVATE_NETWORK = {
|
|
28
|
+
// list of private networks (completeness not required):
|
|
29
|
+
'127.0.0.1': true,
|
|
30
|
+
'localhost': true,
|
|
31
|
+
'fritz.box': true,
|
|
32
|
+
|
|
33
|
+
// (generated: top 100 public domains ranked by traffic):
|
|
34
|
+
'www.google.com': false,
|
|
35
|
+
'www.fiverr.com': false,
|
|
36
|
+
'www.youtube.com': false,
|
|
37
|
+
'www.amazon.com': false,
|
|
38
|
+
'www.reddit.com': false,
|
|
39
|
+
'www.facebook.com': false,
|
|
40
|
+
'mail.google.com': false,
|
|
41
|
+
'docs.google.com': false,
|
|
42
|
+
'x.com': false,
|
|
43
|
+
'accounts.google.com': false,
|
|
44
|
+
'www.instagram.com': false,
|
|
45
|
+
'www.bing.com': false,
|
|
46
|
+
'www.linkedin.com': false,
|
|
47
|
+
'login.microsoftonline.com': false,
|
|
48
|
+
'en.wikipedia.org': false,
|
|
49
|
+
'github.com': false,
|
|
50
|
+
'www.amazon.de': false,
|
|
51
|
+
'www.ebay.com': false,
|
|
52
|
+
'www.twitch.tv': false,
|
|
53
|
+
'www.amazon.co.jp': false,
|
|
54
|
+
'chatgpt.com': false,
|
|
55
|
+
'www.amazon.fr': false,
|
|
56
|
+
'www.msn.com': false,
|
|
57
|
+
'news.yahoo.co.jp': false,
|
|
58
|
+
'old.reddit.com': false,
|
|
59
|
+
'www.amazon.co.uk': false,
|
|
60
|
+
'www.roblox.com': false,
|
|
61
|
+
'drive.google.com': false,
|
|
62
|
+
'rule34.xxx': false,
|
|
63
|
+
'www.pornhub.com': false,
|
|
64
|
+
'www.imdb.com': false,
|
|
65
|
+
'xhamster.com': false,
|
|
66
|
+
'www.xvideos.com': false,
|
|
67
|
+
'e-hentai.org': false,
|
|
68
|
+
'www.paypal.com': false,
|
|
69
|
+
'www.amazon.ca': false,
|
|
70
|
+
'www.espn.com': false,
|
|
71
|
+
'www.bbc.co.uk': false,
|
|
72
|
+
'www.kleinanzeigen.de': false,
|
|
73
|
+
'www.nexusmods.com': false,
|
|
74
|
+
'steamcommunity.com': false,
|
|
75
|
+
'www.bilibili.com': false,
|
|
76
|
+
'www.ebay.co.uk': false,
|
|
77
|
+
'allegro.pl': false,
|
|
78
|
+
'meet.google.com': false,
|
|
79
|
+
'www.aliexpress.com': false,
|
|
80
|
+
'chaturbate.com': false,
|
|
81
|
+
'www.yahoo.co.jp': false,
|
|
82
|
+
'www.nytimes.com': false,
|
|
83
|
+
'www.canva.com': false,
|
|
84
|
+
'www.etsy.com': false,
|
|
85
|
+
'nhentai.net': false,
|
|
86
|
+
'www.ozon.ru': false,
|
|
87
|
+
'www.theguardian.com': false,
|
|
88
|
+
'www.amazon.it': false,
|
|
89
|
+
'hitomi.la': false,
|
|
90
|
+
'www.neopets.com': false,
|
|
91
|
+
'outlook.live.com': false,
|
|
92
|
+
'supjav.com': false,
|
|
93
|
+
'store.steampowered.com': false,
|
|
94
|
+
'www.deviantart.com': false,
|
|
95
|
+
'calendar.google.com': false,
|
|
96
|
+
'www.ecosia.org': false,
|
|
97
|
+
'mail.yahoo.com': false,
|
|
98
|
+
'de.fiverr.com': false,
|
|
99
|
+
'letterboxd.com': false,
|
|
100
|
+
'login.live.com': false,
|
|
101
|
+
'www.fmkorea.com': false,
|
|
102
|
+
'outlook.office.com': false,
|
|
103
|
+
'news.google.com': false,
|
|
104
|
+
'statics.teams.cdn.office.net': false,
|
|
105
|
+
'gall.dcinside.com': false,
|
|
106
|
+
'citizenfreepress.com': false,
|
|
107
|
+
'duckduckgo.com': false,
|
|
108
|
+
'www.amazon.es': false,
|
|
109
|
+
'www.xnxx.com': false,
|
|
110
|
+
'www.imagefap.com': false,
|
|
111
|
+
'www.pixiv.net': false,
|
|
112
|
+
'www.ikea.com': false,
|
|
113
|
+
'www.netflix.com': false,
|
|
114
|
+
'www.ebay.de': false,
|
|
115
|
+
'imgsrc.ru': false,
|
|
116
|
+
'www.dailymail.co.uk': false,
|
|
117
|
+
'www.marktplaats.nl': false,
|
|
118
|
+
'www.foxnews.com': false,
|
|
119
|
+
'auctions.yahoo.co.jp': false,
|
|
120
|
+
'www.booking.com': false,
|
|
121
|
+
'game.granbluefantasy.jp': false,
|
|
122
|
+
'www.erome.com': false,
|
|
123
|
+
'f95zone.to': false,
|
|
124
|
+
'www.cardmarket.com': false,
|
|
125
|
+
'www.chess.com': false,
|
|
126
|
+
'www.vinted.fr': false,
|
|
127
|
+
'www.discogs.com': false,
|
|
128
|
+
'www.ancestry.com': false,
|
|
129
|
+
'app.hubspot.com': false,
|
|
130
|
+
'1337x.to': false,
|
|
131
|
+
'www.upwork.com': false,
|
|
132
|
+
'search.yahoo.co.jp': false,
|
|
133
|
+
'www.patreon.com': false,
|
|
134
|
+
};
|
|
135
|
+
|
|
19
136
|
// Simple function to detect IP addresses that are non-public.
|
|
20
137
|
// Local to the machine or link-only (belonging to a local network).
|
|
21
138
|
//
|
|
@@ -61,14 +178,6 @@ export function isLocalIP(ip) {
|
|
|
61
178
|
return false;
|
|
62
179
|
}
|
|
63
180
|
|
|
64
|
-
// There are two unsolved problems:
|
|
65
|
-
// - What to do if there is no IP resolution cached yet?
|
|
66
|
-
// (Currently, it assumes that the page is private; but most of the
|
|
67
|
-
// time this assumption will be wrong, so it looks overly conservative.
|
|
68
|
-
// Perhaps, extending the API to return three values: yes/no/unknown
|
|
69
|
-
// could help. But it will push the complexity to the caller.)
|
|
70
|
-
// - Perhaps adding all seen URLs from private IPs to the bloom filter
|
|
71
|
-
// could be a solution
|
|
72
181
|
export class DnsResolver {
|
|
73
182
|
constructor() {
|
|
74
183
|
this.dns = new Map();
|
|
@@ -81,9 +190,22 @@ export class DnsResolver {
|
|
|
81
190
|
}
|
|
82
191
|
|
|
83
192
|
isPrivateHostname(hostname) {
|
|
84
|
-
|
|
85
|
-
|
|
193
|
+
// For a limited set of hostnames, we know how to classify them.
|
|
194
|
+
// By design, this will never cover all websites.
|
|
195
|
+
const isPrivate = WELL_KNOWN_HOSTNAME_IS_PRIVATE_NETWORK[hostname];
|
|
196
|
+
if (isPrivate !== undefined) {
|
|
197
|
+
return isPrivate;
|
|
86
198
|
}
|
|
199
|
+
|
|
200
|
+
// For the long tail, fall back to checking the IP address. Since we lack a
|
|
201
|
+
// DNS resolution API, we use mappings built from observing network requests.
|
|
202
|
+
//
|
|
203
|
+
// Note: Since this is a heuristic, there remains the question on how to deal
|
|
204
|
+
// with hostnames that we have not seen before. That case should be rare
|
|
205
|
+
// enough, since we work with hostnames that originate from visited websites.
|
|
206
|
+
// Yet if no such mapping exists, we have to guess. Assuming a hostname is
|
|
207
|
+
// private by default would be overly conservative; instead, we default to
|
|
208
|
+
// public unless proven otherwise.
|
|
87
209
|
const entry = this.dns.get(hostname);
|
|
88
210
|
return entry?.ip && isLocalIP(entry.ip);
|
|
89
211
|
}
|
|
@@ -43,6 +43,12 @@ import PageStore from './page-store.js';
|
|
|
43
43
|
const DAY_CHANGE_INTERVAL = 20 * 1000;
|
|
44
44
|
const RECENTLY_MODIFIED_TTL = 30 * 1000;
|
|
45
45
|
|
|
46
|
+
function hasBlockingWebRequest() {
|
|
47
|
+
return chrome.runtime
|
|
48
|
+
.getManifest()
|
|
49
|
+
.permissions.includes('webRequestBlocking');
|
|
50
|
+
}
|
|
51
|
+
|
|
46
52
|
export default class RequestReporter {
|
|
47
53
|
#userAgent;
|
|
48
54
|
|
|
@@ -83,32 +89,34 @@ export default class RequestReporter {
|
|
|
83
89
|
});
|
|
84
90
|
|
|
85
91
|
this.ready = false;
|
|
86
|
-
const urls = ['http://*/*', 'https://*/*'];
|
|
87
|
-
// TODO: find a way to detect if blocking webRequest is available on Brave and Opera
|
|
88
|
-
const blockingWebRequest = chrome.runtime
|
|
89
|
-
.getManifest()
|
|
90
|
-
.permissions.includes('webRequestBlocking');
|
|
91
92
|
|
|
93
|
+
const safeOptions = [
|
|
94
|
+
'extraHeaders',
|
|
95
|
+
'requestBody',
|
|
96
|
+
'requestHeaders',
|
|
97
|
+
'responseHeaders',
|
|
98
|
+
];
|
|
99
|
+
if (hasBlockingWebRequest()) {
|
|
100
|
+
safeOptions.push('blocking');
|
|
101
|
+
}
|
|
102
|
+
const safeSpecInfoFor = (options) =>
|
|
103
|
+
Object.values(options).filter((x) => safeOptions.includes(x));
|
|
104
|
+
|
|
105
|
+
const urls = ['http://*/*', 'https://*/*'];
|
|
92
106
|
chrome.webRequest.onBeforeRequest.addListener(
|
|
93
107
|
this.onBeforeRequest,
|
|
94
108
|
{ urls },
|
|
95
|
-
|
|
96
|
-
? Object.values(chrome.webRequest.OnBeforeRequestOptions)
|
|
97
|
-
: undefined,
|
|
109
|
+
safeSpecInfoFor(chrome.webRequest.OnBeforeRequestOptions),
|
|
98
110
|
);
|
|
99
111
|
chrome.webRequest.onBeforeSendHeaders.addListener(
|
|
100
112
|
this.onBeforeSendHeaders,
|
|
101
113
|
{ urls },
|
|
102
|
-
|
|
103
|
-
? Object.values(chrome.webRequest.OnBeforeSendHeadersOptions)
|
|
104
|
-
: undefined,
|
|
114
|
+
safeSpecInfoFor(chrome.webRequest.OnBeforeSendHeadersOptions),
|
|
105
115
|
);
|
|
106
116
|
chrome.webRequest.onHeadersReceived.addListener(
|
|
107
117
|
this.onHeadersReceived,
|
|
108
118
|
{ urls },
|
|
109
|
-
|
|
110
|
-
? Object.values(chrome.webRequest.OnHeadersReceivedOptions)
|
|
111
|
-
: undefined,
|
|
119
|
+
safeSpecInfoFor(chrome.webRequest.OnHeadersReceivedOptions),
|
|
112
120
|
);
|
|
113
121
|
chrome.webRequest.onCompleted.addListener(this.onCompleted, { urls });
|
|
114
122
|
chrome.webRequest.onErrorOccurred.addListener(this.onErrorOccurred, {
|
package/reporting/test/setup.js
CHANGED
|
@@ -17,6 +17,21 @@ chai.use(sinonChai);
|
|
|
17
17
|
|
|
18
18
|
setLogLevel('off');
|
|
19
19
|
|
|
20
|
+
// Fill in missing APIs if sinon-chrome did not provide them
|
|
21
|
+
chrome.webRequest.OnBeforeRequestOptions ||= {
|
|
22
|
+
blocking: 'blocking',
|
|
23
|
+
requestBody: 'requestBody',
|
|
24
|
+
};
|
|
25
|
+
chrome.webRequest.OnBeforeSendHeadersOptions ||= {
|
|
26
|
+
blocking: 'blocking',
|
|
27
|
+
requestHeaders: 'requestHeaders',
|
|
28
|
+
};
|
|
29
|
+
chrome.webRequest.OnHeadersReceivedOptions ||= {
|
|
30
|
+
blocking: 'blocking',
|
|
31
|
+
responseHeaders: 'responseHeaders',
|
|
32
|
+
extraHeaders: 'extraHeaders',
|
|
33
|
+
};
|
|
34
|
+
|
|
20
35
|
window.chrome = chrome;
|
|
21
36
|
|
|
22
37
|
// This global object installs a timeout, which will confuse tests that mock
|
|
@@ -13,6 +13,22 @@ import 'fake-indexeddb/auto';
|
|
|
13
13
|
import * as chai from 'chai';
|
|
14
14
|
import sinonChai from 'sinon-chai';
|
|
15
15
|
import chaiAsPromised from 'chai-as-promised';
|
|
16
|
+
import chrome from 'sinon-chrome';
|
|
16
17
|
|
|
17
18
|
chai.use(chaiAsPromised);
|
|
18
19
|
chai.use(sinonChai);
|
|
20
|
+
|
|
21
|
+
// Fill in missing APIs if sinon-chrome did not provide them
|
|
22
|
+
chrome.webRequest.OnBeforeRequestOptions ||= {
|
|
23
|
+
blocking: 'blocking',
|
|
24
|
+
requestBody: 'requestBody',
|
|
25
|
+
};
|
|
26
|
+
chrome.webRequest.OnBeforeSendHeadersOptions ||= {
|
|
27
|
+
blocking: 'blocking',
|
|
28
|
+
requestHeaders: 'requestHeaders',
|
|
29
|
+
};
|
|
30
|
+
chrome.webRequest.OnHeadersReceivedOptions ||= {
|
|
31
|
+
blocking: 'blocking',
|
|
32
|
+
responseHeaders: 'responseHeaders',
|
|
33
|
+
extraHeaders: 'extraHeaders',
|
|
34
|
+
};
|