@xbibzlibrary/whatsbibz 1.4.3 → 1.4.4
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 +13 -0
- package/SECURITY.md +6 -6
- package/lib/BibzWhats/version.js +1 -1
- package/lib/Modded/message_builder.js +2 -1
- package/lib/Utils/browser-utils.js +2 -2
- package/lib/Utils/generics.js +3 -2
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/link-preview.js +17 -13
- package/lib/Utils/messages-media.js +4 -3
- package/lib/Utils/node-security-2026-10.d.ts +18 -0
- package/lib/Utils/node-security-2026-10.js +236 -0
- package/package.json +11 -10
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,19 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and
|
|
|
5
5
|
|
|
6
6
|
Each entry ends with a short Indonesian summary (*Ringkasan*).
|
|
7
7
|
|
|
8
|
+
## [1.4.4] — 2026-10-22
|
|
9
|
+
|
|
10
|
+
### Security
|
|
11
|
+
- **Node.js October 21, 2026 Security Release Mitigations (`CVE-2026-111497`, `CVE-2026-105482`, `CVE-2026-105483`, `CVE-2026-106069`, `CVE-2026-106072`, `CVE-2026-105481`, `CVE-2026-106074`).** Added `lib/Utils/node-security-2026-10.js` (`safeFetch`, `assertSafeUrl`, `withSafeFetchHeaders`, `isNonCanonicalIpv4Host`, `isNodePatchedOct2026`, `getNodeSecurityStatus`, `SAFE_ACCEPT_ENCODING = 'gzip, deflate'`) and wired it across `getHttpStream`, `uploadWithFetch`, `getWAUploadToServer`, `fetchLatestWaWebVersion`, `fetchLatestBaileysVersion`, `getUrlInfo` (`link-preview.js`), and `Toolkit.fetchBuffer`:
|
|
12
|
+
- Disables automatic Brotli (`br`) decompression negotiation on outgoing HTTP/HTTPS requests to prevent remote code execution / memory disclosure via **`CVE-2026-111497`** on unpatched Node.js runtimes.
|
|
13
|
+
- Blocks NUL bytes (`\x00` / `%00`) in URLs and hostnames to prevent **`CVE-2026-105482`** (`dns.resolve` truncation).
|
|
14
|
+
- Blocks fullwidth Unicode IP digits/dots (`\uFF10`–`\uFF19`) to prevent **`CVE-2026-105483`** TLS hostname verification bypass.
|
|
15
|
+
- Blocks non-canonical IPv4 hostnames (octal `0177.0.0.1`, hex `0x7f.0.0.1`, integer `2130706433`, shorthand `127.1`) to prevent **`CVE-2026-106069` & `CVE-2026-106072`** TLS certificate hostname bypass.
|
|
16
|
+
- **Zero `npm audit` Vulnerabilities & Dependency Patching.** Upgraded `overrides.vite` to `^7.3.7` and `overrides.launch-editor` to `^2.14.2` (fixing `GHSA-587h-7wmj-h5pm`, `GHSA-698v-4r3x-3vcv`, `GHSA-r825-w8mm-5pxw`, `GHSA-rq7h-c2jc-7f22`, `GHSA-9jrq-w75r-8gcw`), and updated runtime dependencies (`ws@^8.22.0`, `protobufjs@^7.6.6`, `pino@^9.14.0`, `lru-cache@^11.5.3`, `music-metadata@^11.16.1`, `p-queue@^9.3.5`, `@cacheable/node-cache@^1.7.6`, `@types/ws@^8.18.2`) so `npm audit` reports **0 vulnerabilities**.
|
|
17
|
+
- **CI / Release Runner Hardening.** Enabled `check-latest: true` on `actions/setup-node@v7` across `.github/workflows/{ci,release,docs}.yml` and added Node 26 to the CI matrix so GitHub Actions runners pull patched Node.js builds (`22.23.4`, `24.22.1`, `26.12.1`) rather than cached runner images.
|
|
18
|
+
|
|
19
|
+
*Ringkasan: patch keamanan menyeluruh untuk menutup celah 10 CVE Node.js rilis 21 Oktober 2026 (termasuk `CVE-2026-111497` Brotli RCE pada `fetch()`, `CVE-2026-105482` pemotongan DNS karakter NUL, `CVE-2026-105483` & `CVE-2026-106069` bypass hostname TLS IPv4 fullwidth/non-kanonik), perbaikan `npm audit` hingga **0 kerentanan (`0 vulnerabilities`)**, serta pembaruan dependensi ke versi terbaru.*
|
|
20
|
+
|
|
8
21
|
## [1.4.3] — 2026-10-21
|
|
9
22
|
|
|
10
23
|
### Changed
|
package/SECURITY.md
CHANGED
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
| Version | Supported |
|
|
8
8
|
|---|---|
|
|
9
|
-
| 1.
|
|
10
|
-
| < 1.
|
|
9
|
+
| 1.4.x (>= 1.4.4) | Yes |
|
|
10
|
+
| < 1.4.4 | No — please upgrade to 1.4.4+ |
|
|
11
11
|
|
|
12
|
-
Only the latest
|
|
12
|
+
Only the latest release receives security fixes. For the Node.js October 21, 2026 security release (`CVE-2026-111497` Brotli RCE, `CVE-2026-105482`, `CVE-2026-105483`, `CVE-2026-106069`, `CVE-2026-106072`), `@xbibzlibrary/whatsbibz@1.4.4+` includes built-in library-level mitigations (`safeFetch`, `assertSafeUrl`, `withSafeFetchHeaders`, `SAFE_ACCEPT_ENCODING = 'gzip, deflate'`) and we strongly recommend running on patched Node.js runtimes (`>= 22.23.4`, `>= 24.22.1`, or `>= 26.12.1`).
|
|
13
13
|
|
|
14
14
|
## Reporting a vulnerability
|
|
15
15
|
|
|
@@ -52,10 +52,10 @@ Out of scope: WhatsApp server behaviour, account bans, rate limits, and issues i
|
|
|
52
52
|
|
|
53
53
|
| Versi | Didukung |
|
|
54
54
|
|---|---|
|
|
55
|
-
| 1.
|
|
56
|
-
| < 1.
|
|
55
|
+
| 1.4.x (>= 1.4.4) | Ya |
|
|
56
|
+
| < 1.4.4 | Tidak — silakan perbarui ke 1.4.4+ |
|
|
57
57
|
|
|
58
|
-
Hanya rilis
|
|
58
|
+
Hanya rilis terbaru yang menerima perbaikan keamanan. Untuk rilis keamanan Node.js 21 Oktober 2026 (`CVE-2026-111497` Brotli RCE, `CVE-2026-105482`, `CVE-2026-105483`, `CVE-2026-106069`, `CVE-2026-106072`), `@xbibzlibrary/whatsbibz@1.4.4+` telah menyertakan mitigasi berlapis di tingkat library (`safeFetch`, `assertSafeUrl`, `withSafeFetchHeaders`, `SAFE_ACCEPT_ENCODING = 'gzip, deflate'`) dan sangat disarankan dijalankan pada runtime Node.js yang telah di-patch (`>= 22.23.4`, `>= 24.22.1`, atau `>= 26.12.1`).
|
|
59
59
|
|
|
60
60
|
## Melaporkan kerentanan
|
|
61
61
|
|
package/lib/BibzWhats/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export const BIBZWHATS_NAME = 'WhatsBibz';
|
|
2
2
|
/** nama paket di npm */
|
|
3
3
|
export const BIBZWHATS_PACKAGE = '@xbibzlibrary/whatsbibz';
|
|
4
|
-
export const BIBZWHATS_VERSION = '1.4.
|
|
4
|
+
export const BIBZWHATS_VERSION = '1.4.4';
|
|
5
5
|
export const BIBZWHATS_UPSTREAM = 'WhiskeySockets/Baileys v7 + patch upstream s/d 2026-10 (rc14/master & PR #2769/#2776/#2778/#2789/#2804/#2807/#2808/#2834-#2840/#2856/#2864-#2866); identitas platform diukur ke server 2026-10-21';
|
|
6
6
|
/** versi WA Web bawaan (fallback) — diperbarui 2026-10-21 dari web.whatsapp.com */
|
|
7
7
|
export const BIBZWHATS_WA_WEB_VERSION = [2, 3000, 1051141409];
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
const VERSION = '4.6';
|
|
9
9
|
|
|
10
10
|
import { generateWAMessageFromContent, prepareWAMessageMedia } from '../index.js';
|
|
11
|
+
import { safeFetch } from '../Utils/node-security-2026-10.js';
|
|
11
12
|
import crypto from 'crypto';
|
|
12
13
|
import { PassThrough, Readable } from 'stream';
|
|
13
14
|
|
|
@@ -239,7 +240,7 @@ class Toolkit {
|
|
|
239
240
|
|
|
240
241
|
static async fetchBuffer(url, options = {}, { silent = true } = {}) {
|
|
241
242
|
try {
|
|
242
|
-
let response = await
|
|
243
|
+
let response = await safeFetch(url, options);
|
|
243
244
|
if (!response.ok) throw Error(`HTTP ${response.status}`);
|
|
244
245
|
return Buffer.from(await response.arrayBuffer());
|
|
245
246
|
} catch (error) {
|
|
@@ -29,9 +29,9 @@ export const Browsers = {
|
|
|
29
29
|
linux: browser => ['Linux', browser, '6.12.44'],
|
|
30
30
|
baileys: browser => ['Baileys', browser, '6.5.0'],
|
|
31
31
|
/** identitas companion BibzWhats (tampil di daftar perangkat tertaut) */
|
|
32
|
-
whatsbibz: browser => ['WhatsBibz', browser, '1.4.
|
|
32
|
+
whatsbibz: browser => ['WhatsBibz', browser, '1.4.4'],
|
|
33
33
|
/** alias lama */
|
|
34
|
-
bibzwhats: browser => ['WhatsBibz', browser, '1.4.
|
|
34
|
+
bibzwhats: browser => ['WhatsBibz', browser, '1.4.4'],
|
|
35
35
|
windows: browser => ['Windows', browser, '10.0.22631'],
|
|
36
36
|
/** eksperimental (upstream #2201): companion Android — bisa menerima view-once */
|
|
37
37
|
android: browser => [browser, 'Android', ''],
|
package/lib/Utils/generics.js
CHANGED
|
@@ -6,6 +6,7 @@ const bibzWhatsVersion = [2, 3000, 1051141409];
|
|
|
6
6
|
import { DisconnectReason } from '../Types/index.js';
|
|
7
7
|
import { getAllBinaryNodeChildren, jidDecode } from '../WABinary/index.js';
|
|
8
8
|
import { sha256 } from './crypto.js';
|
|
9
|
+
import { safeFetch } from './node-security-2026-10.js';
|
|
9
10
|
export const BufferJSON = {
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
replacer: (k, value) => {
|
|
@@ -181,7 +182,7 @@ export const bindWaitForConnectionUpdate = (ev) => bindWaitForEvent(ev, 'connect
|
|
|
181
182
|
export const fetchLatestBaileysVersion = async (options = {}) => {
|
|
182
183
|
const URL = 'https://raw.githubusercontent.com/WhiskeySockets/Baileys/master/src/Defaults/index.ts';
|
|
183
184
|
try {
|
|
184
|
-
const response = await
|
|
185
|
+
const response = await safeFetch(URL, {
|
|
185
186
|
dispatcher: options.dispatcher,
|
|
186
187
|
method: 'GET',
|
|
187
188
|
headers: options.headers
|
|
@@ -225,7 +226,7 @@ export const fetchLatestWaWebVersion = async (options = {}) => {
|
|
|
225
226
|
'user-agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36'
|
|
226
227
|
};
|
|
227
228
|
const headers = { ...defaultHeaders, ...options.headers };
|
|
228
|
-
const response = await
|
|
229
|
+
const response = await safeFetch('https://web.whatsapp.com/sw.js', {
|
|
229
230
|
...options,
|
|
230
231
|
method: 'GET',
|
|
231
232
|
headers
|
package/lib/Utils/index.d.ts
CHANGED
package/lib/Utils/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/** @module @xbibzlibrary/whatsbibz/lib/Utils/link-preview */
|
|
2
2
|
import { prepareWAMessageMedia } from './messages.js';
|
|
3
3
|
import { extractImageThumb, getHttpStream } from './messages-media.js';
|
|
4
|
+
import { assertSafeUrl, withSafeFetchHeaders } from './node-security-2026-10.js';
|
|
4
5
|
const THUMBNAIL_WIDTH_PX = 192;
|
|
5
6
|
/** Fetches an image and generates a thumbnail for it */
|
|
6
7
|
const getCompressedJpegThumbnail = async (url, { thumbnailWidth, fetchOpts }) => {
|
|
@@ -19,34 +20,37 @@ export const getUrlInfo = async (text, opts = {
|
|
|
19
20
|
fetchOpts: { timeout: 3000 }
|
|
20
21
|
}) => {
|
|
21
22
|
try {
|
|
22
|
-
|
|
23
|
-
const retries = 0;
|
|
23
|
+
let retries = 0;
|
|
24
24
|
const maxRetry = 5;
|
|
25
25
|
const { getLinkPreview } = await import('link-preview-js');
|
|
26
26
|
let previewLink = text;
|
|
27
27
|
if (!text.startsWith('https://') && !text.startsWith('http://')) {
|
|
28
28
|
previewLink = 'https://' + previewLink;
|
|
29
29
|
}
|
|
30
|
+
assertSafeUrl(previewLink);
|
|
30
31
|
const info = await getLinkPreview(previewLink, {
|
|
31
32
|
...opts.fetchOpts,
|
|
32
33
|
followRedirects: 'follow',
|
|
33
34
|
handleRedirects: (baseURL, forwardedURL) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
try {
|
|
36
|
+
const urlObj = assertSafeUrl(baseURL);
|
|
37
|
+
const forwardedURLObj = assertSafeUrl(forwardedURL);
|
|
38
|
+
if (retries >= maxRetry) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (forwardedURLObj.hostname === urlObj.hostname ||
|
|
42
|
+
forwardedURLObj.hostname === 'www.' + urlObj.hostname ||
|
|
43
|
+
'www.' + forwardedURLObj.hostname === urlObj.hostname) {
|
|
44
|
+
retries += 1;
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
37
47
|
return false;
|
|
38
48
|
}
|
|
39
|
-
|
|
40
|
-
forwardedURLObj.hostname === 'www.' + urlObj.hostname ||
|
|
41
|
-
'www.' + forwardedURLObj.hostname === urlObj.hostname) {
|
|
42
|
-
retries + 1;
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
else {
|
|
49
|
+
catch {
|
|
46
50
|
return false;
|
|
47
51
|
}
|
|
48
52
|
},
|
|
49
|
-
headers: opts.fetchOpts?.headers
|
|
53
|
+
headers: withSafeFetchHeaders(opts.fetchOpts?.headers)
|
|
50
54
|
});
|
|
51
55
|
if (info && 'title' in info && info.title) {
|
|
52
56
|
const [image] = info.images;
|
|
@@ -13,6 +13,7 @@ import { DEFAULT_ORIGIN, MEDIA_HKDF_KEY_MAPPING, MEDIA_PATH_MAP } from '../Defau
|
|
|
13
13
|
import { getBinaryNodeChild, getBinaryNodeChildBuffer, jidNormalizedUser } from '../WABinary/index.js';
|
|
14
14
|
import { aesDecryptGCM, aesEncryptGCM, hkdf } from './crypto.js';
|
|
15
15
|
import { generateMessageIDV2 } from './generics.js';
|
|
16
|
+
import { safeFetch } from './node-security-2026-10.js';
|
|
16
17
|
const getTmpFilesDirectory = () => tmpdir();
|
|
17
18
|
const getImageProcessingLibrary = async () => {
|
|
18
19
|
//@ts-ignore
|
|
@@ -296,7 +297,7 @@ export async function generateThumbnail(file, mediaType, options) {
|
|
|
296
297
|
};
|
|
297
298
|
}
|
|
298
299
|
export const getHttpStream = async (url, options = {}) => {
|
|
299
|
-
const response = await
|
|
300
|
+
const response = await safeFetch(url.toString(), {
|
|
300
301
|
dispatcher: options.dispatcher,
|
|
301
302
|
method: 'GET',
|
|
302
303
|
headers: options.headers
|
|
@@ -520,7 +521,7 @@ const uploadWithFetch = async ({ url, filePath, headers, timeoutMs, agent }) =>
|
|
|
520
521
|
const webStream = Readable.toWeb(nodeStream);
|
|
521
522
|
// Native fetch hanya menerima dispatcher gaya Undici, bukan https.Agent biasa (upstream #2557)
|
|
522
523
|
const dispatcher = typeof agent?.dispatch === 'function' ? agent : undefined;
|
|
523
|
-
const response = await
|
|
524
|
+
const response = await safeFetch(url, {
|
|
524
525
|
...(dispatcher ? { dispatcher } : {}),
|
|
525
526
|
method: 'POST',
|
|
526
527
|
body: webStream,
|
|
@@ -584,7 +585,7 @@ export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger, opt
|
|
|
584
585
|
const url = `https://${hostname}${mediaPath}/${fileEncSha256B64}?auth=${auth}&token=${fileEncSha256B64}`;
|
|
585
586
|
let result;
|
|
586
587
|
try {
|
|
587
|
-
const response = await
|
|
588
|
+
const response = await safeFetch(url, {
|
|
588
589
|
...(dispatcher ? { dispatcher } : {}),
|
|
589
590
|
method: 'POST',
|
|
590
591
|
body: reqBuffer,
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** @module @xbibzlibrary/whatsbibz/lib/Utils/node-security-2026-10 */
|
|
2
|
+
export declare const SAFE_ACCEPT_ENCODING = "gzip, deflate";
|
|
3
|
+
export declare const NODE_OCT_2026_CVES: readonly string[];
|
|
4
|
+
export declare const PATCHED_NODE_MIN_VERSIONS: Readonly<Record<number, readonly [number, number, number]>>;
|
|
5
|
+
export declare const parseNodeVersion: (versionStr?: string) => [number, number, number] | null;
|
|
6
|
+
export declare const isNodePatchedOct2026: (versionStr?: string) => boolean;
|
|
7
|
+
export declare const getNodeSecurityStatus: (versionStr?: string) => {
|
|
8
|
+
currentVersion: string;
|
|
9
|
+
patched: boolean;
|
|
10
|
+
eolLine: boolean;
|
|
11
|
+
recommendedVersion: string;
|
|
12
|
+
mitigatedByBibzWhats: boolean;
|
|
13
|
+
cves: readonly string[];
|
|
14
|
+
};
|
|
15
|
+
export declare const isNonCanonicalIpv4Host: (hostname?: string) => boolean;
|
|
16
|
+
export declare const assertSafeUrl: (inputUrl: string | URL) => URL;
|
|
17
|
+
export declare const withSafeFetchHeaders: (headers?: Record<string, string> | [string, string][] | Headers) => Record<string, string>;
|
|
18
|
+
export declare const safeFetch: (inputUrl: string | URL, init?: RequestInit & { dispatcher?: unknown }) => Promise<Response>;
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module @xbibzlibrary/whatsbibz/lib/Utils/node-security-2026-10
|
|
3
|
+
* Runtime mitigations & URL/HTTP hardening for the Node.js October 21, 2026
|
|
4
|
+
* Security Release (CVE-2026-111497 Brotli RCE, CVE-2026-105482 DNS NUL truncation,
|
|
5
|
+
* CVE-2026-105483 Fullwidth-IP TLS bypass, CVE-2026-106069 & CVE-2026-106072
|
|
6
|
+
* Non-canonical IPv4 TLS hostname bypass, CVE-2026-105481, CVE-2026-106074).
|
|
7
|
+
*/
|
|
8
|
+
import { Boom } from '@hapi/boom';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Safe Accept-Encoding header value that disables automatic Brotli (`br`)
|
|
12
|
+
* decompression on outgoing HTTP/HTTPS requests to mitigate CVE-2026-111497
|
|
13
|
+
* on unpatched Node.js runtimes.
|
|
14
|
+
*/
|
|
15
|
+
export const SAFE_ACCEPT_ENCODING = 'gzip, deflate';
|
|
16
|
+
|
|
17
|
+
export const NODE_OCT_2026_CVES = Object.freeze([
|
|
18
|
+
'CVE-2026-111497',
|
|
19
|
+
'CVE-2026-105482',
|
|
20
|
+
'CVE-2026-105483',
|
|
21
|
+
'CVE-2026-106069',
|
|
22
|
+
'CVE-2026-105481',
|
|
23
|
+
'CVE-2026-106072',
|
|
24
|
+
'CVE-2026-106074',
|
|
25
|
+
'CVE-2026-106070',
|
|
26
|
+
'CVE-2026-106071',
|
|
27
|
+
'CVE-2026-106073'
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
export const PATCHED_NODE_MIN_VERSIONS = Object.freeze({
|
|
31
|
+
22: Object.freeze([22, 23, 4]),
|
|
32
|
+
24: Object.freeze([24, 22, 1]),
|
|
33
|
+
26: Object.freeze([26, 12, 1])
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const FULLWIDTH_DIGIT_OR_DOT_RE = /[\uFF10-\uFF19\uFF0E\u3002\uFF61]/;
|
|
37
|
+
const NUL_BYTE_RE = /\x00|%00/i;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Parses a Node.js semver string like "22.23.4" or "v24.22.1" into [major, minor, patch].
|
|
41
|
+
*/
|
|
42
|
+
export const parseNodeVersion = (versionStr = process?.versions?.node || '') => {
|
|
43
|
+
const cleaned = String(versionStr).trim().replace(/^v/i, '').split('-')[0];
|
|
44
|
+
const parts = cleaned.split('.').map(n => Number.parseInt(n, 10));
|
|
45
|
+
if (parts.length < 3 || parts.some(n => !Number.isFinite(n) || n < 0)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
return [parts[0], parts[1], parts[2]];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Returns true if the given Node.js version includes the October 21, 2026 security patches
|
|
53
|
+
* (v22.23.4+, v24.22.1+, v26.12.1+, or v27+). Node 20.x and 25.x are End-of-Life and unpatched.
|
|
54
|
+
*/
|
|
55
|
+
export const isNodePatchedOct2026 = (versionStr = process?.versions?.node) => {
|
|
56
|
+
const tuple = parseNodeVersion(versionStr);
|
|
57
|
+
if (!tuple) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
const [major, minor, patch] = tuple;
|
|
61
|
+
if (major >= 27) {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
const minTuple = PATCHED_NODE_MIN_VERSIONS[major];
|
|
65
|
+
if (!minTuple) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
if (minor !== minTuple[1]) {
|
|
69
|
+
return minor > minTuple[1];
|
|
70
|
+
}
|
|
71
|
+
return patch >= minTuple[2];
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Returns a structured security assessment for the current or specified Node.js runtime.
|
|
76
|
+
*/
|
|
77
|
+
export const getNodeSecurityStatus = (versionStr = process?.versions?.node) => {
|
|
78
|
+
const tuple = parseNodeVersion(versionStr);
|
|
79
|
+
const patched = isNodePatchedOct2026(versionStr);
|
|
80
|
+
const major = tuple?.[0] ?? 0;
|
|
81
|
+
let recommendedVersion = '>=22.23.4 / >=24.22.1 / >=26.12.1';
|
|
82
|
+
if (major === 22) {
|
|
83
|
+
recommendedVersion = '22.23.4';
|
|
84
|
+
}
|
|
85
|
+
else if (major === 24) {
|
|
86
|
+
recommendedVersion = '24.22.1';
|
|
87
|
+
}
|
|
88
|
+
else if (major === 26) {
|
|
89
|
+
recommendedVersion = '26.12.1';
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
currentVersion: String(versionStr || 'unknown'),
|
|
93
|
+
patched,
|
|
94
|
+
eolLine: major > 0 && major < 22 || major === 23 || major === 25,
|
|
95
|
+
recommendedVersion,
|
|
96
|
+
mitigatedByBibzWhats: true,
|
|
97
|
+
cves: NODE_OCT_2026_CVES
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Detects non-canonical IPv4 hostnames (octal 0177.0.0.1, hex 0x7f.0.0.1 / 0x7f000001,
|
|
103
|
+
* integer 2130706433, or 2/3-part shorthand 127.1 / 127.0.1) that trigger
|
|
104
|
+
* CVE-2026-106069 and CVE-2026-106072 in TLS hostname verification.
|
|
105
|
+
*/
|
|
106
|
+
export const isNonCanonicalIpv4Host = (hostname = '') => {
|
|
107
|
+
const host = String(hostname).trim().replace(/\.$/, '').toLowerCase();
|
|
108
|
+
if (!host || host.startsWith('[')) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
const labels = host.split('.');
|
|
112
|
+
const isNumericOrHexLabel = (part) => /^(?:0x[0-9a-f]+|\d+)$/i.test(part);
|
|
113
|
+
if (!labels.every(isNumericOrHexLabel)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
// All labels are numeric or hex -> this is an IPv4 representation, not a normal domain name
|
|
117
|
+
if (labels.length !== 4) {
|
|
118
|
+
// 1-part integer (2130706433), 2-part (127.1), or 3-part (127.0.1) IPv4
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
for (const label of labels) {
|
|
122
|
+
if (/^0x/i.test(label)) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
if (label.length > 1 && label.startsWith('0')) {
|
|
126
|
+
// Leading zero = octal IPv4 label (e.g. 0177.0.0.1)
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
const num = Number(label);
|
|
130
|
+
if (!Number.isInteger(num) || num < 0 || num > 255) {
|
|
131
|
+
return true;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return false;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Validates a URL against October 2026 Node.js DNS/TLS vulnerabilities:
|
|
139
|
+
* - Rejects NUL bytes / %00 (CVE-2026-105482)
|
|
140
|
+
* - Rejects fullwidth Unicode digits/dots in URL or hostname (CVE-2026-105483)
|
|
141
|
+
* - Rejects non-canonical IPv4 hostnames (CVE-2026-106069 & CVE-2026-106072)
|
|
142
|
+
*/
|
|
143
|
+
export const assertSafeUrl = (inputUrl) => {
|
|
144
|
+
const raw = inputUrl instanceof URL ? inputUrl.toString() : String(inputUrl ?? '');
|
|
145
|
+
if (!raw || NUL_BYTE_RE.test(raw)) {
|
|
146
|
+
throw new Boom('Unsafe URL blocked: contains NUL byte (CVE-2026-105482)', { statusCode: 400 });
|
|
147
|
+
}
|
|
148
|
+
if (FULLWIDTH_DIGIT_OR_DOT_RE.test(raw)) {
|
|
149
|
+
throw new Boom('Unsafe URL blocked: contains fullwidth IP digits/dots (CVE-2026-105483)', { statusCode: 400 });
|
|
150
|
+
}
|
|
151
|
+
const rawHostMatch = raw.match(/^[a-z][a-z0-9+.-]*:\/\/(?:[^/?#@]*@)?([^/?#:]+)/i);
|
|
152
|
+
if (rawHostMatch?.[1] && isNonCanonicalIpv4Host(rawHostMatch[1])) {
|
|
153
|
+
throw new Boom(`Unsafe non-canonical IPv4 hostname blocked: ${rawHostMatch[1]} (CVE-2026-106069 / CVE-2026-106072)`, {
|
|
154
|
+
statusCode: 400
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
let parsed;
|
|
158
|
+
try {
|
|
159
|
+
parsed = inputUrl instanceof URL ? inputUrl : new URL(raw);
|
|
160
|
+
}
|
|
161
|
+
catch {
|
|
162
|
+
throw new Boom(`Invalid URL: ${raw}`, { statusCode: 400 });
|
|
163
|
+
}
|
|
164
|
+
const hostname = parsed.hostname || '';
|
|
165
|
+
let decodedHost = hostname;
|
|
166
|
+
try {
|
|
167
|
+
decodedHost = decodeURIComponent(hostname);
|
|
168
|
+
}
|
|
169
|
+
catch { }
|
|
170
|
+
if (NUL_BYTE_RE.test(hostname) || NUL_BYTE_RE.test(decodedHost)) {
|
|
171
|
+
throw new Boom('Unsafe URL hostname blocked: contains NUL byte (CVE-2026-105482)', { statusCode: 400 });
|
|
172
|
+
}
|
|
173
|
+
if (FULLWIDTH_DIGIT_OR_DOT_RE.test(hostname) || FULLWIDTH_DIGIT_OR_DOT_RE.test(decodedHost)) {
|
|
174
|
+
throw new Boom('Unsafe URL hostname blocked: contains fullwidth digits (CVE-2026-105483)', { statusCode: 400 });
|
|
175
|
+
}
|
|
176
|
+
if (isNonCanonicalIpv4Host(hostname) || isNonCanonicalIpv4Host(decodedHost)) {
|
|
177
|
+
throw new Boom(`Unsafe non-canonical IPv4 hostname blocked: ${hostname} (CVE-2026-106069 / CVE-2026-106072)`, {
|
|
178
|
+
statusCode: 400
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
return parsed;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Returns a plain headers object with `accept-encoding: gzip, deflate` enforced
|
|
186
|
+
* (removing `br` / Brotli to prevent CVE-2026-111497 RCE on unpatched runtimes).
|
|
187
|
+
*/
|
|
188
|
+
export const withSafeFetchHeaders = (headers) => {
|
|
189
|
+
const out = {};
|
|
190
|
+
if (headers) {
|
|
191
|
+
if (typeof headers.entries === 'function') {
|
|
192
|
+
for (const [k, v] of headers.entries()) {
|
|
193
|
+
out[k] = v;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else if (Array.isArray(headers)) {
|
|
197
|
+
for (const [k, v] of headers) {
|
|
198
|
+
out[k] = v;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
else if (typeof headers === 'object') {
|
|
202
|
+
Object.assign(out, headers);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const existingKey = Object.keys(out).find(k => k.toLowerCase() === 'accept-encoding');
|
|
206
|
+
if (existingKey) {
|
|
207
|
+
const cleaned = String(out[existingKey])
|
|
208
|
+
.split(',')
|
|
209
|
+
.map(s => s.trim())
|
|
210
|
+
.filter(s => s && !/^br(?:;|$)/i.test(s))
|
|
211
|
+
.join(', ');
|
|
212
|
+
out[existingKey] = cleaned || SAFE_ACCEPT_ENCODING;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
out['accept-encoding'] = SAFE_ACCEPT_ENCODING;
|
|
216
|
+
}
|
|
217
|
+
return out;
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* Hardened `fetch()` wrapper that validates the target URL (and any redirect URL)
|
|
222
|
+
* against CVE-2026-105482, CVE-2026-105483, CVE-2026-106069, CVE-2026-106072
|
|
223
|
+
* and disables Brotli (`br`) negotiation to mitigate CVE-2026-111497.
|
|
224
|
+
*/
|
|
225
|
+
export const safeFetch = async (inputUrl, init = {}) => {
|
|
226
|
+
const parsed = assertSafeUrl(inputUrl);
|
|
227
|
+
const headers = withSafeFetchHeaders(init.headers);
|
|
228
|
+
const response = await fetch(parsed.toString(), {
|
|
229
|
+
...init,
|
|
230
|
+
headers
|
|
231
|
+
});
|
|
232
|
+
if (response.url) {
|
|
233
|
+
assertSafeUrl(response.url);
|
|
234
|
+
}
|
|
235
|
+
return response;
|
|
236
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xbibzlibrary/whatsbibz",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.4",
|
|
4
4
|
"description": "WhatsBibz — WhatsApp Web multi-device library for Node.js (maintained Baileys fork): high-level client, custom pairing codes, self-healing sessions, configurable or automatic linked-device identity, complete TypeScript declarations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -80,20 +80,20 @@
|
|
|
80
80
|
"registry": "https://registry.npmjs.org/"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
|
-
"@cacheable/node-cache": "^1.
|
|
83
|
+
"@cacheable/node-cache": "^1.7.6",
|
|
84
84
|
"@hapi/boom": "^9.1.4",
|
|
85
|
-
"@types/ws": "^8.18.
|
|
85
|
+
"@types/ws": "^8.18.2",
|
|
86
86
|
"async-mutex": "^0.5.0",
|
|
87
87
|
"fflate": "^0.8.3",
|
|
88
88
|
"libsignal": "^6.0.0",
|
|
89
89
|
"long": "^5.3.2",
|
|
90
|
-
"lru-cache": "^11.
|
|
91
|
-
"music-metadata": "^11.
|
|
92
|
-
"p-queue": "^9.
|
|
93
|
-
"pino": "^9.
|
|
94
|
-
"protobufjs": "^7.
|
|
90
|
+
"lru-cache": "^11.5.3",
|
|
91
|
+
"music-metadata": "^11.16.1",
|
|
92
|
+
"p-queue": "^9.3.5",
|
|
93
|
+
"pino": "^9.14.0",
|
|
94
|
+
"protobufjs": "^7.6.6",
|
|
95
95
|
"whatsapp-rust-bridge": "0.5.5",
|
|
96
|
-
"ws": "^8.
|
|
96
|
+
"ws": "^8.22.0"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"@roamhq/wrtc": "*",
|
|
@@ -137,7 +137,8 @@
|
|
|
137
137
|
"vitepress": "^1.6.4"
|
|
138
138
|
},
|
|
139
139
|
"overrides": {
|
|
140
|
-
"vite": "^
|
|
140
|
+
"vite": "^7.3.7",
|
|
141
|
+
"launch-editor": "^2.14.2",
|
|
141
142
|
"esbuild": "^0.25.0"
|
|
142
143
|
}
|
|
143
144
|
}
|