diff --git a/.github/workflows/build-enm-bundle.yml b/.github/workflows/build-enm-bundle.yml index 9307f9daff..5a3eebd681 100644 --- a/.github/workflows/build-enm-bundle.yml +++ b/.github/workflows/build-enm-bundle.yml @@ -49,7 +49,7 @@ jobs: - name: Set up Node 20 uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '24.22.1' cache: 'npm' # Two lockfiles feed this build: enm-server (for the runtime deps that # ship inside the bundle) and pc2-node (for the build-time `tar` package diff --git a/.github/workflows/pc2-node-docker.yml b/.github/workflows/pc2-node-docker.yml index 41c82f0e15..023e88a0c6 100644 --- a/.github/workflows/pc2-node-docker.yml +++ b/.github/workflows/pc2-node-docker.yml @@ -31,7 +31,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: '20' + node-version: '24.22.1' - name: Log in to GitHub Container Registry uses: docker/login-action@v3 diff --git a/.github/workflows/smoke-test.yml b/.github/workflows/smoke-test.yml index bc0ec0d2e0..7c9b90cd89 100644 --- a/.github/workflows/smoke-test.yml +++ b/.github/workflows/smoke-test.yml @@ -169,10 +169,10 @@ jobs: # Pin Node to a version we actually support. pc2-node/package.json # declares engines.node >=20.18.0; we pick the latest 20.x to match # what a fresh user install of nvm or Node-via-Homebrew would land on. - - name: Setup Node.js 20.x + - name: Setup Node.js 24.22.1 uses: actions/setup-node@v4 with: - node-version: '20.x' + node-version: '24.22.1' # Cache npm + yarn at home dir level. Speeds up successive runs from # ~6 min install down to ~90 s once the cache is warm. The cache key @@ -973,7 +973,7 @@ jobs: echo "::group::Node.js 20.x via NodeSource" # NodeSource is the documented Debian install path for Node 20. # Pi OS users following our README will hit this same script. - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - apt-get install -y --no-install-recommends nodejs echo "::endgroup::" diff --git a/CHANGELOG.md b/CHANGELOG.md index 52b4001fe6..dc39e33629 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,17 @@ --- +## [v1.4.4] - 2026-10-21 - Node.js October security release + +Node.js fixed a HIGH-severity Brotli decoder out-of-bounds write (CVE-2026-111497) that any Brotli-encoded `fetch` response can reach. The fix is only in Node 24.22.1, 22.23.4 and 26.12.1; Node 20, which most PC2 nodes run, gets none. This release protects nodes on any Node version and moves new installs to Node 24. + +- pc2-node no longer asks servers for Brotli, and refuses a Brotli-encoded response before Node decodes it. This covers every outbound `fetch`, including agent HTTP requests. +- Docker images use `node:24.22.1`. The ARM, WSL and local installers and the supernode bootstrap install Node 24, and CI builds on 24.22.1. +- enm-server's fallback Node download is v24.22.1 instead of the end-of-life v23.10.0. +- An existing node keeps whichever Node it already has; the in-app update does not change it. Upgrading Node to 24.22.1 by hand is still recommended. + +--- + ## [v1.4.3] - 2026-10-21 - Outbound HTTPS certificates are verified pc2-node no longer accepts any certificate on outbound HTTPS. Until now it switched verification off for the whole process at startup, so AI keys, RPC calls, gateway tokens and pins could be intercepted on an untrusted network. diff --git a/deploy/supernode-bootstrap.sh b/deploy/supernode-bootstrap.sh index e9fa3820de..c00d7b4311 100755 --- a/deploy/supernode-bootstrap.sh +++ b/deploy/supernode-bootstrap.sh @@ -168,10 +168,10 @@ apt-get install -y -qq \ openjdk-17-jre-headless \ > /dev/null 2>&1 -# Install Node.js 20.x if not present -if ! command -v node &>/dev/null || [[ $(node -v | cut -d. -f1 | tr -d v) -lt 18 ]]; then - log "Installing Node.js 20.x..." - curl -fsSL https://deb.nodesource.com/setup_20.x | bash - > /dev/null 2>&1 +# Install Node.js 24.x if not present +if ! command -v node &>/dev/null || [[ $(node -v | cut -d. -f1 | tr -d v) -lt 24 ]]; then + log "Installing Node.js 24.x..." + curl -fsSL https://deb.nodesource.com/setup_24.x | bash - > /dev/null 2>&1 apt-get install -y -qq nodejs > /dev/null 2>&1 fi log_ok "Node.js $(node -v)" diff --git a/deploy/web-gateway/Dockerfile b/deploy/web-gateway/Dockerfile index 8d22158d39..85ab9a403d 100644 --- a/deploy/web-gateway/Dockerfile +++ b/deploy/web-gateway/Dockerfile @@ -1,7 +1,7 @@ # PC2 Web Gateway # Multi-stage build for minimal production image -FROM node:20-alpine AS builder +FROM node:24.22.1-alpine AS builder WORKDIR /app @@ -12,7 +12,7 @@ COPY package*.json ./ RUN npm ci --only=production # Production image -FROM node:20-alpine +FROM node:24.22.1-alpine WORKDIR /app diff --git a/docker/pc2/Dockerfile b/docker/pc2/Dockerfile index e02f3b8660..cbaeb2d3e9 100644 --- a/docker/pc2/Dockerfile +++ b/docker/pc2/Dockerfile @@ -4,7 +4,7 @@ # This Dockerfile creates a self-contained PC2 node that users can # deploy on their personal hardware or VPS. -FROM node:20-alpine +FROM node:24.22.1-alpine # Labels LABEL org.opencontainers.image.title="ElastOS PC2" diff --git a/enm-server/Dockerfile b/enm-server/Dockerfile index cce5838a5b..4f9611aadd 100644 --- a/enm-server/Dockerfile +++ b/enm-server/Dockerfile @@ -9,7 +9,7 @@ # - /data/enm — ENM's own state (SQLite, ela-build cache, logs) # # What's in the image: -# - Node 20 (matches PC2's runtime) +# - Node 24 (matches PC2's runtime) # - Toolchain to build ela on first run (git, make, gcc, build-essential, # python3, pkg-config, wget, curl, ca-certificates) # - Diagnostics tools (iproute2, procps, lsof) for HostConflictScanner @@ -19,7 +19,7 @@ # release into /data/enm/cache/go-* on first ela build (no system Go). # - The `ela` binary. Built on demand by the operator via the wizard. -FROM node:20-bookworm-slim +FROM node:24.22.1-bookworm-slim RUN apt-get update && apt-get install -y --no-install-recommends \ git make tar gzip wget curl ca-certificates \ diff --git a/enm-server/src/routes/setup.js b/enm-server/src/routes/setup.js index 85abe51aa9..970b0f7399 100644 --- a/enm-server/src/routes/setup.js +++ b/enm-server/src/routes/setup.js @@ -1414,7 +1414,7 @@ function build(extensionHandle) { httpError = { status: 412, body: errorBody( 'install-class-c: no Node.js runtime detected. POST ' + '/api/enm/setup/install-node-runtime first (M4.3) or ' - + 'install Node.js v23.10.0 on the host.', + + 'install Node.js v24.22.1 on the host.', ) }; throw new SetupAbort(); } diff --git a/enm-server/src/services/EnmConfigSchema.js b/enm-server/src/services/EnmConfigSchema.js index 914f39b553..aef8a1c807 100644 --- a/enm-server/src/services/EnmConfigSchema.js +++ b/enm-server/src/services/EnmConfigSchema.js @@ -392,7 +392,7 @@ const classBSchema = Joi.object({ // declares: // - parentChainId — which EVM sidechain feeds this oracle // - scriptPath — directory holding crosschain_.js -// - nodejsVersion — pinned to v23.10.0 per upstream (M4.3 ships) +// - nodejsVersion — pinned to v24.22.1 (v23 is end of life) // - ports.httpRpc — the oracle's status endpoint port // - parent.{chainRpcUrl, mainchainRpcUrl} — optional overrides; the // adapter falls through to per-chain RPC URLs derived from cfg @@ -415,7 +415,7 @@ const classCSchema = Joi.object({ activeNet: Joi.string().valid('mainnet', 'testnet').default('mainnet'), parentChainId: Joi.string().valid('esc', 'eid', 'pg').required(), scriptPath: Joi.string().allow('').default(''), - nodejsVersion: Joi.string().allow('').default('v23.10.0'), + nodejsVersion: Joi.string().allow('').default('v24.22.1'), ports: classCPortsSchema.required(), parent: classCParentSchema, healing: perChainHealingSchema, diff --git a/enm-server/src/services/NodeJsRuntime.js b/enm-server/src/services/NodeJsRuntime.js index 69867aa961..cfb1ba0ef8 100644 --- a/enm-server/src/services/NodeJsRuntime.js +++ b/enm-server/src/services/NodeJsRuntime.js @@ -3,7 +3,7 @@ * SPDX-License-Identifier: AGPL-3.0 * * NodeJsRuntime — Wave M4.3 (beta.0.3.3) — locate or install the - * Node.js v23.10.0 interpreter the Class C Oracles need. + * Node.js interpreter the Class C Oracles need. * * Plan §12 Q1 recommended bundling (+50MB) but the bundle path is a * release-engineering concern — for the runtime side we ship two @@ -53,7 +53,7 @@ const DOWNLOAD_RETRY_BASE_MS = 2000; // PINNED_VERSION is what installLocal() downloads as a LAST RESORT // when the host doesn't have any usable Node.js. Matches node.sh:520 // for parity but is no longer the floor: any v18+ runtime works. -const PINNED_VERSION = 'v23.10.0'; +const PINNED_VERSION = 'v24.22.1'; // beta.0.4.1 (operator directive) — lowered MIN_MAJOR from 23 → 18. // The oracle scripts use web3 + express + standard fs/net APIs that diff --git a/package-lock.json b/package-lock.json index b213148b6e..ee06d23823 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "elastos-desktop", - "version": "1.4.3", + "version": "1.4.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "elastos-desktop", - "version": "1.4.3", + "version": "1.4.4", "license": "AGPL-3.0-only", "workspaces": [ "src/*", diff --git a/package.json b/package.json index 4676d7bdf3..0a0cb66fd2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elastos-desktop", - "version": "1.4.3", + "version": "1.4.4", "author": "Elacity LLC", "license": "AGPL-3.0-only", "description": "PC2 - your sovereign Web3 cloud desktop that runs on your own hardware.", diff --git a/pc2-node/Dockerfile b/pc2-node/Dockerfile index 8596baf6f8..5b9a98cadb 100644 --- a/pc2-node/Dockerfile +++ b/pc2-node/Dockerfile @@ -66,7 +66,7 @@ RUN chmod +x /binaries/* # --------------------------------------------------------------------------- # Stage 2: Build the Node.js application # --------------------------------------------------------------------------- -FROM node:20-alpine AS builder +FROM node:24.22.1-alpine AS builder # Install build dependencies RUN apk add --no-cache python3 make g++ git @@ -112,7 +112,7 @@ RUN cd pc2-node && npm run build:backend || true # --------------------------------------------------------------------------- # Stage 3: Production image # --------------------------------------------------------------------------- -FROM node:20-alpine +FROM node:24.22.1-alpine # Install runtime dependencies # - bubblewrap: namespace isolation (multi-user security) diff --git a/pc2-node/package-lock.json b/pc2-node/package-lock.json index 9527ba3a19..0d6ecef044 100644 --- a/pc2-node/package-lock.json +++ b/pc2-node/package-lock.json @@ -1,12 +1,12 @@ { "name": "@elastos/pc2-node", - "version": "1.3.0", + "version": "1.4.4", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@elastos/pc2-node", - "version": "1.3.0", + "version": "1.4.4", "license": "AGPL-3.0", "dependencies": { "@anthropic-ai/sdk": "^0.71.2", @@ -842,6 +842,84 @@ "@chainsafe/is-ip": "^2.0.1" } }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.2.tgz", + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.2.tgz", + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.2.tgz", + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.2.tgz", + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@esbuild/darwin-arm64": { "version": "0.27.2", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.2.tgz", @@ -859,147 +937,504 @@ "node": ">=18" } }, - "node_modules/@google/genai": { - "version": "1.38.0", - "resolved": "https://registry.npmjs.org/@google/genai/-/genai-1.38.0.tgz", - "integrity": "sha512-V/4CQVQGovvGHuS73lwJwHKR9x33kCij3zz/ReEQ4A7RJaV0U7m4k1mvYhFk55cGZdF5JLKu2S9BTaFuEs5xTA==", - "license": "Apache-2.0", - "dependencies": { - "google-auth-library": "^10.3.0", - "protobufjs": "^7.5.4", - "ws": "^8.18.0" - }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.2.tgz", + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=20.0.0" - }, - "peerDependencies": { - "@modelcontextprotocol/sdk": "^1.25.2" - }, - "peerDependenciesMeta": { - "@modelcontextprotocol/sdk": { - "optional": true - } + "node": ">=18" } }, - "node_modules/@grammyjs/types": { - "version": "3.23.0", - "resolved": "https://registry.npmjs.org/@grammyjs/types/-/types-3.23.0.tgz", - "integrity": "sha512-D3jQ4UWERPsyR3op/YFudMMIPNTU47vy7L51uO9/73tMELmjO/+LX5N36/Y0CG5IQfIsz43MxiHI5rgsK0/k+g==", - "license": "MIT" - }, - "node_modules/@hapi/boom": { - "version": "9.1.4", - "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", - "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", - "license": "BSD-3-Clause", - "dependencies": { - "@hapi/hoek": "9.x.x" + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.2.tgz", + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@hapi/hoek": { - "version": "9.3.0", - "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", - "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", - "license": "BSD-3-Clause" + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.2.tgz", + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } }, - "node_modules/@helia/bitswap": { - "version": "3.0.13", - "resolved": "https://registry.npmjs.org/@helia/bitswap/-/bitswap-3.0.13.tgz", - "integrity": "sha512-Y14mVQ8caylx3ZXLpzLTt17Ul0Qt4N4B50uebSU3z8x6F0LrW4bSKdC8ppnOw0Oox5UUjXaoxu9KAV+NtcFaig==", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@helia/interface": "^6.0.2", - "@helia/utils": "^2.3.3", - "@libp2p/interface": "^3.1.0", - "@libp2p/logger": "^6.0.5", - "@libp2p/peer-collections": "^7.0.5", - "@libp2p/utils": "^7.0.5", - "@multiformats/multiaddr": "^13.0.1", - "any-signal": "^4.1.1", - "interface-blockstore": "^6.0.1", - "interface-store": "^7.0.0", - "it-drain": "^3.0.10", - "it-length-prefixed": "^10.0.1", - "it-map": "^3.1.4", - "it-pushable": "^3.2.3", - "it-take": "^3.0.9", - "it-to-buffer": "^4.0.10", - "multiformats": "^13.4.1", - "p-defer": "^4.0.1", - "progress-events": "^1.0.1", - "protons-runtime": "^5.6.0", - "race-event": "^1.6.1", - "uint8-varint": "^2.0.4", - "uint8arraylist": "^2.4.8", - "uint8arrays": "^5.1.0" + "node_modules/@esbuild/linux-arm": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.2.tgz", + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@helia/block-brokers": { - "version": "5.0.13", - "resolved": "https://registry.npmjs.org/@helia/block-brokers/-/block-brokers-5.0.13.tgz", - "integrity": "sha512-dFHmPv6P6rbPO7woTxW/dLTD4z32HckuQWN2HjTZiBIqxUp12QjgD/WGU8BDLF3c18OoHhy56ZYjjum9tNU0gw==", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@helia/bitswap": "^3.0.13", - "@helia/interface": "^6.0.2", - "@helia/utils": "^2.3.3", - "@libp2p/interface": "^3.1.0", - "@libp2p/utils": "^7.0.5", - "@multiformats/multiaddr": "^13.0.1", - "@multiformats/multiaddr-matcher": "^3.0.1", - "@multiformats/multiaddr-to-uri": "^12.0.0", - "interface-blockstore": "^6.0.1", - "interface-store": "^7.0.0", - "multiformats": "^13.4.1", - "progress-events": "^1.0.1", - "uint8arraylist": "^2.4.8" + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.2.tgz", + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@helia/delegated-routing-v1-http-api-client": { - "version": "5.1.4", - "resolved": "https://registry.npmjs.org/@helia/delegated-routing-v1-http-api-client/-/delegated-routing-v1-http-api-client-5.1.4.tgz", - "integrity": "sha512-O/gK4KarekZZUztFIV2pCbt4/2OR0/a1qT0CMJf7R1htcuMsIfxhBcxbzyGwiLpY5Lr2JRevCl+3iSZE5vCCmw==", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@libp2p/interface": "^3.0.2", - "@libp2p/logger": "^6.0.5", - "@libp2p/peer-id": "^6.0.3", - "@multiformats/multiaddr": "^13.0.1", - "any-signal": "^4.1.1", - "browser-readablestream-to-it": "^2.0.9", - "ipns": "^10.0.2", - "it-first": "^3.0.8", - "it-map": "^3.1.3", - "it-ndjson": "^1.1.3", - "multiformats": "^13.3.6", - "p-defer": "^4.0.1", - "p-queue": "^9.0.0", - "uint8arrays": "^5.1.0" + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.2.tgz", + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@helia/interface": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/@helia/interface/-/interface-6.0.2.tgz", - "integrity": "sha512-/eBLfqjls6epuYTiBz6zvehizHpTXa7D8UK2+lR9cTj7yQAINiy+nYZQUbOCGb2zsK90h4mZbuOrEHusi763JA==", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@libp2p/interface": "^3.1.0", - "@multiformats/dns": "^1.0.9", - "@multiformats/multiaddr": "^13.0.1", - "interface-blockstore": "^6.0.1", - "interface-datastore": "^9.0.2", - "interface-store": "^7.0.0", - "multiformats": "^13.4.1", - "progress-events": "^1.0.1" + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.2.tgz", + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@helia/routers": { - "version": "4.0.5", - "resolved": "https://registry.npmjs.org/@helia/routers/-/routers-4.0.5.tgz", - "integrity": "sha512-oaXOFsrFWMngi6PVIunr34tCxKTQJx2VETOB4Jq2sKGr7S1aHXrtDePMLYAE95KeP2MpOtSd73WwwuTREoW4hQ==", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@helia/delegated-routing-v1-http-api-client": "^5.1.2", + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.2.tgz", + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.2.tgz", + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.2.tgz", + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.2.tgz", + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.2.tgz", + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.2.tgz", + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.2.tgz", + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.2.tgz", + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.2.tgz", + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.2.tgz", + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.2.tgz", + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.2.tgz", + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.2.tgz", + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.2.tgz", + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@google/genai": { + "version": "1.38.0", + "resolved": "https://registry.npmjs.org/@google/genai/-/genai-1.38.0.tgz", + "integrity": "sha512-V/4CQVQGovvGHuS73lwJwHKR9x33kCij3zz/ReEQ4A7RJaV0U7m4k1mvYhFk55cGZdF5JLKu2S9BTaFuEs5xTA==", + "license": "Apache-2.0", + "dependencies": { + "google-auth-library": "^10.3.0", + "protobufjs": "^7.5.4", + "ws": "^8.18.0" + }, + "engines": { + "node": ">=20.0.0" + }, + "peerDependencies": { + "@modelcontextprotocol/sdk": "^1.25.2" + }, + "peerDependenciesMeta": { + "@modelcontextprotocol/sdk": { + "optional": true + } + } + }, + "node_modules/@grammyjs/types": { + "version": "3.23.0", + "resolved": "https://registry.npmjs.org/@grammyjs/types/-/types-3.23.0.tgz", + "integrity": "sha512-D3jQ4UWERPsyR3op/YFudMMIPNTU47vy7L51uO9/73tMELmjO/+LX5N36/Y0CG5IQfIsz43MxiHI5rgsK0/k+g==", + "license": "MIT" + }, + "node_modules/@hapi/boom": { + "version": "9.1.4", + "resolved": "https://registry.npmjs.org/@hapi/boom/-/boom-9.1.4.tgz", + "integrity": "sha512-Ls1oH8jaN1vNsqcaHVYJrKmgMcKsC1wcp8bujvXrHaAqD2iDYq3HoOwsxwo09Cuda5R5nC0o0IxlrlTuvPuzSw==", + "license": "BSD-3-Clause", + "dependencies": { + "@hapi/hoek": "9.x.x" + } + }, + "node_modules/@hapi/hoek": { + "version": "9.3.0", + "resolved": "https://registry.npmjs.org/@hapi/hoek/-/hoek-9.3.0.tgz", + "integrity": "sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==", + "license": "BSD-3-Clause" + }, + "node_modules/@helia/bitswap": { + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/@helia/bitswap/-/bitswap-3.0.13.tgz", + "integrity": "sha512-Y14mVQ8caylx3ZXLpzLTt17Ul0Qt4N4B50uebSU3z8x6F0LrW4bSKdC8ppnOw0Oox5UUjXaoxu9KAV+NtcFaig==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@helia/interface": "^6.0.2", + "@helia/utils": "^2.3.3", + "@libp2p/interface": "^3.1.0", + "@libp2p/logger": "^6.0.5", + "@libp2p/peer-collections": "^7.0.5", + "@libp2p/utils": "^7.0.5", + "@multiformats/multiaddr": "^13.0.1", + "any-signal": "^4.1.1", + "interface-blockstore": "^6.0.1", + "interface-store": "^7.0.0", + "it-drain": "^3.0.10", + "it-length-prefixed": "^10.0.1", + "it-map": "^3.1.4", + "it-pushable": "^3.2.3", + "it-take": "^3.0.9", + "it-to-buffer": "^4.0.10", + "multiformats": "^13.4.1", + "p-defer": "^4.0.1", + "progress-events": "^1.0.1", + "protons-runtime": "^5.6.0", + "race-event": "^1.6.1", + "uint8-varint": "^2.0.4", + "uint8arraylist": "^2.4.8", + "uint8arrays": "^5.1.0" + } + }, + "node_modules/@helia/block-brokers": { + "version": "5.0.13", + "resolved": "https://registry.npmjs.org/@helia/block-brokers/-/block-brokers-5.0.13.tgz", + "integrity": "sha512-dFHmPv6P6rbPO7woTxW/dLTD4z32HckuQWN2HjTZiBIqxUp12QjgD/WGU8BDLF3c18OoHhy56ZYjjum9tNU0gw==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@helia/bitswap": "^3.0.13", + "@helia/interface": "^6.0.2", + "@helia/utils": "^2.3.3", + "@libp2p/interface": "^3.1.0", + "@libp2p/utils": "^7.0.5", + "@multiformats/multiaddr": "^13.0.1", + "@multiformats/multiaddr-matcher": "^3.0.1", + "@multiformats/multiaddr-to-uri": "^12.0.0", + "interface-blockstore": "^6.0.1", + "interface-store": "^7.0.0", + "multiformats": "^13.4.1", + "progress-events": "^1.0.1", + "uint8arraylist": "^2.4.8" + } + }, + "node_modules/@helia/delegated-routing-v1-http-api-client": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/@helia/delegated-routing-v1-http-api-client/-/delegated-routing-v1-http-api-client-5.1.4.tgz", + "integrity": "sha512-O/gK4KarekZZUztFIV2pCbt4/2OR0/a1qT0CMJf7R1htcuMsIfxhBcxbzyGwiLpY5Lr2JRevCl+3iSZE5vCCmw==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@libp2p/interface": "^3.0.2", + "@libp2p/logger": "^6.0.5", + "@libp2p/peer-id": "^6.0.3", + "@multiformats/multiaddr": "^13.0.1", + "any-signal": "^4.1.1", + "browser-readablestream-to-it": "^2.0.9", + "ipns": "^10.0.2", + "it-first": "^3.0.8", + "it-map": "^3.1.3", + "it-ndjson": "^1.1.3", + "multiformats": "^13.3.6", + "p-defer": "^4.0.1", + "p-queue": "^9.0.0", + "uint8arrays": "^5.1.0" + } + }, + "node_modules/@helia/interface": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/@helia/interface/-/interface-6.0.2.tgz", + "integrity": "sha512-/eBLfqjls6epuYTiBz6zvehizHpTXa7D8UK2+lR9cTj7yQAINiy+nYZQUbOCGb2zsK90h4mZbuOrEHusi763JA==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@libp2p/interface": "^3.1.0", + "@multiformats/dns": "^1.0.9", + "@multiformats/multiaddr": "^13.0.1", + "interface-blockstore": "^6.0.1", + "interface-datastore": "^9.0.2", + "interface-store": "^7.0.0", + "multiformats": "^13.4.1", + "progress-events": "^1.0.1" + } + }, + "node_modules/@helia/routers": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@helia/routers/-/routers-4.0.5.tgz", + "integrity": "sha512-oaXOFsrFWMngi6PVIunr34tCxKTQJx2VETOB4Jq2sKGr7S1aHXrtDePMLYAE95KeP2MpOtSd73WwwuTREoW4hQ==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@helia/delegated-routing-v1-http-api-client": "^5.1.2", "@helia/interface": "^6.0.2", "@libp2p/interface": "^3.1.0", "@libp2p/logger": "^6.2.0", @@ -1027,82 +1462,400 @@ "uint8arrays": "^5.1.0" } }, - "node_modules/@helia/unixfs": { - "version": "6.0.4", - "resolved": "https://registry.npmjs.org/@helia/unixfs/-/unixfs-6.0.4.tgz", - "integrity": "sha512-/6Irfs1z7I2Wl8szLx5dqmUb9dCRYigCsS2EKBd9gKRzHffqcwmYSNNJpzoK/rOg/zMl56dzzhBLcxrdncs96g==", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@helia/interface": "^6.0.2", - "@ipld/dag-pb": "^4.1.5", - "@libp2p/interface": "^3.1.0", - "@libp2p/logger": "^6.0.5", - "@libp2p/utils": "^7.0.5", - "@multiformats/murmur3": "^2.1.8", - "hamt-sharding": "^3.0.6", - "interface-blockstore": "^6.0.1", - "ipfs-unixfs": "^12.0.0", - "ipfs-unixfs-exporter": "^14.0.1", - "ipfs-unixfs-importer": "^16.0.1", - "it-all": "^3.0.9", - "it-first": "^3.0.9", - "it-glob": "^3.0.4", - "it-last": "^3.0.9", - "it-pipe": "^3.0.1", - "it-to-buffer": "^4.0.10", - "multiformats": "^13.4.1", - "progress-events": "^1.0.1", - "sparse-array": "^1.3.2", - "uint8arrays": "^5.1.0" + "node_modules/@helia/unixfs": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/@helia/unixfs/-/unixfs-6.0.4.tgz", + "integrity": "sha512-/6Irfs1z7I2Wl8szLx5dqmUb9dCRYigCsS2EKBd9gKRzHffqcwmYSNNJpzoK/rOg/zMl56dzzhBLcxrdncs96g==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@helia/interface": "^6.0.2", + "@ipld/dag-pb": "^4.1.5", + "@libp2p/interface": "^3.1.0", + "@libp2p/logger": "^6.0.5", + "@libp2p/utils": "^7.0.5", + "@multiformats/murmur3": "^2.1.8", + "hamt-sharding": "^3.0.6", + "interface-blockstore": "^6.0.1", + "ipfs-unixfs": "^12.0.0", + "ipfs-unixfs-exporter": "^14.0.1", + "ipfs-unixfs-importer": "^16.0.1", + "it-all": "^3.0.9", + "it-first": "^3.0.9", + "it-glob": "^3.0.4", + "it-last": "^3.0.9", + "it-pipe": "^3.0.1", + "it-to-buffer": "^4.0.10", + "multiformats": "^13.4.1", + "progress-events": "^1.0.1", + "sparse-array": "^1.3.2", + "uint8arrays": "^5.1.0" + } + }, + "node_modules/@helia/utils": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/@helia/utils/-/utils-2.3.3.tgz", + "integrity": "sha512-1jen0FvJ6K5HtP4BZiT0NwyaDZ+aGjYuIxpVsb7vV8EmBn//57nyd59ElpXTwM8Npid624RuDRsqtgKVowHDOA==", + "license": "Apache-2.0 OR MIT", + "dependencies": { + "@helia/interface": "^6.0.2", + "@ipld/dag-cbor": "^9.2.5", + "@ipld/dag-json": "^10.2.5", + "@ipld/dag-pb": "^4.1.5", + "@libp2p/interface": "^3.1.0", + "@libp2p/keychain": "^6.0.5", + "@libp2p/logger": "^6.0.5", + "@libp2p/utils": "^7.0.5", + "@multiformats/dns": "^1.0.9", + "@multiformats/multiaddr": "^13.0.1", + "any-signal": "^4.1.1", + "blockstore-core": "^6.1.1", + "cborg": "^4.2.15", + "interface-blockstore": "^6.0.1", + "interface-datastore": "^9.0.2", + "interface-store": "^7.0.0", + "it-drain": "^3.0.10", + "it-filter": "^3.1.4", + "it-foreach": "^2.1.5", + "it-merge": "^3.0.12", + "it-to-buffer": "^4.0.10", + "libp2p": "^3.0.6", + "mortice": "^3.3.1", + "multiformats": "^13.4.1", + "p-defer": "^4.0.1", + "progress-events": "^1.0.1", + "race-signal": "^2.0.0", + "uint8arrays": "^5.1.0" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", + "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz", + "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.0.4" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", + "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "cpu": [ + "arm64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz", + "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==", + "cpu": [ + "x64" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz", + "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz", + "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz", + "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz", + "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz", + "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz", + "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz", + "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==", + "cpu": [ + "arm" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.0.5" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz", + "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz", + "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==", + "cpu": [ + "s390x" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.0.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz", + "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.0.4" } }, - "node_modules/@helia/utils": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/@helia/utils/-/utils-2.3.3.tgz", - "integrity": "sha512-1jen0FvJ6K5HtP4BZiT0NwyaDZ+aGjYuIxpVsb7vV8EmBn//57nyd59ElpXTwM8Npid624RuDRsqtgKVowHDOA==", - "license": "Apache-2.0 OR MIT", - "dependencies": { - "@helia/interface": "^6.0.2", - "@ipld/dag-cbor": "^9.2.5", - "@ipld/dag-json": "^10.2.5", - "@ipld/dag-pb": "^4.1.5", - "@libp2p/interface": "^3.1.0", - "@libp2p/keychain": "^6.0.5", - "@libp2p/logger": "^6.0.5", - "@libp2p/utils": "^7.0.5", - "@multiformats/dns": "^1.0.9", - "@multiformats/multiaddr": "^13.0.1", - "any-signal": "^4.1.1", - "blockstore-core": "^6.1.1", - "cborg": "^4.2.15", - "interface-blockstore": "^6.0.1", - "interface-datastore": "^9.0.2", - "interface-store": "^7.0.0", - "it-drain": "^3.0.10", - "it-filter": "^3.1.4", - "it-foreach": "^2.1.5", - "it-merge": "^3.0.12", - "it-to-buffer": "^4.0.10", - "libp2p": "^3.0.6", - "mortice": "^3.3.1", - "multiformats": "^13.4.1", - "p-defer": "^4.0.1", - "progress-events": "^1.0.1", - "race-signal": "^2.0.0", - "uint8arrays": "^5.1.0" + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz", + "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.0.4" } }, - "node_modules/@img/sharp-darwin-arm64": { + "node_modules/@img/sharp-linuxmusl-x64": { "version": "0.33.5", - "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz", - "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz", + "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==", "cpu": [ - "arm64" + "x64" + ], + "libc": [ + "musl" ], "license": "Apache-2.0", "optional": true, "os": [ - "darwin" + "linux" ], "engines": { "node": "^18.17.0 || ^20.3.0 || >=21.0.0" @@ -1111,21 +1864,62 @@ "url": "https://opencollective.com/libvips" }, "optionalDependencies": { - "@img/sharp-libvips-darwin-arm64": "1.0.4" + "@img/sharp-libvips-linuxmusl-x64": "1.0.4" } }, - "node_modules/@img/sharp-libvips-darwin-arm64": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz", - "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==", + "node_modules/@img/sharp-wasm32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz", + "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==", "cpu": [ - "arm64" + "wasm32" ], - "license": "LGPL-3.0-or-later", + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.2.0" + }, + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz", + "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==", + "cpu": [ + "ia32" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", "optional": true, "os": [ - "darwin" + "win32" + ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.33.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz", + "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" ], + "engines": { + "node": "^18.17.0 || ^20.3.0 || >=21.0.0" + }, "funding": { "url": "https://opencollective.com/libvips" } @@ -2449,6 +3243,22 @@ "@napi-rs/canvas-win32-x64-msvc": "0.1.84" } }, + "node_modules/@napi-rs/canvas-android-arm64": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-android-arm64/-/canvas-android-arm64-0.1.84.tgz", + "integrity": "sha512-pdvuqvj3qtwVryqgpAGornJLV6Ezpk39V6wT4JCnRVGy8I3Tk1au8qOalFGrx/r0Ig87hWslysPpHBxVpBMIww==", + "cpu": [ + "arm64" + ], + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@napi-rs/canvas-darwin-arm64": { "version": "0.1.84", "resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-arm64/-/canvas-darwin-arm64-0.1.84.tgz", @@ -2465,6 +3275,149 @@ "node": ">= 10" } }, + "node_modules/@napi-rs/canvas-darwin-x64": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-darwin-x64/-/canvas-darwin-x64-0.1.84.tgz", + "integrity": "sha512-AUW45lJhYWwnA74LaNeqhvqYKK/2hNnBBBl03KRdqeCD4tKneUSrxUqIv8d22CBweOvrAASyKN3W87WO2zEr/A==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-arm-gnueabihf": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm-gnueabihf/-/canvas-linux-arm-gnueabihf-0.1.84.tgz", + "integrity": "sha512-8zs5ZqOrdgs4FioTxSBrkl/wHZB56bJNBqaIsfPL4ZkEQCinOkrFF7xIcXiHiKp93J3wUtbIzeVrhTIaWwqk+A==", + "cpu": [ + "arm" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-arm64-gnu": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-gnu/-/canvas-linux-arm64-gnu-0.1.84.tgz", + "integrity": "sha512-i204vtowOglJUpbAFWU5mqsJgH0lVpNk/Ml4mQtB4Lndd86oF+Otr6Mr5KQnZHqYGhlSIKiU2SYnUbhO28zGQA==", + "cpu": [ + "arm64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-arm64-musl": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-arm64-musl/-/canvas-linux-arm64-musl-0.1.84.tgz", + "integrity": "sha512-VyZq0EEw+OILnWk7G3ZgLLPaz1ERaPP++jLjeyLMbFOF+Tr4zHzWKiKDsEV/cT7btLPZbVoR3VX+T9/QubnURQ==", + "cpu": [ + "arm64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-riscv64-gnu": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-riscv64-gnu/-/canvas-linux-riscv64-gnu-0.1.84.tgz", + "integrity": "sha512-PSMTh8DiThvLRsbtc/a065I/ceZk17EXAATv9uNvHgkgo7wdEfTh2C3aveNkBMGByVO3tvnvD5v/YFtZL07cIg==", + "cpu": [ + "riscv64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-x64-gnu": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-gnu/-/canvas-linux-x64-gnu-0.1.84.tgz", + "integrity": "sha512-N1GY3noO1oqgEo3rYQIwY44kfM11vA0lDbN0orTOHfCSUZTUyiYCY0nZ197QMahZBm1aR/vYgsWpV74MMMDuNA==", + "cpu": [ + "x64" + ], + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-linux-x64-musl": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-linux-x64-musl/-/canvas-linux-x64-musl-0.1.84.tgz", + "integrity": "sha512-vUZmua6ADqTWyHyei81aXIt9wp0yjeNwTH0KdhdeoBb6azHmFR8uKTukZMXfLCC3bnsW0t4lW7K78KNMknmtjg==", + "cpu": [ + "x64" + ], + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@napi-rs/canvas-win32-x64-msvc": { + "version": "0.1.84", + "resolved": "https://registry.npmjs.org/@napi-rs/canvas-win32-x64-msvc/-/canvas-win32-x64-msvc-0.1.84.tgz", + "integrity": "sha512-YSs8ncurc1xzegUMNnQUTYrdrAuaXdPMOa+iYYyAxydOtg0ppV386hyYMsy00Yip1NlTgLCseRG4sHSnjQx6og==", + "cpu": [ + "x64" + ], + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, "node_modules/@noble/ciphers": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/@noble/ciphers/-/ciphers-2.1.1.tgz", diff --git a/pc2-node/package.json b/pc2-node/package.json index 1c84df0983..d748629764 100644 --- a/pc2-node/package.json +++ b/pc2-node/package.json @@ -1,6 +1,6 @@ { "name": "@elastos/pc2-node", - "version": "1.4.3", + "version": "1.4.4", "description": "PC2 Production Node - Self-hosted personal cloud with ElastOS frontend built-in", "main": "dist/index.js", "type": "module", @@ -18,7 +18,7 @@ "clean": "node scripts/clean.js", "test": "npm run build:backend && node scripts/test-system.js", "test:security": "tsx --test tests/security/*.test.js", - "test:unit": "node --test tests/unit", + "test:unit": "node --test tests/unit/*.test.js", "backup": "node scripts/backup.js", "restore": "node scripts/restore.js", "recover-mnemonic": "node scripts/recover-mnemonic.js" diff --git a/pc2-node/src/api/http-client.ts b/pc2-node/src/api/http-client.ts index 8c58d7b8ed..3bf4822c58 100644 --- a/pc2-node/src/api/http-client.ts +++ b/pc2-node/src/api/http-client.ts @@ -8,8 +8,9 @@ import { AuthenticatedRequest, authenticate } from './middleware.js'; import { logger } from '../utils/logger.js'; import { lookup as dnsLookup } from 'dns/promises'; import { isIP } from 'net'; -import { Agent } from 'undici'; +import { Agent, type Dispatcher } from 'undici'; import { TRUSTED_ROOT_CERTIFICATES } from '../utils/tlsTrust.js'; +import { refuseBrotli } from '../utils/refuseBrotli.js'; const router = Router(); @@ -141,7 +142,7 @@ async function resolveAndValidate(hostname: string): Promise { * the attacker flips the A-record between our validation lookup and the * fetch's own lookup. */ -function makePinnedDispatcher(target: ResolvedTarget): Agent { +function makePinnedDispatcher(target: ResolvedTarget): Dispatcher { return new Agent({ connect: { ca: TRUSTED_ROOT_CERTIFICATES, @@ -149,7 +150,7 @@ function makePinnedDispatcher(target: ResolvedTarget): Agent { cb(null, target.ip, target.family); }, }, - }); + }).compose(refuseBrotli); } /** @@ -228,7 +229,7 @@ async function handleHttpRequest(req: AuthenticatedRequest, res: Response): Prom delete requestHeaders['cookie']; const dispatcher = makePinnedDispatcher(target); - const fetchOptions: RequestInit & { dispatcher?: Agent } = { + const fetchOptions: RequestInit & { dispatcher?: Dispatcher } = { method, headers: requestHeaders, signal: controller.signal, @@ -441,7 +442,7 @@ async function handleDownload(req: AuthenticatedRequest, res: Response): Promise }, signal: controller.signal, dispatcher, - } as RequestInit & { dispatcher?: Agent }); + } as RequestInit & { dispatcher?: Dispatcher }); } finally { void dispatcher.close().catch(() => { /* noop */ }); } diff --git a/pc2-node/src/utils/refuseBrotli.ts b/pc2-node/src/utils/refuseBrotli.ts new file mode 100644 index 0000000000..1988efed7d --- /dev/null +++ b/pc2-node/src/utils/refuseBrotli.ts @@ -0,0 +1,69 @@ +/** + * Undici interceptor that keeps Brotli responses away from Node's decoder. + * + * Node 20 and the launcher's Node 22.13.1 carry a Brotli decoder + * out-of-bounds write (CVE-2026-111497) that any `br` response read through + * `fetch` reaches. Requests stop advertising `br`, so well-behaved servers + * reply with gzip or identity; a response that is Brotli-encoded anyway is + * aborted before its body is decoded. + */ + +import type { IncomingHttpHeaders } from 'http'; +import { DecoratorHandler, type Dispatcher } from 'undici'; + +type Headers = Dispatcher.DispatchOptions['headers']; + +// undici's typings omit the handler methods DecoratorHandler implements at runtime. +interface ForwardingHandler extends Dispatcher.DispatchHandler { + onResponseStart( + controller: Dispatcher.DispatchController, + statusCode: number, + headers: IncomingHttpHeaders, + statusMessage?: string, + ): void; +} +const ForwardingHandler = DecoratorHandler as unknown as new (handler: Dispatcher.DispatchHandler) => ForwardingHandler; + +/** Remove `br` from an Accept-Encoding value. */ +export function stripBrotli(value: string): string { + const kept = value.split(',').map((part) => part.trim()).filter((part) => part && !/^br(\s*;|$)/i.test(part)); + return kept.length ? kept.join(', ') : 'identity'; +} + +/** True when a Content-Encoding value includes `br`. */ +export function isBrotliEncoded(value: string | string[] | undefined): boolean { + const joined = Array.isArray(value) ? value.join(',') : value ?? ''; + return joined.split(',').some((part) => part.trim().toLowerCase() === 'br'); +} + +function withoutBrotliAccepted(headers: Headers): Headers { + if (Array.isArray(headers)) { + return headers.map((value, i) => + i % 2 === 1 && String(headers[i - 1]).toLowerCase() === 'accept-encoding' ? stripBrotli(String(value)) : value, + ) as Headers; + } + if (headers && typeof headers === 'object' && !(Symbol.iterator in headers)) { + return Object.fromEntries(Object.entries(headers).map(([name, value]) => + [name, name.toLowerCase() === 'accept-encoding' && typeof value === 'string' ? stripBrotli(value) : value], + )) as Headers; + } + return headers; +} + +class RefuseBrotliHandler extends ForwardingHandler { + onResponseStart( + controller: Dispatcher.DispatchController, + statusCode: number, + headers: IncomingHttpHeaders, + statusMessage?: string, + ): void { + if (isBrotliEncoded(headers['content-encoding'])) { + controller.abort(new Error('Refused Brotli-encoded response')); + return; + } + super.onResponseStart(controller, statusCode, headers, statusMessage); + } +} + +export const refuseBrotli: Dispatcher.DispatcherComposeInterceptor = (dispatch) => (opts, handler) => + dispatch({ ...opts, headers: withoutBrotliAccepted(opts.headers) }, new RefuseBrotliHandler(handler)); diff --git a/pc2-node/src/utils/tlsTrust.ts b/pc2-node/src/utils/tlsTrust.ts index f73358eb81..c6d51b1fc0 100644 --- a/pc2-node/src/utils/tlsTrust.ts +++ b/pc2-node/src/utils/tlsTrust.ts @@ -15,8 +15,9 @@ import https from 'https'; import { createHash, X509Certificate } from 'crypto'; import { rootCertificates } from 'tls'; import { Agent, buildConnector, setGlobalDispatcher } from 'undici'; +import { refuseBrotli } from './refuseBrotli.js'; -const DISTRUSTED_ROOT_SPKI_SHA256: ReadonlySet = new Set([ +export const DISTRUSTED_ROOT_SPKI_SHA256: ReadonlySet = new Set([ '8d417db2dd8bf5e3084d1e3f196d583849d81bdd4c00c70b9d39369e96b8c782', // emSign ECC Root CA - G3 'c619e4780ed8e0abeda24ad732567de4383a7ea941338f6d1a7d1b49ac792fe9', // emSign Root TLS CA - G3 'bd153ed7b0434f6886b17bce8bbe84ed340c7132d702a8f4fa318f756ecbd6f3', // Comodo AAA Certificate Services @@ -40,7 +41,10 @@ export function supernodeServername(host: string): string | undefined { return SUPERNODE_IPS.has(host) ? SUPERNODE_TLS_SERVERNAME : undefined; } -/** Apply the trust policy to every global `fetch` and default-agent `https` request. Call once at boot. */ +/** + * Apply the trust policy to every global `fetch` and default-agent `https` request, + * and keep Brotli responses away from global `fetch`. Call once at boot. + */ export function installOutboundTlsPolicy(): void { https.globalAgent.options.ca = TRUSTED_ROOT_CERTIFICATES; const connect = buildConnector({ ca: TRUSTED_ROOT_CERTIFICATES }); @@ -49,5 +53,5 @@ export function installOutboundTlsPolicy(): void { { ...opts, servername: supernodeServername(opts.hostname) ?? opts.servername }, callback, ), - })); + }).compose(refuseBrotli)); } diff --git a/pc2-node/tests/unit/refuse-brotli.test.js b/pc2-node/tests/unit/refuse-brotli.test.js new file mode 100644 index 0000000000..8f38d09857 --- /dev/null +++ b/pc2-node/tests/unit/refuse-brotli.test.js @@ -0,0 +1,79 @@ +/** + * Brotli responses never reach Node's decoder through fetch. + * + * Imports the built modules so `node --test` (CI, Node 20) can run it. + * `npm run build:backend` must have produced dist/ first. + */ + +import { test, after } from 'node:test'; +import assert from 'node:assert/strict'; +import http from 'node:http'; +import zlib from 'node:zlib'; +import { Agent } from 'undici'; + +const { refuseBrotli, stripBrotli, isBrotliEncoded } = await import('../../dist/utils/refuseBrotli.js'); +const { installOutboundTlsPolicy } = await import('../../dist/utils/tlsTrust.js'); + +const BODY = JSON.stringify({ ok: true }); + +const server = http.createServer((req, res) => { + if (req.url === '/br') { + res.writeHead(200, { 'content-encoding': 'br' }); + res.end(zlib.brotliCompressSync(BODY)); + return; + } + if (req.url === '/gzip') { + res.writeHead(200, { 'content-encoding': 'gzip' }); + res.end(zlib.gzipSync(BODY)); + return; + } + if (req.url === '/accept-encoding') { + res.end(String(req.headers['accept-encoding'])); + return; + } + res.end(BODY); +}); +await new Promise((resolve) => server.listen(0, '127.0.0.1', resolve)); +const base = `http://127.0.0.1:${server.address().port}`; +const dispatcher = new Agent().compose(refuseBrotli); + +after(() => { + server.close(); + return dispatcher.close(); +}); + +test('stripBrotli removes br and keeps the other codings', () => { + assert.equal(stripBrotli('br, gzip, deflate'), 'gzip, deflate'); + assert.equal(stripBrotli('gzip;q=1.0, br;q=0.9'), 'gzip;q=1.0'); + assert.equal(stripBrotli('br'), 'identity'); + assert.equal(stripBrotli('gzip'), 'gzip'); +}); + +test('isBrotliEncoded detects br in single, listed and repeated headers', () => { + assert.equal(isBrotliEncoded('br'), true); + assert.equal(isBrotliEncoded('gzip, br'), true); + assert.equal(isBrotliEncoded(['gzip', 'BR']), true); + assert.equal(isBrotliEncoded('gzip'), false); + assert.equal(isBrotliEncoded('brotli'), false); + assert.equal(isBrotliEncoded(undefined), false); +}); + +test('plain and gzip responses are unchanged', async () => { + assert.equal(await (await fetch(`${base}/plain`, { dispatcher })).text(), BODY); + assert.equal(await (await fetch(`${base}/gzip`, { dispatcher })).text(), BODY); +}); + +test('a Brotli-encoded response is refused', async () => { + await assert.rejects(fetch(`${base}/br`, { dispatcher }), (err) => /Brotli/.test(err.cause?.message ?? '')); +}); + +test('br is not advertised even when the caller asks for it', async () => { + const res = await fetch(`${base}/accept-encoding`, { dispatcher, headers: { 'accept-encoding': 'br, gzip' } }); + assert.equal(await res.text(), 'gzip'); +}); + +test('the installed global dispatcher refuses Brotli too', async () => { + installOutboundTlsPolicy(); + assert.equal(await (await fetch(`${base}/plain`)).text(), BODY); + await assert.rejects(fetch(`${base}/br`), (err) => /Brotli/.test(err.cause?.message ?? '')); +}); diff --git a/pc2-node/tests/unit/tls-trust.test.js b/pc2-node/tests/unit/tls-trust.test.js index 5a887ec4bd..22ec70b95e 100644 --- a/pc2-node/tests/unit/tls-trust.test.js +++ b/pc2-node/tests/unit/tls-trust.test.js @@ -11,6 +11,7 @@ import https from 'node:https'; import { rootCertificates } from 'node:tls'; const { + DISTRUSTED_ROOT_SPKI_SHA256, TRUSTED_ROOT_CERTIFICATES, SUPERNODE_TLS_SERVERNAME, spkiSha256, @@ -18,16 +19,18 @@ const { installOutboundTlsPolicy, } = await import('../../dist/utils/tlsTrust.js'); +// Node 24.22.1+ no longer bundles emSign ECC G3; Node 20/22 still do. const EMSIGN_ECC_G3 = '8d417db2dd8bf5e3084d1e3f196d583849d81bdd4c00c70b9d39369e96b8c782'; -test('emSign ECC Root CA - G3 is removed from the trusted roots', () => { - assert.ok(rootCertificates.some((pem) => spkiSha256(pem) === EMSIGN_ECC_G3), 'fixture: Node still bundles it'); +test('emSign ECC Root CA - G3 is never trusted', () => { + assert.ok(DISTRUSTED_ROOT_SPKI_SHA256.has(EMSIGN_ECC_G3)); assert.ok(!TRUSTED_ROOT_CERTIFICATES.some((pem) => spkiSha256(pem) === EMSIGN_ECC_G3)); }); -test('only distrusted roots are removed', () => { - const removed = rootCertificates.length - TRUSTED_ROOT_CERTIFICATES.length; - assert.ok(removed >= 1 && removed <= 3, `removed ${removed}`); +test('exactly the bundled distrusted roots are removed', () => { + const expected = rootCertificates.filter((pem) => !DISTRUSTED_ROOT_SPKI_SHA256.has(spkiSha256(pem))); + assert.deepEqual(TRUSTED_ROOT_CERTIFICATES, expected); + assert.ok(rootCertificates.length - TRUSTED_ROOT_CERTIFICATES.length <= DISTRUSTED_ROOT_SPKI_SHA256.size); }); test('supernode IPs verify against the ela.city name; other hosts are unchanged', () => { diff --git a/scripts/deploy-enm.sh b/scripts/deploy-enm.sh index ed7760135e..6021b15fb1 100755 --- a/scripts/deploy-enm.sh +++ b/scripts/deploy-enm.sh @@ -90,7 +90,7 @@ verify_node_modules() { die "npm install failed in $backend_dir — ENM cannot start without complete node_modules" fi else - die "node_modules incomplete + npm not on PATH. Install Node 20.x first: curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt install -y nodejs" + die "node_modules incomplete + npm not on PATH. Install Node 24.x first: curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - && sudo apt install -y nodejs" fi } diff --git a/scripts/install-arm.sh b/scripts/install-arm.sh index ca461cd6a6..6d399bf971 100644 --- a/scripts/install-arm.sh +++ b/scripts/install-arm.sh @@ -7,7 +7,7 @@ # curl -sSL https://raw.githubusercontent.com/Elacity/pc2.net/main/scripts/install-arm.sh | bash # # What this does: -# 1. Installs Node.js 20, PM2, build tools +# 1. Installs Node.js 24, PM2, build tools # 2. Clones PC2 and builds it # 3. Installs WireGuard (kernel module or wireguard-go fallback for Jetson) # 4. Configures permissions so PC2 can manage WireGuard tunnels automatically @@ -266,7 +266,7 @@ install_prerequisites() { } # ───────────────────────────────────────────────────────────────────────────── -# Install Node.js 20 +# Install Node.js 24 # ───────────────────────────────────────────────────────────────────────────── install_nodejs() { @@ -275,14 +275,14 @@ install_nodejs() { if command -v node &> /dev/null; then NODE_VERSION=$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1) - if [ "$NODE_VERSION" -ge 20 ]; then + if [ "$NODE_VERSION" -ge 24 ]; then print_ok "Node.js $(node -v) already installed" return fi fi - print_step "Installing Node.js 20..." - curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - + print_step "Installing Node.js 24..." + curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash - sudo apt-get install -y -qq nodejs print_ok "Node.js $(node -v) installed" diff --git a/scripts/install-wsl.sh b/scripts/install-wsl.sh index 0f8e33e831..b978b4bc44 100755 --- a/scripts/install-wsl.sh +++ b/scripts/install-wsl.sh @@ -13,7 +13,7 @@ # What this does: # 1. Validates WSL2 environment # 2. Enables systemd if needed (requires WSL restart) -# 3. Installs Node.js 20, PM2, build tools +# 3. Installs Node.js 24, PM2, build tools # 4. Clones and builds PC2 # 5. Installs transport binaries (WireGuard, AmneziaWG, sing-box) # 6. Configures PM2 persistence across WSL restarts @@ -195,18 +195,18 @@ install_node() { if command -v node &>/dev/null; then NODE_VERSION=$(node -v | cut -d'v' -f2 | cut -d'.' -f1) - if [[ "$NODE_VERSION" -ge 18 ]]; then + if [[ "$NODE_VERSION" -ge 24 ]]; then print_ok "Node.js $(node -v) already installed" return 0 fi fi - print_step "Installing Node.js 20 via nvm..." + print_step "Installing Node.js 24 via nvm..." curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - nvm install 20 - nvm use 20 - nvm alias default 20 + nvm install 24 + nvm use 24 + nvm alias default 24 print_ok "Node.js $(node -v) installed" } diff --git a/scripts/start-local.sh b/scripts/start-local.sh index cd2f3b2d9f..6f92285818 100755 --- a/scripts/start-local.sh +++ b/scripts/start-local.sh @@ -132,11 +132,11 @@ install_node() { # Load nvm immediately [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - # Install Node.js 20 - echo -e "${CYAN}Installing Node.js 20...${NC}" - nvm install 20 - nvm use 20 - nvm alias default 20 + # Install Node.js 24 + echo -e "${CYAN}Installing Node.js 24...${NC}" + nvm install 24 + nvm use 24 + nvm alias default 24 echo -e "${GREEN}✓ Node.js $(node -v) installed${NC}" echo ""