@open-mercato/web-research-browser 0.10.1-develop.7661.1.93ab87b75b → 0.10.1-develop.7664.1.e07aab7f7d
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/web-research-browser",
|
|
3
|
-
"version": "0.10.1-develop.
|
|
3
|
+
"version": "0.10.1-develop.7664.1.e07aab7f7d",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"@open-mercato/web-research": "^0.6.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@open-mercato/web-research-serp": "0.10.1-develop.
|
|
41
|
+
"@open-mercato/web-research-serp": "0.10.1-develop.7664.1.e07aab7f7d",
|
|
42
42
|
"playwright": "^1.40.0",
|
|
43
43
|
"zod": "^4.4.3"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@open-mercato/web-research": "0.10.1-develop.
|
|
46
|
+
"@open-mercato/web-research": "0.10.1-develop.7664.1.e07aab7f7d",
|
|
47
47
|
"@types/jest": "^30.0.0",
|
|
48
48
|
"@types/node": "^26.0.1",
|
|
49
49
|
"esbuild": "^0.28.1",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createServer as createHttpServer, request as sendHttp, type IncomingHttpHeaders, type Server } from 'node:http'
|
|
2
|
-
import { connect as netConnect, createServer as createTcpServer, type AddressInfo, type Socket } from 'node:net'
|
|
2
|
+
import { connect as netConnect, createServer as createTcpServer, isIP, type AddressInfo, type Socket } from 'node:net'
|
|
3
3
|
import type { LookupFn } from '@open-mercato/web-research'
|
|
4
4
|
import { pinnedConnect, startEgressProxy, type EgressDialTarget, type EgressProxy } from '../egressProxy'
|
|
5
5
|
|
|
@@ -8,6 +8,7 @@ const RESET_IP = '93.184.216.35'
|
|
|
8
8
|
const DEAD_IP = '93.184.216.36'
|
|
9
9
|
const MALFORMED_IP = '93.184.216.37'
|
|
10
10
|
const PUBLIC_IPV6 = '2606:2800:220:1:248:1893:25c8:1946'
|
|
11
|
+
const PUBLIC_6TO4 = '2002:808:808::1'
|
|
11
12
|
|
|
12
13
|
type Recorded = { host: string | undefined; url: string | undefined; headers: IncomingHttpHeaders }
|
|
13
14
|
|
|
@@ -101,6 +102,8 @@ async function buildHarness(): Promise<Harness> {
|
|
|
101
102
|
'redirect.test': PUBLIC_IP,
|
|
102
103
|
'private.test': '10.0.0.5',
|
|
103
104
|
'metadata.test': '169.254.169.254',
|
|
105
|
+
'local-translation.test': '64:ff9b:1::a00:1',
|
|
106
|
+
'private-6to4.test': '2002:a00:1::1',
|
|
104
107
|
'reset.test': RESET_IP,
|
|
105
108
|
'dead.test': DEAD_IP,
|
|
106
109
|
'malformed.test': MALFORMED_IP,
|
|
@@ -110,16 +113,16 @@ async function buildHarness(): Promise<Harness> {
|
|
|
110
113
|
if (hostname === 'flip.test') {
|
|
111
114
|
const address = flipAnswers.shift()
|
|
112
115
|
if (!address) throw new Error('no answer')
|
|
113
|
-
return [{ address, family:
|
|
116
|
+
return [{ address, family: isIP(address) }]
|
|
114
117
|
}
|
|
115
118
|
const address = table[hostname]
|
|
116
119
|
if (!address) throw new Error(`ENOTFOUND ${hostname}`)
|
|
117
|
-
return [{ address, family:
|
|
120
|
+
return [{ address, family: isIP(address) }]
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
const dials: EgressDialTarget[] = []
|
|
121
124
|
const portFor = (addresses: readonly string[]): number => {
|
|
122
|
-
if (addresses.length === 1 &&
|
|
125
|
+
if (addresses.length === 1 && [PUBLIC_IP, PUBLIC_IPV6, PUBLIC_6TO4].includes(addresses[0])) return publicPort
|
|
123
126
|
if (addresses.length === 1 && addresses[0] === RESET_IP) return resetPort
|
|
124
127
|
if (addresses.length === 1 && addresses[0] === DEAD_IP) return deadPort
|
|
125
128
|
if (addresses.length === 1 && addresses[0] === MALFORMED_IP) return malformedPort
|
|
@@ -229,6 +232,17 @@ describe('browser egress proxy (#7218)', () => {
|
|
|
229
232
|
expect(harness.dials).toEqual([])
|
|
230
233
|
})
|
|
231
234
|
|
|
235
|
+
it.each([
|
|
236
|
+
'[64:ff9b:1::a00:1]',
|
|
237
|
+
'[2002:a00:1::1]',
|
|
238
|
+
'local-translation.test',
|
|
239
|
+
'private-6to4.test',
|
|
240
|
+
])('refuses CONNECT and HTTP egress to %s before dialling', async (host) => {
|
|
241
|
+
expect(await connectStatus(`${host}:443`)).toBe(403)
|
|
242
|
+
expect((await proxiedRequest(`http://${host}/secret`)).status).toBe(403)
|
|
243
|
+
expect(harness.dials).toEqual([])
|
|
244
|
+
})
|
|
245
|
+
|
|
232
246
|
it.each(['a@b:1', 'public.test', 'public.test:0', 'public.test:70000', '[::1:443', 'public.test:443/x'])(
|
|
233
247
|
'answers the malformed authority %s with 400',
|
|
234
248
|
async (authority) => {
|
|
@@ -254,11 +268,11 @@ describe('browser egress proxy (#7218)', () => {
|
|
|
254
268
|
expect(harness.dials[0]?.port).toBe(80)
|
|
255
269
|
})
|
|
256
270
|
|
|
257
|
-
it('dials
|
|
258
|
-
const { status, socket } = await openConnect(`[${
|
|
271
|
+
it.each([PUBLIC_IPV6, PUBLIC_6TO4])('dials public IPv6 %s through the pinned dial', async (address) => {
|
|
272
|
+
const { status, socket } = await openConnect(`[${address}]:443`)
|
|
259
273
|
socket.destroy()
|
|
260
274
|
expect(status).toBe(200)
|
|
261
|
-
expect(harness.dials).toEqual([{ host:
|
|
275
|
+
expect(harness.dials).toEqual([{ host: address, port: 443, addresses: [address] }])
|
|
262
276
|
})
|
|
263
277
|
|
|
264
278
|
it('re-resolves every connection, so a host that turns private is refused', async () => {
|