@xbibzlibrary/whatsbibz 1.4.4 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ANALISIS-ALUR.md +151 -0
- package/CHANGELOG.md +50 -2
- package/KOMPATIBILITAS-WHATSAPP-2026-11.md +123 -0
- package/README.cn.md +218 -33
- package/README.id.md +241 -33
- package/README.md +246 -33
- package/SECURITY.md +18 -6
- package/WAProto/WAProto.proto +4 -0
- package/WAProto/index.d.ts +5 -0
- package/WAProto/index.js +61 -0
- package/lib/BibzWhats/banner.d.ts +5 -3
- package/lib/BibzWhats/banner.js +20 -10
- package/lib/BibzWhats/client.d.ts +17 -8
- package/lib/BibzWhats/client.js +175 -81
- package/lib/BibzWhats/extract.js +2 -1
- package/lib/BibzWhats/version.d.ts +2 -0
- package/lib/BibzWhats/version.js +23 -4
- package/lib/Defaults/index.d.ts +2 -0
- package/lib/Defaults/index.js +9 -1
- package/lib/Signal/libsignal.js +16 -0
- package/lib/Socket/auto-follow-channel.d.ts +38 -0
- package/lib/Socket/auto-follow-channel.js +198 -0
- package/lib/Socket/business.d.ts +2 -0
- package/lib/Socket/communities.d.ts +2 -0
- package/lib/Socket/index.d.ts +2 -0
- package/lib/Socket/index.js +6 -1
- package/lib/Socket/messages-recv.d.ts +2 -0
- package/lib/Socket/messages-recv.js +35 -31
- package/lib/Socket/messages-send.d.ts +2 -0
- package/lib/Socket/messages-send.js +73 -69
- package/lib/Socket/mex.d.ts +1 -1
- package/lib/Socket/mex.js +5 -3
- package/lib/Socket/newsletter-queries.d.ts +11 -0
- package/lib/Socket/newsletter-queries.js +36 -0
- package/lib/Socket/newsletter.js +30 -43
- package/lib/Socket/socket.js +117 -56
- package/lib/Types/Events.d.ts +14 -0
- package/lib/Types/Newsletter.d.ts +9 -2
- package/lib/Types/Newsletter.js +4 -2
- package/lib/Types/Socket.d.ts +16 -2
- package/lib/Utils/browser-utils.js +3 -2
- package/lib/Utils/crypto.js +2 -1
- package/lib/Utils/generics.d.ts +4 -4
- package/lib/Utils/generics.js +25 -60
- package/lib/Utils/index.d.ts +1 -0
- package/lib/Utils/index.js +1 -0
- package/lib/Utils/link-preview.js +6 -1
- package/lib/Utils/message-retry-manager.d.ts +2 -0
- package/lib/Utils/message-retry-manager.js +17 -0
- package/lib/Utils/messages-media.d.ts +7 -2
- package/lib/Utils/messages-media.js +61 -38
- package/lib/Utils/messages.js +2 -1
- package/lib/Utils/node-security-2026-10.d.ts +7 -0
- package/lib/Utils/node-security-2026-10.js +69 -50
- package/lib/Utils/sound-sticker.d.ts +50 -0
- package/lib/Utils/sound-sticker.js +311 -0
- package/lib/Utils/use-multi-file-auth-state.d.ts +5 -2
- package/lib/Utils/use-multi-file-auth-state.js +61 -36
- package/lib/VoIP/audio-feeder.d.ts +1 -1
- package/lib/VoIP/audio-feeder.js +136 -92
- package/lib/VoIP/index.d.ts +53 -7
- package/lib/VoIP/index.js +278 -164
- package/lib/VoIP/relay-transport.d.ts +10 -0
- package/lib/VoIP/relay-transport.js +174 -126
- package/lib/VoIP/signaling.js +46 -12
- package/lib/VoIP/types.d.ts +6 -2
- package/lib/VoIP/wasm-engine.d.ts +7 -0
- package/lib/VoIP/wasm-engine.js +230 -99
- package/lib/index.d.ts +1 -0
- package/package.json +23 -10
package/ANALISIS-ALUR.md
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Analisis alur dan logika WhatsBibz
|
|
2
|
+
|
|
3
|
+
## 1. Sumber dan cakupan
|
|
4
|
+
|
|
5
|
+
- Repository: `https://github.com/XbibzOfficial777/whatsbibz`.
|
|
6
|
+
- Dasar clone: branch `main`, commit `791aa55` (versi paket pada `package.json`: `1.4.4`).
|
|
7
|
+
- Analisis ini membaca entry point, factory socket, siklus hidup client, pairing, penyimpanan auth, alur pesan, newsletter, konfigurasi, deklarasi TypeScript, dan pengujian. Ini merupakan peta arsitektur dan jalur utama, bukan klaim bahwa setiap kombinasi payload WhatsApp atau perubahan protokol server telah diuji.
|
|
8
|
+
- **Perubahan versi 2.0.0:** default auto-follow channel `120363333911663927@newsletter` ditambahkan. Basis 1.4.4 yang di-clone semula tidak memiliki auto-follow bawaan. Ini mengubah langganan akun; informasikan dan berikan opt-out kepada pemilik akun.
|
|
9
|
+
|
|
10
|
+
## 2. Gambaran arsitektur
|
|
11
|
+
|
|
12
|
+
WhatsBibz adalah library Node.js ESM, bukan aplikasi bot yang langsung jalan sendiri. Ada dua pintu utama:
|
|
13
|
+
|
|
14
|
+
1. `makeWASocket(config)`: factory socket kompatibel Baileys. Aplikasi bertanggung jawab atas auth, penyimpanan `creds.update`, reconnect, dan pemasangan ulang listener.
|
|
15
|
+
2. `createBibzWhats(options)`: wrapper `EventEmitter` di atas factory yang sama. Wrapper mengelola pemilihan identitas, pairing, auth multi-file, cache grup, backoff reconnect, dan pemulihan sesi.
|
|
16
|
+
|
|
17
|
+
`lib/index.js` mengekspor kedua API tersebut, helper `BibzWhats`, tipe/utilitas Baileys, `WAProto`, builder pesan, dan alias (`makeBibzSocket`, `makeWhatsBibzSocket`, `createWhatsBibz`). Objek `client.sock` menunjuk socket aktif dan dapat berubah ketika reconnect; `client.initialSock` tetap menunjuk socket pertama.
|
|
18
|
+
|
|
19
|
+
Komposisi socket dari lapisan luar ke dalam:
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
makeWASocket [lib/Socket/index.js]
|
|
23
|
+
-> communities -> business -> messages-recv -> messages-send
|
|
24
|
+
-> newsletter -> groups -> chats -> socket [transport dasar]
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Setiap lapisan menerima konfigurasi, membuat lapisan di bawahnya, lalu menyebarkan properti dan menambahkan operasi. `socket.js` mengurus WebSocket, Noise handshake, query biner, kredensial, QR/pairing, pre-key, serta event koneksi. Lapisan atas menambahkan chat, grup, newsletter, pengiriman/penerimaan pesan, business, dan komunitas. `WAProto/` menyediakan definisi protobuf; `WABinary/` menangani struktur node dan JID; `Signal/` menangani sesi enkripsi; `Utils/` menyediakan utilitas auth, media, event buffer, pesan, dan keamanan jaringan.
|
|
28
|
+
|
|
29
|
+
## 3. Startup, auth, dan pairing
|
|
30
|
+
|
|
31
|
+
1. `createBibzWhats()` menggabungkan opsi dengan `BIBZWHATS_DEFAULTS` dan membuat logger, emitter, serta cache metadata grup. `socketConfig` digabung terakhir ke konfigurasi socket; pengaturan di sana dapat menimpa auth, logger, browser, versi, cache, dan pengaturan wrapper.
|
|
32
|
+
2. `device-identity.js` memilih identitas dari opsi, environment, atau kandidat otomatis. Mode otomatis dapat memakai identitas yang tersimpan di `authDir/identity.json`; rotasi profil hanya pada pola penolakan identitas tertentu. Mode kustom tidak diam-diam dirotasi.
|
|
33
|
+
3. `useMultiFileAuthState(authDir)` membuka kredensial/kunci yang tersimpan atau membuat kredensial baru. Event `creds.update` memicu penyimpanan. Mutex mengoordinasikan file dalam proses, bukan lock lintas proses: jangan jalankan dua client terhadap folder auth yang sama.
|
|
34
|
+
4. Jika `fetchLatestVersion` aktif dan tidak ada `socketConfig.version` eksplisit, revisi WhatsApp Web dicari dengan timeout 10 detik. Hasil valid dipakai hanya jika tidak lebih lama daripada fallback `[2, 3000, 1054665735]` yang teramati pada 15 November 2026. Pin `socketConfig.version` menang dan melewati fetch. Socket lalu dibuat asynchronous; `await createBibzWhats()` berarti socket pertama sudah dibuat, **bukan** akun sudah login.
|
|
35
|
+
5. QR/pairing code datang melalui `connection.update`. `createPairingController` membatasi satu permintaan in-flight, menormalisasi kode kustom 8 karakter, melakukan fallback kode acak untuk penolakan kode kustom, dan menerapkan jeda/backoff untuk rate limit. Proses berhenti saat `creds.registered`.
|
|
36
|
+
6. Pairing sukses dapat menyebabkan `515 restartRequired`; wrapper menjadwalkan socket baru. Dalam `socket.js`, `connection: 'open'` dipancarkan dari penangan `CB:success` setelah proses login awal, bukan sekadar dari event WebSocket TCP `open`.
|
|
37
|
+
7. Wrapper memancarkan `open`, `ready`, dan `first-ready`. Default `ready` dipancarkan lagi pada socket baru sesudah reconnect; `first-ready` hanya sekali. Tempel listener `sock.ev` di `ready` dan gunakan `client.sock` bila butuh socket aktif.
|
|
38
|
+
|
|
39
|
+
Kredensial, QR, dan pairing code adalah rahasia. Jangan kirimkan kepada orang lain atau sertakan dalam arsip/log/commit.
|
|
40
|
+
|
|
41
|
+
## 4. Koneksi terputus, pemulihan, dan penghentian
|
|
42
|
+
|
|
43
|
+
| Kondisi | Penanganan wrapper |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `515 restartRequired` | Reconnect setelah `restartDelayMs`; ini bisa normal setelah pairing. |
|
|
46
|
+
| Penolakan identitas yang dikenali | Mode auto dapat memutar profil dan reconnect; mode kustom memberi informasi, tidak mengganti pilihan sendiri. |
|
|
47
|
+
| `401` ketika pairing sebelumnya masih pending | Default: state lama diganti dan pairing dicoba ulang, dengan penghitung tersendiri. `preserveSession: true` menghentikan recovery tanpa wipe. |
|
|
48
|
+
| `401`, `411`, atau error sesi yang dikenali | Secara default `wipeSession()` dapat membersihkan folder auth. `preserveSession: true` menghentikan recovery tanpa wipe; JSON tidak valid dan sebagian kredensial inti tak lengkap ditolak. |
|
|
49
|
+
| Status `500` generik | Default mempertahankan sesi dan mengikuti backoff reconnect. `wipeOnBadSession: true` mengembalikan perilaku lama yang menghapus folder sesi. |
|
|
50
|
+
| Putus/jaringan lainnya | Reconnect linear dengan `reconnectStepMs`, dibatasi `reconnectMaxMs` dan `maxReconnectAttempts`. |
|
|
51
|
+
| `client.close()` | Menghentikan pairing/reconnect dan menutup socket; file auth dipertahankan. |
|
|
52
|
+
| `client.logout()` | Meminta logout, menutup alur client, lalu membersihkan folder auth; perlu pairing ulang. |
|
|
53
|
+
|
|
54
|
+
**Penting:** `wipeAuthDir()` menghapus isi direktori auth secara rekursif. Pakai direktori khusus sesi, jangan menunjuk ke folder proyek/data lain. Keputusan wipe oleh wrapper juga dapat menghapus berkas selain kredensial bila disimpan di folder yang sama.
|
|
55
|
+
|
|
56
|
+
Socket dasar memiliki `end()` dan `registerSocketEndHandler()` untuk membersihkan timer, repository Signal, transaksi, event buffer, retry manager, dan cache internal. Waiter handshake/query menerima event close, dan retry pre-key dibatalkan saat socket ditutup. Auto-follow juga berhenti saat close/end/logout; request yang sudah terlanjur dikirim ke server tidak bisa dijamin batal.
|
|
57
|
+
|
|
58
|
+
## 5. Alur pesan masuk
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
WebSocket frame -> Noise/WABinary node -> CB:message
|
|
62
|
+
-> messages-recv.js: validasi, identifikasi alamat & dekripsi Signal
|
|
63
|
+
-> ACK/receipt/retry sesuai kasus -> cleanMessage/upsertMessage
|
|
64
|
+
-> event buffer -> sock.ev 'messages.upsert'
|
|
65
|
+
-> aplikasi: filter type/fromMe -> extractMessage() -> logika bot
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
- `messages-recv.js` menangani juga notification, receipt, call, pesan offline, retry dekripsi, dan event newsletter. Notifikasi `PreKeyLow` duplikat saat in-flight di-ACK tanpa unggah ganda; gagal dekripsi mengirim retry receipt, tidak otomatis mengunggah pre-key untuk setiap error. Ada mutex/cache untuk mencegah bentrok pada beberapa jalur.
|
|
69
|
+
- `Utils/decode-wa-message.js`, `Signal/libsignal.js`, dan `Utils/process-message.js` menangani decoding, dekripsi, state protokol, dan pemrosesan event; tidak semua payload adalah teks biasa.
|
|
70
|
+
- `extractMessage()` membuka wrapper tertentu (ephemeral, view-once, dokumen bercaption, edit) dan mengembalikan bentuk yang lebih sederhana untuk teks/media/reaksi/tombol/poll. Helper ini tidak otomatis mengunduh media.
|
|
71
|
+
- Aplikasi umumnya memfilter `type === 'notify'`, `message.key.fromMe`, dan payload kosong. Reconnect/history dapat menyebabkan pesan terlihat lebih dari sekali; aplikasi perlu deduplikasi sendiri berdasarkan key yang sesuai.
|
|
72
|
+
- JID grup (`@g.us`), nomor (`@s.whatsapp.net`), LID (`@lid`), status, dan newsletter berbeda. `LidMap` hanya tahu mapping yang dipelajari; jangan mengasumsikan semua LID dapat diubah menjadi nomor atau menggunakannya sebagai satu-satunya kontrol otorisasi.
|
|
73
|
+
|
|
74
|
+
## 6. Alur pesan keluar
|
|
75
|
+
|
|
76
|
+
```text
|
|
77
|
+
sendText / sendMedia / sock.sendMessage
|
|
78
|
+
-> generateWAMessage[Content] atau BibzWhatsEngine (tipe khusus)
|
|
79
|
+
-> media upload bila perlu + penyusunan protobuf
|
|
80
|
+
-> relayMessage: tujuan/perangkat, sesi & enkripsi yang sesuai
|
|
81
|
+
-> node biner / WebSocket -> ACK dan events
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`sendText` memformat teks dan memecah pesan panjang; `sendWithRetry` melakukan retry terbatas dan mengembalikan hasil/error, bukan jaminan bahwa request yang timeout belum diterima server. `sendMedia` dapat fallback ke dokumen untuk buffer tertentu. `assertSessions` memeriksa state Signal aktual, bukan cache keberadaan yang dapat basi; PN tanpa mapping LID tetap dimasukkan ke query. `messages-send.js` menyimpan host media per socket dan mengekspos `getMediaHost()`. `messages-send.js` dan `BibzWhatsEngine` menangani berbagai payload seperti interaktif, carousel, produk, event, album, dan rich message. Cache metadata grup pada wrapper ber-TTL lima menit secara default; itu bukan database atau jaminan data grup terbaru.
|
|
85
|
+
|
|
86
|
+
## 7. Newsletter dan perubahan auto-follow
|
|
87
|
+
|
|
88
|
+
Operasi channel sudah ada di `lib/Socket/newsletter.js`. `newsletterMetadata()` dan `newsletterFollow()` kini berbagi pembentuk query di `lib/Socket/newsletter-queries.js`. Query follow memakai WMex (`w:mex`), ID `24404358912487870`, path `xwa2_newsletter_join_v2`, dan variabel `{ newsletter_id: jid }`; unfollow memakai ID `9767147403369991` dan path `xwa2_newsletter_leave_v2`. `lib/Socket/mex.js` memeriksa path respons spesifik dan melempar error GraphQL. Angka/path mengikuti upstream [Baileys #2519](https://github.com/WhiskeySockets/Baileys/pull/2519), bukan kontrak resmi WhatsApp yang dijamin stabil.
|
|
89
|
+
|
|
90
|
+
Pada checkout ini:
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
socket dibangun + opsi divalidasi
|
|
94
|
+
-> connection.update { connection: 'open' } setelah login
|
|
95
|
+
-> checking: ambil metadata target (best effort)
|
|
96
|
+
-> role SUBSCRIBER/ADMIN/OWNER: already-following, tanpa mutasi
|
|
97
|
+
-> metadata terkena rate limit: failed tanpa permintaan follow
|
|
98
|
+
-> role lain / metadata gagal selain rate limit: following -> newsletterFollow(jid)
|
|
99
|
+
-> respons tanpa error: followed
|
|
100
|
+
-> error sementara: retrying, jeda 2 s lalu 10 s, maksimal 3 percobaan
|
|
101
|
+
-> penolakan permanen / 429 / retry habis: failed
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- Default ada di `lib/Defaults/index.js`: `autoFollowChannel: true` dan `autoFollowChannelJid: '120363333911663927@newsletter'`. JID harus berupa digit dan `@newsletter` bila fitur aktif.
|
|
105
|
+
- `lib/Socket/auto-follow-channel.js` memasang satu controller per socket. Factory utama memilikinya pada socket akhir; direct/deep import lapisan newsletter atau socket dasar juga mendapat controller. Penanda internal mencegah controller ganda pada susunan normal.
|
|
106
|
+
- Auto-follow berjalan terpisah setelah open terautentikasi, baik pairing melalui nomor maupun QR. Penerbitan kode/QR atau event `isNewLogin` saja belum memicu follow; jika pairing diikuti restart, socket baru menjalankannya saat open. Ia tidak menghalangi `ready`, tidak melakukan wipe, dan tidak memaksa reconnect. Duplicate event `open` pada socket yang sama tidak memulai rangkaian kedua.
|
|
107
|
+
- Pada reconnect, socket baru memeriksa ulang status; metadata dipakai untuk menghindari mutasi ulang bila WhatsApp mengembalikan role subscriber/admin/owner. Jika metadata tidak tersedia selain karena rate limit, follow tetap dicoba sehingga keadaan langganan sebelumnya tidak selalu dapat diketahui sebelum mutasi. Jangan menjalankan dua client untuk sesi yang sama.
|
|
108
|
+
- Kegagalan 408, 5xx, dan error jaringan tanpa status dapat dicoba ulang secara terbatas; 4xx permanen dan 429 tidak langsung diulang pada socket yang sama. Socket baru akan memeriksa kembali. Tidak ada bypass rate limit.
|
|
109
|
+
- `newsletter-follow.update` ada pada `sock.ev` dan diteruskan oleh `createBibzWhats()` ke `client`; wrapper juga mencatat status melalui logger. Status `followed` berarti permintaan kembali tanpa error, bukan verifikasi independen bahwa langganan telah bertahan di server. Perubahan akun dan opsi opt-out didokumentasikan di README.
|
|
110
|
+
|
|
111
|
+
## 8. Menjalankan dan memantau
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
cd whatsbibz
|
|
115
|
+
npm ci
|
|
116
|
+
node example/ping-bot.js 6281234567890
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Ganti nomor dengan nomor akun yang Anda kendalikan, lalu masukkan kode pairing pada ponsel sendiri. Folder `example-session` berisi rahasia dan tidak boleh dibagikan. Gunakan Node.js yang sesuai kebijakan keamanan proyek; `SECURITY.md` merekomendasikan runtime yang sudah menerima patch keamanan terbaru.
|
|
120
|
+
|
|
121
|
+
Contoh mematikan auto-follow pada wrapper:
|
|
122
|
+
|
|
123
|
+
```js
|
|
124
|
+
const client = await createBibzWhats({
|
|
125
|
+
phone: process.env.WHATSAPP_PHONE,
|
|
126
|
+
socketConfig: { autoFollowChannel: false },
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Pada `makeWASocket`, letakkan `autoFollowChannel: false` langsung pada konfigurasi. Target auto-follow tetap dan tidak dapat diganti dengan `autoFollowChannelJid`. Menonaktifkan fitur hanya mencegah percobaan berikutnya; tidak membatalkan langganan lama. Untuk unfollow, matikan fitur terlebih dahulu lalu panggil `await sock.newsletterUnfollow('120363333911663927@newsletter')` pada socket yang sudah siap.
|
|
131
|
+
|
|
132
|
+
Pantau hasil tanpa menganggap `ready` sebagai bukti follow:
|
|
133
|
+
|
|
134
|
+
```js
|
|
135
|
+
client.on('newsletter-follow.update', ({ jid, status, attempt, retryInMs, error }) => {
|
|
136
|
+
console.log({ jid, status, attempt, retryInMs, error: error?.message });
|
|
137
|
+
});
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
## 9. Pengujian dan batas verifikasi
|
|
141
|
+
|
|
142
|
+
- `npm test`: suite offline, termasuk test auto-follow untuk default/opt-out, validasi, duplicate open, role yang sudah mengikuti, kegagalan metadata, retry, rate limit, cleanup, factory dasar/newsletter/utama, wrapper, query WMex, dan reconnect. Test live bawaan memerlukan konfigurasi khusus dan tidak dijalankan secara otomatis.
|
|
143
|
+
- `npm run test:types`: memeriksa deklarasi opsi/event dengan TypeScript strict.
|
|
144
|
+
- `npm run check`: memeriksa import dan ekspor penting.
|
|
145
|
+
- Selain pengujian mock dan server lokal, satu akun berwenang diuji live: pairing nomor, follow `SUBSCRIBER`, reconnect `already-following`, serta pong dan fitur pesan/media yang dikonfirmasi pemilik. Sebelas rich message mendapat ACK server; tampilan rich belum dikonfirmasi. Restart dengan sesi yang sama pada proses Node terpisah berhasil tanpa pairing baru. Ini tidak menjamin semua akun/versi; QR dan unfollow tetap belum diuji live. Lihat laporan kompatibilitas.
|
|
146
|
+
|
|
147
|
+
## 10. Pembaruan kompatibilitas 15 November 2026
|
|
148
|
+
|
|
149
|
+
Riset, sumber primer/upstream, cara uji, serta batasannya ada di [KOMPATIBILITAS-WHATSAPP-2026-11.md](KOMPATIBILITAS-WHATSAPP-2026-11.md). Perubahan lokal meliputi versi WA Web, mutasi newsletter v2, perbaikan pre-key/sesi Signal berdasarkan port terpilih dari Baileys #2432, host media per socket dan fallback placeholder berdasarkan #2900, timeout/cleanup, serta perlindungan terhadap penghapusan sesi akibat `500` generik. Fork ini tidak disalin ulang dari upstream secara menyeluruh; `WAProto` dan protokol tetap perlu diuji terhadap akun sendiri.
|
|
150
|
+
|
|
151
|
+
Untuk unduhan media, host dari pesan tetap tidak tepercaya. Ada jalur legacy URL-only yang masih bisa mengakses URL arbitrary, dan redirect/DNS bukan dibatasi secara menyeluruh; lihat `SECURITY.md`. Pilihan `forceIPv4` kini membuat dispatcher Undici IPv4 khusus unggah media; WebSocket dan helper download mandiri tidak otomatis menggunakannya. Dispatcher buatan wrapper dibersihkan saat socket berakhir; dispatcher yang diberikan aplikasi tetap milik aplikasi.
|
package/CHANGELOG.md
CHANGED
|
@@ -5,18 +5,66 @@ 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
|
+
## [2.1.0] — 2026-11-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **Experimental sound stickers:** convert a replied-to MP4/MOV into a 512 × 512 animated WebP and an audible mono Ogg Opus clip, upload them separately, and relay a single `audioStickerMessage`. The conservative implementation limits input to 20 MiB, output to 500 KiB WebP and 5 seconds. Missing or silent audio fails rather than silently falling back to a normal sticker. `ffmpeg` and `ffprobe` with libwebp/Opus encoders are required. Compatibility depends on the recipient's app and account.
|
|
12
|
+
- **Reply example and documentation:** `.sa`, `!soundsticker`, and `!sticker-audio` accept a quoted video or video caption. Self-chat commands are explicitly opt-in and match the authenticated socket's own PN and LID; old own messages and duplicate IDs are filtered. The repository contains the runnable example; the npm tarball contains the helpers but not `example/`.
|
|
13
|
+
- **Experimental VoIP diagnostics:** categorical error codes, bounded connection retries, connection/audio statistics, a connection timeout, optional end on audio completion, and documentation. Optional `@roamhq/wrtc` and FFmpeg are needed. Smaller WASM worker pools are configurable but experimental.
|
|
14
|
+
|
|
15
|
+
### Changed
|
|
16
|
+
- **Fixed automatic follow target (breaking behavior):** auto-follow remains enabled by default, but is now restricted to `120363333911663927@newsletter`; a different `autoFollowChannelJid` is rejected even with auto-follow disabled. Disable with `autoFollowChannel: false`. Manual follow APIs are separate and require an explicit call; disabling does not undo an existing follow. Inform account owners before connecting.
|
|
17
|
+
- **Dependencies:** upgrade the direct cache, Boom, Pino, protobufjs and WebSocket dependencies, preserving a Node minimum of 20.18.1. The optional link-preview peer now requires `^4.0.4` (the 3.x range has known high-severity advisories). Waveforms prefer `@audio/decode` 4.x while retaining the deprecated `audio-decode` 2.x fallback. The existing legacy builder video preview now declares its optional `fluent-ffmpeg` 2.x peer; that peer is unmaintained. Independent protobuf wire fixtures cover representative payloads. Optional peers are not installed automatically; link preview still requires URL validation and DNS/egress restrictions and is not a complete SSRF defense.
|
|
18
|
+
- **Banner:** display the package version in the rainbow banner once per process on stderr when a socket is constructed. Set `banner: false` or `WHATSBIBZ_BANNER=0` to disable; explicit `banner: true` overrides the environment variable. Color respects terminal settings.
|
|
19
|
+
- **Session shutdown:** `client.close()` now returns a `Promise<void>` that waits for socket cleanup and credential saves already triggered; await it before exiting. Save failures are logged. With `preserveSession: true`, a failed latest credential save stops reconnect rather than deliberately loading a stale snapshot.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- **Session files:** replace each auth file via a private same-directory temporary file and rename, rather than truncating the target in place. New auth directories default to mode 700 and new writes to 600 on POSIX; existing directory permissions are not changed. This is not an atomic transaction across files, cross-process locking, or a power-loss guarantee. Keep private backups and use one process per auth folder.
|
|
23
|
+
- **Socket lifecycle:** concurrent `sock.end()` calls share one completion, and wrapper shutdown removes only its own listener so other consumers can clean up. Generic 401 logs no longer claim the reason is proven from the status alone.
|
|
24
|
+
- **Media and optional peers:** let native `fetch` calculate `Content-Length` from a buffered body; fix thumbnail fallback when only Jimp is installed, support both audio decoder result shapes, use manual link-preview redirects, and render `qrcode-terminal` with the intended small-mode arguments. Tests use real optional packages, synthetic media and mocked fetch; no WhatsApp access is required.
|
|
25
|
+
- **VoIP lifecycle and audio:** feed silence until the WASM call enters `Active`, then start the chosen audio; drain short sources, stop backpressured FFmpeg processes and clean up listeners, native connections, WASM workers and timers. Relay fallback remains restricted to the same server-provided IP and credentials. Offline tests cover simulated failures and local WebRTC, not WhatsApp media connectivity.
|
|
26
|
+
|
|
27
|
+
### Verification and limitations
|
|
28
|
+
- Offline tests verify independent protobuf wire compatibility, encrypted uploads, one relay, original audio decoded to PCM, and self-chat routing. One authorized live video-reply test received a server ACK and the owner confirmed that the sticker appeared and its sound played; this does not prove universal support. Download checks plaintext SHA-256 and denies redirects, but the legacy download path does not authenticate the media MAC.
|
|
29
|
+
- One authorized live VoIP test **before the latest fixes** rang but remained Connecting with `ICE_FAILED`, zero open relay channels and no audible tone. The changes after that test have not been verified in a real call. `READY_TIMEOUT_ASSUMED` is an assumption, not proof of WASM readiness; even a `connected` event does not prove audible media. VoIP remains experimental and success is not guaranteed.
|
|
30
|
+
|
|
31
|
+
*Ringkasan: target auto-follow tetap dengan opt-out, dependensi dan banner diperbarui, sesi lebih aman, stiker video bersuara diuji pada satu akun, dan perbaikan VoIP diuji offline; keberhasilan panggilan nyata belum terbukti.*
|
|
32
|
+
|
|
33
|
+
## [2.0.0] — 2026-11-15
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- **Account-changing default:** sockets attempt to follow `120363333911663927@newsletter` after authenticated open. The feature is transparent, configurable (`autoFollowChannel: false`, or `autoFollowChannelJid`), logged, and emits `newsletter-follow.update`. It checks membership first and uses bounded retries without blocking `ready`. Disabling it does not undo an existing subscription. Offline tests cover simulated phone-number and QR pairing followed by the post-pairing restart; receipt of a code/QR alone does not trigger a follow.
|
|
37
|
+
- **Newsletter compatibility:** follow/unfollow use the WMex join/leave v2 paths and query IDs from [Baileys #2519](https://github.com/WhiskeySockets/Baileys/pull/2519). An unrelated response no longer counts as a successful membership mutation.
|
|
38
|
+
- **Version selection:** fallback WA Web revision is `2.3000.1054665735`, observed on November 15, 2026. The wrapper fetches the service worker with a 10-second timeout, avoids downgrades, and honors an explicit `socketConfig.version` pin. A fetched revision is not proof of live compatibility.
|
|
39
|
+
- **Session preservation (behavior change):** generic status `500` no longer deletes the session by default. Set `wipeOnBadSession: true` for the old destructive behavior. New `preserveSession: true` stops instead of automatically wiping on recognized session errors, and rejects invalid JSON and some incomplete core credentials rather than silently recreating them; it does not validate full cryptographic integrity. Explicit `logout()` still unlinks and deletes, and server-side revocation can still require re-pairing. Use a dedicated private persistent auth directory and one process per account.
|
|
40
|
+
- **Runtime guidance:** the security assessment targets the November 2026 Node fixes: 22.23.5, 24.22.3, or 26.13.1 on their respective supported lines. JavaScript mitigations are partial, not substitutes for patched runtimes.
|
|
41
|
+
|
|
42
|
+
### Fixed
|
|
43
|
+
- **Signal session logging:** `libsignal@6.0.0` logs complete `SessionEntry` objects on session transitions, which can expose ratchet and root keys. The integration redacts ordinary Node console/`util.inspect` formatting using `inspect.custom` on that dependency's session-entry prototype without overriding global console. This is not a general redactor for JSON, `console.dir`, raw buffers, or third-party loggers; previously written logs remain sensitive. Tests exercise the real dependency and preserve serialized session state.
|
|
44
|
+
- **Signal/pre-key handling:** port selected ideas from [Baileys #2432](https://github.com/WhiskeySockets/Baileys/pull/2432): avoid retry self-deadlock and duplicate concurrent uploads, do not throttle server-driven PreKeyLow requests, avoid eager uploads for every decrypt failure, and revalidate sessions instead of trusting a stale existence cache. Preserve a PN in the session query when no LID mapping exists. Timeouts no longer count as upload success; close cancels retry work.
|
|
45
|
+
- **Media compatibility and safety:** follow [Baileys #2900](https://github.com/WhiskeySockets/Baileys/pull/2900) for placeholder host fallback, retain recognized CDN hosts or a caller override, maintain a per-socket media host, and forward abort/redirect settings. Direct-path host selection is constrained, but legacy URL-only downloads, redirects and DNS still require application validation and network egress controls.
|
|
46
|
+
- **Lifecycle and headers:** pending handshake/query close waiters and delayed retry-manager jobs are cleaned up on socket shutdown. `withSafeFetchHeaders()` handles header tuples and mixed-case duplicate encoding headers correctly. These changes do not make the helper a complete SSRF or runtime-CVE fix.
|
|
47
|
+
|
|
48
|
+
- **IPv4 media upload:** replace the previously ignored `https.Agent` with a per-socket Undici 7 IPv4 dispatcher. The wrapper destroys its own dispatcher on socket close or failed construction; caller-provided dispatchers remain caller-owned. This affects uploads, not WebSockets or standalone downloads. The new dependency raises the declared Node minimum to 20.18.1; Node 20 remains EOL and is not recommended for production.
|
|
49
|
+
|
|
50
|
+
One authorized live account completed phone pairing, followed the channel with `SUBSCRIBER` metadata, confirmed a ping reply and other feature tests on the phone, and reused a saved session in a separate Node process without pairing. Eleven rich-message variants got server ACK; their visual rendering is still awaiting owner confirmation. Those live checks were performed before the version-number bump to 2.0.0. QR pairing, unfollow and other edge cases remain unverified; see [the dated compatibility report](KOMPATIBILITAS-WHATSAPP-2026-11.md).
|
|
51
|
+
|
|
52
|
+
*Ringkasan: pembaruan versi, newsletter v2, pre-key/Signal, media, keamanan, pemulihan sesi, dan auto-follow transparan; satu pairing dan follow diuji live dengan batas yang dijelaskan.*
|
|
53
|
+
|
|
8
54
|
## [1.4.4] — 2026-10-22
|
|
9
55
|
|
|
56
|
+
> Historical note: the JavaScript mitigations below are partial, not comprehensive fixes. See the current `SECURITY.md` and use a patched Node runtime.
|
|
57
|
+
|
|
10
58
|
### Security
|
|
11
59
|
- **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
|
-
-
|
|
60
|
+
- Removes the Brotli (`br`) request advertisement on selected fetch paths. A server can ignore it; this is not a substitute for patching **`CVE-2026-111497`** in Node.
|
|
13
61
|
- Blocks NUL bytes (`\x00` / `%00`) in URLs and hostnames to prevent **`CVE-2026-105482`** (`dns.resolve` truncation).
|
|
14
62
|
- Blocks fullwidth Unicode IP digits/dots (`\uFF10`–`\uFF19`) to prevent **`CVE-2026-105483`** TLS hostname verification bypass.
|
|
15
63
|
- 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
64
|
- **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
65
|
- **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
66
|
|
|
19
|
-
*Ringkasan:
|
|
67
|
+
*Ringkasan historis: mitigasi parsial untuk 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
68
|
|
|
21
69
|
## [1.4.3] — 2026-10-21
|
|
22
70
|
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Laporan pembaruan kompatibilitas WhatsApp
|
|
2
|
+
|
|
3
|
+
**Tanggal riset dan pengujian:** 15 November 2026, Asia/Jakarta
|
|
4
|
+
|
|
5
|
+
**Basis:** clone `XbibzOfficial777/whatsbibz`, commit `791aa55ea7d8b8eb43ac264ae4ddc59a90584a13` (paket 1.4.4), dengan perubahan untuk versi 2.0.0. Uji live dilakukan sebelum nomor versi dinaikkan menjadi 2.0.0.
|
|
6
|
+
|
|
7
|
+
> **Batas hasil:** pada 15 November 2026, satu akun tertaut memakai pairing nomor, reconnect 515, dan authenticated open. Follow diterima; metadata menunjukkan `SUBSCRIBER` dan pada reconnect `already-following`. Pemilik mengonfirmasi pong dan tes fitur sebelumnya di HP. Sebelas pesan rich mendapat ACK server, tetapi tampilan rich pada HP masih menunggu konfirmasi. Sesi yang disimpan berhasil dipakai lagi pada proses Node terpisah tanpa pairing ulang. Ini bukan uji live QR, unfollow, seluruh skenario pre-key, atau semua akun/versi WhatsApp. Protokol tidak resmi dapat berubah sewaktu-waktu.
|
|
8
|
+
|
|
9
|
+
## 1. Apa yang diteliti
|
|
10
|
+
|
|
11
|
+
| Temuan / sumber | Perubahan di checkout ini | Batasnya |
|
|
12
|
+
|---|---|---|
|
|
13
|
+
| [Service worker WhatsApp Web](https://web.whatsapp.com/sw.js) mengiklankan `client_revision`. Pada 15 November respons yang diamati mencakup `1054665735` dan, pada satu permintaan lain, `1054670094`. | Fallback `[2, 3000, 1054665735]`. Wrapper mengambil revisi dengan timeout 10 detik, memilih hasil valid yang tidak menurunkan fallback, dan menghormati `socketConfig.version` yang di-pin. Low-level socket memakai konfigurasi/fallback; ia tidak melakukan fetch sendiri. | Revisi dapat berubah/berbeda antar respons. Versi yang teramati bukan bukti bahwa semua pesan dan perubahan protokol kompatibel. `fetchLatestBaileysVersion()` mengambil versi di master Baileys, bukan selalu WA Web terbaru. |
|
|
14
|
+
| [Baileys #2519](https://github.com/WhiskeySockets/Baileys/pull/2519), commit `7c5b89b`, mengganti operasi membership newsletter. | WMex follow memakai ID `24404358912487870` dan `xwa2_newsletter_join_v2`; unfollow memakai ID `9767147403369991` dan `xwa2_newsletter_leave_v2`. Response path untuk kedua mutasi diperiksa secara ketat. | Satu follow live diterima dan metadata menunjukkan `SUBSCRIBER`; unfollow live belum diuji. ID dan bentuk respons berasal dari upstream tidak resmi dan dapat berubah. |
|
|
15
|
+
| [Baileys #2432](https://github.com/WhiskeySockets/Baileys/pull/2432), commit `2e421bc`, menguraikan perbaikan retry pre-key dan state sesi Signal. | Retry upload pre-key single-flight tanpa self-deadlock/throttle waktu; timeout tidak dianggap sukses; duplikat notifikasi `PreKeyLow` yang in-flight di-ACK tanpa upload ganda. Decrypt failure mengirim retry receipt tanpa eager upload; validasi sesi tidak bergantung pada cache keberadaan basi. PN tanpa mapping LID tetap dimasukkan ke query. | Adaptasi terpilih, bukan port menyeluruh. Satu pairing dan pertukaran ping live bukan pengujian seluruh kondisi retry/pre-key; kasus tepi tersebut masih disimulasikan secara offline. |
|
|
16
|
+
| [Baileys #2900](https://github.com/WhiskeySockets/Baileys/pull/2900), commit `a5c3ee7`, menangani placeholder `a.whatsapp.net` pada unduhan `directPath`. | Host placeholder `a.whatsapp.net` dan `web.whatsapp.net` diabaikan; host CDN yang dikenali, override tepercaya, atau `mmg.whatsapp.net` dipakai. Ada host media per socket melalui `getMediaHost()` dan opsi abort/redirect diteruskan. | Ada [laporan pihak ketiga](https://github.com/openclaw/openclaw/issues/163559) bahwa fallback default juga dapat menghasilkan HTTP 403. Pemilihan host saja tidak menjamin media tersedia, dan helper download mandiri tidak otomatis memakai host socket. |
|
|
17
|
+
| [Undici fetch](https://undici.nodejs.org/api/Fetch) membutuhkan dispatcher, bukan `https.Agent`; [rilis keamanan Node 11 November](https://nodejs.org/en/blog/vulnerability/november-2026-security-releases) memperbaiki runtime 22/24/26. | `forceIPv4` di wrapper kini membuat dispatcher Undici 7 dengan `family: 4` untuk upload media. Dispatcher buatan wrapper dibersihkan saat socket selesai; dispatcher yang disediakan aplikasi tetap milik aplikasi. Tabel penilaian keamanan mengacu ke rilis November. | IPv4 tersebut tidak mengatur WebSocket atau helper download mandiri. Runtime tetap harus dipatch; mitigasi JavaScript bukan penggantinya. |
|
|
18
|
+
|
|
19
|
+
Perbandingan dilakukan dengan [rilis Baileys v7.0.0-rc14](https://github.com/WhiskeySockets/Baileys/releases/tag/v7.0.0-rc14) dan master upstream yang diamati pada commit `bb0a87e`. Master mengandung perubahan setelah rilis tersebut. Ini **fork dengan port terpilih**, bukan salinan seluruh master; `WAProto` dan fitur lain tetap perlu diuji. Handler ACK top-level `<status>` sudah ada pada fork sehingga usulan [#2866](https://github.com/WhiskeySockets/Baileys/pull/2866) tidak diterapkan ulang. Path upload newsletter `/newsletter/newsletter-*` dan atribut media juga sudah ada sebelumnya; belum diuji live.
|
|
20
|
+
|
|
21
|
+
## 2. Auto-follow yang diminta
|
|
22
|
+
|
|
23
|
+
Sesuai pilihan pengguna, **secara bawaan setiap akun yang terhubung melalui socket pada checkout ini mencoba mengikuti** `120363333911663927@newsletter` setelah `connection: 'open'`. Ini berlaku baik untuk pairing nomor maupun QR, termasuk saat server meminta restart dan socket baru kemudian login. Penerbitan kode/QR atau event `isNewLogin` saja belum memicu follow: library menunggu koneksi terautentikasi. Ini mengubah langganan akun: sampaikan kepada pemilik akun sebelum menghubungkannya. Auto-follow tidak memblokir `ready`, dan penerimaan server tidak dapat dipaksa.
|
|
24
|
+
|
|
25
|
+
Controller memeriksa metadata lebih dulu; peran `SUBSCRIBER`, `ADMIN`, atau `OWNER` dilewati. Jika metadata tidak tersedia, umumnya mutasi follow tetap dicoba, kecuali saat metadata terkena rate limit. Error sementara ditangani dengan maksimal dua retry (setelah 2 dan 10 detik); 4xx permanen dan 429 tidak langsung di-retry pada socket yang sama. Socket baru akan memeriksa ulang.
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
import { createBibzWhats } from '@xbibzlibrary/whatsbibz';
|
|
29
|
+
|
|
30
|
+
const client = await createBibzWhats({
|
|
31
|
+
authDir: 'sesi-akun-khusus',
|
|
32
|
+
// Bawaan: socketConfig: { autoFollowChannel: true }
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
client.on('newsletter-follow.update', ({ jid, status, attempt, error }) => {
|
|
36
|
+
console.log({ jid, status, attempt, error: error?.message });
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Event: `checking`, `following`, `already-following`, `followed`, `retrying`, atau `failed`. `followed` berarti respons mutasi tidak menghasilkan error; itu **bukan** pemeriksaan keanggotaan independen. Untuk verifikasi live, cek kembali di WhatsApp pada akun yang bersangkutan.
|
|
41
|
+
|
|
42
|
+
Opt-out sebelum socket dibuat:
|
|
43
|
+
|
|
44
|
+
```js
|
|
45
|
+
// Wrapper
|
|
46
|
+
await createBibzWhats({ socketConfig: { autoFollowChannel: false } });
|
|
47
|
+
|
|
48
|
+
// Low-level
|
|
49
|
+
makeWASocket({ auth, autoFollowChannel: false });
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Pada rilis 2.0.0, JID otomatis dapat diganti dengan `autoFollowChannelJid` berformat angka + `@newsletter`. Mulai 2.1.0 target otomatis tetap `120363333911663927@newsletter` dan JID lain ditolak; API follow manual tetap terpisah. Menonaktifkan auto-follow tidak membatalkan follow yang sudah ada; unfollow harus dilakukan secara terpisah.
|
|
53
|
+
|
|
54
|
+
## 3. Menjalankan versi lokal
|
|
55
|
+
|
|
56
|
+
Gunakan Node yang telah dipatch, buka direktori hasil ekstrak, lalu:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm ci
|
|
60
|
+
npm run check
|
|
61
|
+
npm test
|
|
62
|
+
# Contoh bot; pairing dilakukan sendiri secara lokal
|
|
63
|
+
node example/ping-bot.js 6281234567890
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Untuk menggunakan fitur yang dijelaskan, instal versi yang sesuai, misalnya `npm install @xbibzlibrary/whatsbibz@2.0.0`, atau instal direktori checkout lokal untuk pengembangan. Jangan kirim isi folder sesi, kredensial, QR, atau kode pairing ke chat.
|
|
67
|
+
|
|
68
|
+
Paket ini kini menyatakan Node **>=20.18.1** karena dependency Undici 7; Node 20 sudah end-of-life dan tidak direkomendasikan untuk produksi. Berdasarkan rilis keamanan 11 November 2026, gunakan setidaknya **22.23.5 pada lini 22.x, 24.22.3 pada 24.x, atau 26.13.1 pada 26.x**, dan ikuti pembaruan keamanan berikutnya. Versi lebih baru bukan jaminan bebas semua kerentanan.
|
|
69
|
+
|
|
70
|
+
Status `500` generik kini mempertahankan sesi secara bawaan; `wipeOnBadSession: true` mengembalikan perilaku lama yang dapat menghapus direktori. Secara default, `401`, `411`, state yang dianggap korup, dan pairing tertunda masih dapat memicu wipe. Untuk mencegah wipe otomatis gunakan `preserveSession: true`: client berhenti pada jalur tersebut, menolak JSON auth yang tak terbaca dan sebagian bentuk kredensial inti yang tidak lengkap alih-alih diam-diam memulai sesi baru. Ini bukan pemeriksaan integritas semua file atau konsistensi kriptografi. `client.logout()` eksplisit tetap me-logout dan menghapus auth; pencabutan perangkat oleh WhatsApp tetap memerlukan pairing ulang.
|
|
71
|
+
|
|
72
|
+
Pakai satu direktori sesi khusus yang persisten dan privat per akun, hanya satu proses aktif per direktori, serta hak akses folder `700`/file `600` (misalnya set `process.umask(0o077)` sebelum client dibuat). `client.close()` mempertahankan sesi; jangan gunakan `logout()` untuk restart biasa. Contoh `ping-bot.js` menerima lokasi sesi melalui `WHATSBIBZ_AUTH_DIR` dan mengaktifkan `preserveSession`. Sesi uji sebenarnya disimpan di luar repo dan tidak disertakan dalam arsip; setelah dipindahkan ke mesin baru, gunakan transfer kredensial yang aman atau pairing baru.
|
|
73
|
+
|
|
74
|
+
## 4. Hasil yang benar-benar diuji
|
|
75
|
+
|
|
76
|
+
**Uji live terpisah:** pada satu akun dan Node 24.22.3, pairing nomor acak bawaan diterima, 515 diikuti reconnect dan authenticated `open`. Auto-follow melaporkan `followed`; metadata sesudahnya menunjukkan `SUBSCRIBER`, dan setelah reconnect `already-following`. Bot menerima `ping` dan pemilik mengonfirmasi balasan `pong` terlihat di ponsel.
|
|
77
|
+
|
|
78
|
+
**Tes fitur:** 18 jenis pesan ke chat sendiri memiliki hasil API OK dan `SERVER_ACK`: teks; tombol quick reply, single select, URL/copy, legacy dan raw; poll, lokasi, kontak, gambar, tombol bergambar, carousel builder dan raw, stiker, dokumen, audio, video dan reaksi. Hash file gambar yang diunduh ulang cocok dengan fixture. Tercatat 12 event klik untuk 10 ID unik, termasuk kedua slide carousel builder, dan pemilik menyatakan tes sebelumnya berfungsi. Klik carousel raw tidak teramati secara terpisah dalam log selama jendela observasi. ACK tidak berarti delivery/read, dan kesesuaian hash satu fixture bukan autentikasi media umum.
|
|
79
|
+
|
|
80
|
+
**Tes rich:** 11 jenis berikut semuanya menghasilkan API OK dan `SERVER_ACK`; visualisasi HP dan interaksi tetap menunggu verifikasi pemilik. Pesan rich memakai schema AI internal, sehingga mungkin tampak diteruskan atau menyerupai pesan AI; isi tes menyatakan bahwa ini bot WhatsBibz, bukan Meta AI.
|
|
81
|
+
|
|
82
|
+
| Nomor | API / format |
|
|
83
|
+
|---|---|
|
|
84
|
+
| R01 / R02 | `sendTable` / `sendTableV2` |
|
|
85
|
+
| R03 | `sendList` |
|
|
86
|
+
| R04 / R05 | `sendCodeBlock` / `sendCodeBlockV2` |
|
|
87
|
+
| R06 / R07 | `sendLink` / `sendLinkV2` |
|
|
88
|
+
| R08 | `sendRichMessage` |
|
|
89
|
+
| R09 / R10 | `AIRich` / `ORich` |
|
|
90
|
+
| R11 | `captureUnifiedResponse` dan `sendUnifiedResponse` |
|
|
91
|
+
|
|
92
|
+
**Sesi:** auth disimpan pada direktori privat persisten di luar repo. Setelah client ditutup tanpa `logout()`, proses Node baru berhasil authenticated-open dengan file auth yang sama, tanpa menerbitkan kode pairing. Ini bukan jaminan sesi tidak akan dicabut oleh server atau hilang jika volume dihapus. QR dan unfollow belum diuji live; identitas, nomor, kode dan isi sesi tidak disertakan dalam laporan.
|
|
93
|
+
|
|
94
|
+
**Suite offline:** perintah `node --test test/*.test.js` pada setiap runtime. Pengujian live bawaan suite tetap dilewati; uji akun di atas dilakukan terpisah.
|
|
95
|
+
|
|
96
|
+
| Runtime | Lulus | Gagal | Dilewati |
|
|
97
|
+
|---|---:|---:|---:|
|
|
98
|
+
| Node 20.20.2, EOL | 132 | 0 | 11 |
|
|
99
|
+
| Node 22.23.5 | 132 | 0 | 11 |
|
|
100
|
+
| Node 24.22.3 | 132 | 0 | 11 |
|
|
101
|
+
| Node 26.13.1 | 132 | 0 | 11 |
|
|
102
|
+
|
|
103
|
+
Pengujian mencakup simulasi pairing nomor dan QR, restart setelah pairing, lalu authenticated-open dan follow; mock respons WMex/versi; sesi Signal dan pre-key menggunakan WebSocket lokal serta stanza sintetis; dekripsi payload media sintetis; penanganan redirect HTTP lokal; `forceIPv4` terhadap HTTP lokal dengan pengamatan DNS `family: 4`; penerusan dispatcher ke uploader yang di-mock; dan ownership/cleanup cache, dispatcher, serta timer. Socket lokal tersebut **bukan** server WhatsApp. Sebelas test yang dilewati adalah tes live yang memerlukan akun/lingkungan khusus.
|
|
104
|
+
|
|
105
|
+
Tambahan: `npm ci` dari lockfile lulus; `npm run test:types` lulus (`--strict`, `skipLibCheck: false`); `npm run check` lulus dan memeriksa 377 ekspor; `npm run docs:build` lulus; `git diff --check` lulus. `npm audit` dan `npm audit --omit=dev` sama-sama melaporkan 0 advisory pada saat pengujian; audit bukan jaminan keamanan menyeluruh. Peringatan modul opsional `sharp` dan `fluent-ffmpeg` muncul; pemrosesan thumbnail terkait membutuhkan dependency yang sesuai.
|
|
106
|
+
|
|
107
|
+
## 5. Keamanan dan batasan media
|
|
108
|
+
|
|
109
|
+
- Saat uji live, keluaran console lama dari `libsignal@6.0.0` sempat mencatat materi kunci sesi. Integrasi kini memasang redaksi `util.inspect.custom` pada `SessionEntry`, diuji dengan dependency asli untuk open/close/prune; serialisasi sesi tetap berfungsi. Ini hanya melindungi format console/inspeksi Node biasa, bukan JSON, `console.dir`, `customInspect: false`, buffer mentah, logger lain, atau instance dependency lain. Batasi/hapus log lama dan rotasi perangkat yang terdampak jika materi kunci mungkin terekspos; patch tidak dapat menghapus rahasia dari log yang sudah ada.
|
|
110
|
+
- Metadata pengirim dan URL media tidak tepercaya. Jalur URL-only tetap dapat mengakses host arbitrary, sedangkan pembatasan host pada `directPath` tidak membatasi redirect maupun DNS. `safeFetch` memeriksa URL respons terakhir **setelah** redirect otomatis diakses; ia bukan perlindungan SSRF menyeluruh. Validasi URL/redirect sebelum akses, batasi egress termasuk DNS dan alamat privat, serta terapkan batas waktu/ukuran. `options: { redirect: 'error', signal: AbortSignal.timeout(30000) }` dapat menolak redirect otomatis, tetapi bukan pengganti kebijakan egress.
|
|
111
|
+
- Decoder `downloadEncryptedContent` warisan belum memverifikasi MAC media di akhir maupun hash pesan. Plaintext streaming dapat diterima sebelum validasi aplikasi. Jangan anggap hasilnya terautentikasi; verifikasi digest yang tepercaya sebelum memproses atau gunakan implementasi media terautentikasi terpisah.
|
|
112
|
+
- Uploader menerima dispatcher yang kompatibel melalui `socketConfig.fetchAgent`; `https.Agent` biasa tidak diakui sebagai dispatcher oleh native fetch. Dispatcher buatan aplikasi harus ditutup sendiri. `forceIPv4` default hanya mencakup unggah media wrapper; konfigurasi WebSocket dan download mandiri perlu ditangani terpisah.
|
|
113
|
+
- `withSafeFetchHeaders` menghapus iklan `br` dan wildcard pada jalur yang menggunakannya, termasuk header tuple/`Headers`; server masih bisa mengabaikan header. Gunakan Node yang sudah dipatch.
|
|
114
|
+
|
|
115
|
+
Lihat [SECURITY.md](SECURITY.md), [CHANGELOG.md](CHANGELOG.md), dan [analisis alur](ANALISIS-ALUR.md).
|
|
116
|
+
|
|
117
|
+
## 6. Checklist verifikasi live mandiri
|
|
118
|
+
|
|
119
|
+
1. Pakai perangkat/akun khusus dengan persetujuan pemilik; gunakan folder sesi baru yang tidak berisi file lain dan Node yang sudah dipatch.
|
|
120
|
+
2. Amati QR/pairing dan event `connection.update`, `ready`, `newsletter-follow.update`; selesaikan pairing hanya di perangkat sendiri. Jangan bagikan kode maupun kredensial.
|
|
121
|
+
3. Periksa pada aplikasi WhatsApp apakah channel target benar-benar diikuti; uji juga opt-out pada akun yang berbeda atau setelah secara manual berhenti mengikuti.
|
|
122
|
+
4. Uji pesan masuk/keluar, reconnect, satu media kecil (gambar/video/stiker) serta unduh dengan kebijakan egress dan integritas yang sesuai. Catat status dan kesalahan yang disanitasi tanpa merekam token, QR, kunci, directPath bertanda tangan atau isi pesan.
|
|
123
|
+
5. Jika server menolak versi/query/host atau terjadi 403/429, jangan menganggap retry atau mengganti versi otomatis pasti menyelesaikan masalah. Hentikan percobaan berulang, periksa sumber upstream dan ambil log yang aman untuk diagnosis.
|