@whotracksme/reporting 11.0.0 β†’ 11.0.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ # v11.0.1 (Wed Jul 08 2026)
2
+
3
+ #### πŸ› Bug Fix
4
+
5
+ - Improve detection of non-sharable domains [#216](https://github.com/whotracksme/webextension-packages/pull/216) ([@philipp-classen](https://github.com/philipp-classen))
6
+
7
+ #### 🏠 Internal
8
+
9
+ - (tests only) Fix for rare "Exceeded maximum steps (steps=1000)" [#215](https://github.com/whotracksme/webextension-packages/pull/215) ([@philipp-classen](https://github.com/philipp-classen))
10
+
11
+ #### Authors: 1
12
+
13
+ - Philipp Claßen ([@philipp-classen](https://github.com/philipp-classen))
14
+
15
+ ---
16
+
1
17
  # v11.0.0 (Tue Jun 23 2026)
2
18
 
3
19
  #### πŸ’₯ Breaking Change
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whotracksme/reporting",
3
- "version": "11.0.0",
3
+ "version": "11.0.1",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "scripts": {
@@ -133,6 +133,44 @@ const WELL_KNOWN_HOSTNAME_IS_PRIVATE_NETWORK = {
133
133
  'www.patreon.com': false,
134
134
  };
135
135
 
136
+ // Domain suffixes that do not resolve in the public DNS, are
137
+ // reserved/used for private networks, or are infrastructure-only.
138
+ // Hostnames ending in one of these should be treated as internal
139
+ // and never shared publicly.
140
+ const NON_PUBLIC_DOMAIN_SUFFIXES = [
141
+ // RFC 6762 (Multicast DNS)
142
+ '.local',
143
+
144
+ // ICANN reserved for private use (2024)
145
+ '.internal',
146
+
147
+ // Not formally reserved, but common private-use TLDs
148
+ // (RFC 6762 Appendix G; .corp/.home/.mail frozen by ICANN)
149
+ '.intranet',
150
+ '.private',
151
+ '.corp',
152
+ '.home',
153
+ '.lan',
154
+ '.mail',
155
+
156
+ // RFC 6761 (Special-Use Domain Names)
157
+ '.localhost',
158
+ '.invalid',
159
+ '.test',
160
+
161
+ // RFC 3172 (infrastructure-only namespace, never user-facing content)
162
+ // Covers:
163
+ // - .home.arpa (RFC 8375 Homenet)
164
+ // - .in-addr.arpa / .ip6.arpa (reverse DNS for IPv4 / IPv6)
165
+ '.arpa',
166
+
167
+ // RFC 7686 (Tor)
168
+ '.onion',
169
+
170
+ // RFC 9476 (non-DNS naming systems)
171
+ '.alt',
172
+ ];
173
+
136
174
  // Simple function to detect IP addresses that are non-public.
137
175
  // Local to the machine or link-only (belonging to a local network).
138
176
  //
@@ -197,17 +235,26 @@ export class DnsResolver {
197
235
  return isPrivate;
198
236
  }
199
237
 
238
+ if (
239
+ NON_PUBLIC_DOMAIN_SUFFIXES.some((suffix) => hostname.endsWith(suffix))
240
+ ) {
241
+ return true;
242
+ }
243
+
200
244
  // For the long tail, fall back to checking the IP address. Since we lack a
201
245
  // DNS resolution API, we use mappings built from observing network requests.
202
- //
246
+ const entry = this.dns.get(hostname);
247
+ if (entry) {
248
+ return isLocalIP(entry.ip);
249
+ }
250
+
203
251
  // Note: Since this is a heuristic, there remains the question on how to deal
204
252
  // with hostnames that we have not seen before. That case should be rare
205
253
  // enough, since we work with hostnames that originate from visited websites.
206
254
  // Yet if no such mapping exists, we have to guess. Assuming a hostname is
207
255
  // private by default would be overly conservative; instead, we default to
208
256
  // public unless proven otherwise.
209
- const entry = this.dns.get(hostname);
210
- return entry?.ip && isLocalIP(entry.ip);
257
+ return false;
211
258
  }
212
259
 
213
260
  cacheDnsResolution({ url, hostname, ip, now = Date.now() }) {
@@ -36,7 +36,7 @@ export async function runClockUntilJobQueueIsEmpty(
36
36
  async function advanceTo(ts) {
37
37
  const diff = ts - Date.now();
38
38
  if (diff > 0) {
39
- await clock.tickAsync(diff);
39
+ await clock.tickAsync(Math.ceil(diff));
40
40
  }
41
41
  }
42
42
 
@@ -11,7 +11,7 @@
11
11
 
12
12
  import { expect } from 'chai';
13
13
 
14
- import { isLocalIP } from '../src/network.js';
14
+ import { isLocalIP, DnsResolver } from '../src/network.js';
15
15
 
16
16
  describe('#isLocalIP', function () {
17
17
  describe('it should recognize local IPv6 addresses', async function () {
@@ -70,3 +70,59 @@ describe('#isLocalIP', function () {
70
70
  }
71
71
  });
72
72
  });
73
+
74
+ describe('DnsResolver', function () {
75
+ let uut;
76
+
77
+ beforeEach(function () {
78
+ uut = new DnsResolver();
79
+ });
80
+
81
+ describe('#isPrivateHostname', function () {
82
+ describe('must be always detected as private', function () {
83
+ for (const hostname of [
84
+ '127.0.0.1',
85
+ 'localhost',
86
+ 'homeassistant.local',
87
+ 'raspberrypi.local',
88
+ 'abc.internal',
89
+ 'permanently-removed.invalid',
90
+ 'www.nytimesn7cgmftshazwhfgzm37qxb44r64ytbb2dj3x62d2lljsciiyd.onion',
91
+ 'foo.test',
92
+ 'abc.def.corp',
93
+ 'my.foo.lan',
94
+ ]) {
95
+ it(`- ${hostname}`, function () {
96
+ expect(uut.isPrivateHostname(hostname)).to.be.true;
97
+ });
98
+ }
99
+ });
100
+
101
+ describe('must be always detected as public', function () {
102
+ for (const hostname of [
103
+ 'en.wikipedia.org',
104
+ 'www.google.com',
105
+ 'www.youtube.com',
106
+ ]) {
107
+ it(`- ${hostname}`, function () {
108
+ expect(uut.isPrivateHostname(hostname)).to.be.false;
109
+ });
110
+ }
111
+ });
112
+ });
113
+
114
+ describe('#isPrivateURL', function () {
115
+ it('should classify URLs with non-public suffixes as private', function () {
116
+ expect(uut.isPrivateURL('https://printer.local/status')).to.be.true;
117
+ expect(uut.isPrivateURL('http://db.internal:8080/')).to.be.true;
118
+ });
119
+
120
+ it('should not classify ordinary public URLs as private', function () {
121
+ expect(uut.isPrivateURL('https://en.wikipedia.org/')).to.be.false;
122
+ });
123
+
124
+ it('should classify unparseable URLs as private', function () {
125
+ expect(uut.isPrivateURL('not-a-url')).to.be.true;
126
+ });
127
+ });
128
+ });