Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): cap the bulk-recipients file pick before reading
Yudhi Armyndharisa510ed9d657d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 8a3100cca..17e47bc0d 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -51,6 +51,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0- The `:main` and sha Docker images rebuild the production stage's apt layer on every build insteadof serving it from cache, so a branch image cannot ship OS packages that Debian has since patched.The release path already worked this way, after a cached layer shipped stale chromium twice.+- The Message Tester's bulk-recipients file picker refuses files over 2 MB before reading them.## [0.23.4] - 2026-09-05diff --git a/dashboard/src/i18n/locales/ar.json b/dashboard/src/i18n/locales/ar.jsonindex 7996aa204..c1e5afc88 100644--- a/dashboard/src/i18n/locales/ar.json+++ b/dashboard/src/i18n/locales/ar.json@@ -674,6 +674,7 @@"removeFile": "إزالة الملف","fileReadError": "فشل قراءة الملف","fileTooLarge": "الملف كبير جدًا (الحد الأقصى 18 ميغابايت)",+ "recipientsFileTooLarge": "ملف المستلمين كبير جدًا (الحد الأقصى 2 ميغابايت)","caption": "التعليق","filename": "اسم الملف","captionPlaceholder": "أدخل التعليق...",diff --git a/dashboard/src/i18n/locales/de.json b/dashboard/src/i18n/locales/de.jsonindex 022352286..dcaa73d14 100644--- a/dashboard/src/i18n/locales/de.json+++ b/dashboard/src/i18n/locales/de.json@@ -659,6 +659,7 @@"removeFile": "Datei entfernen","fileReadError": "Datei konnte nicht gelesen werden","fileTooLarge": "Die Datei ist zu groß (max. 18 MB)",+ "recipientsFileTooLarge": "Die Empfängerdatei ist zu groß (max. 2 MB)","caption": "Beschriftung","filename": "Dateiname","captionPlaceholder": "Beschriftung eingeben...",diff --git a/dashboard/src/i18n/locales/en.json b/dashboard/src/i18n/locales/en.jsonindex 776816e99..7eb9b5768 100644--- a/dashboard/src/i18n/locales/en.json+++ b/dashboard/src/i18n/locales/en.json@@ -659,6 +659,7 @@"removeFile": "Remove file","fileReadError": "File read failed","fileTooLarge": "File is too large (max 18 MB)",+ "recipientsFileTooLarge": "The recipients file is too large (max 2 MB)","caption": "Caption","filename": "Filename","captionPlaceholder": "Enter caption...",diff --git a/dashboard/src/i18n/locales/es.json b/dashboard/src/i18n/locales/es.jsonindex d17dbe294..6bbf1b00c 100644--- a/dashboard/src/i18n/locales/es.json+++ b/dashboard/src/i18n/locales/es.json@@ -613,6 +613,7 @@"removeFile": "Quitar archivo","fileReadError": "Error al leer el archivo","fileTooLarge": "El archivo es demasiado grande (máx. 18 MB)",+ "recipientsFileTooLarge": "El archivo de destinatarios es demasiado grande (máx. 2 MB)","caption": "Pie de foto","filename": "Nombre de archivo","captionPlaceholder": "Escribe un pie de foto...",diff --git a/dashboard/src/i18n/locales/fr.json b/dashboard/src/i18n/locales/fr.jsonindex 915190835..544f3439b 100644--- a/dashboard/src/i18n/locales/fr.json+++ b/dashboard/src/i18n/locales/fr.json@@ -659,6 +659,7 @@"removeFile": "Supprimer le fichier","fileReadError": "Échec de lecture du fichier","fileTooLarge": "Le fichier est trop volumineux (max 18 Mo)",+ "recipientsFileTooLarge": "Le fichier de destinataires est trop volumineux (max 2 Mo)","caption": "Légende","filename": "Nom du fichier","captionPlaceholder": "Entrez une légende...",diff --git a/dashboard/src/i18n/locales/he.json b/dashboard/src/i18n/locales/he.jsonindex d3a1d4590..f29b786d1 100644--- a/dashboard/src/i18n/locales/he.json+++ b/dashboard/src/i18n/locales/he.json@@ -668,6 +668,7 @@"removeFile": "הסרת קובץ","fileReadError": "קריאת הקובץ נכשלה","fileTooLarge": "הקובץ גדול מדי (מקסימום 18 MB)",+ "recipientsFileTooLarge": "קובץ הנמענים גדול מדי (מקסימום 2 MB)","caption": "כיתוב","filename": "שם קובץ","captionPlaceholder": "יש להזין כיתוב...",diff --git a/dashboard/src/i18n/locales/it.json b/dashboard/src/i18n/locales/it.jsonindex 18b17e497..d6748d516 100644--- a/dashboard/src/i18n/locales/it.json+++ b/dashboard/src/i18n/locales/it.json@@ -659,6 +659,7 @@"removeFile": "Rimuovi file","fileReadError": "Lettura del file non riuscita","fileTooLarge": "Il file è troppo grande (max 18 MB)",+ "recipientsFileTooLarge": "Il file dei destinatari è troppo grande (max 2 MB)","caption": "Didascalia","filename": "Nome File","captionPlaceholder": "Inserisci una didascalia...",diff --git a/dashboard/src/i18n/locales/ko.json b/dashboard/src/i18n/locales/ko.jsonindex 4b0853d3a..1bdc37b00 100644--- a/dashboard/src/i18n/locales/ko.json+++ b/dashboard/src/i18n/locales/ko.json@@ -659,6 +659,7 @@"removeFile": "파일 제거","fileReadError": "파일 읽기 실패","fileTooLarge": "파일이 너무 큽니다 (최대 18 MB)",+ "recipientsFileTooLarge": "수신자 파일이 너무 큽니다 (최대 2 MB)","caption": "설명","filename": "파일 이름","captionPlaceholder": "설명을 입력하세요...",diff --git a/dashboard/src/i18n/locales/pt-BR.json b/dashboard/src/i18n/locales/pt-BR.jsonindex 2ea1c60a6..2a469cf1d 100644--- a/dashboard/src/i18n/locales/pt-BR.json+++ b/dashboard/src/i18n/locales/pt-BR.json@@ -613,6 +613,7 @@"removeFile": "Remover arquivo","fileReadError": "Falha ao ler o arquivo","fileTooLarge": "O arquivo é muito grande (máx. 18 MB)",+ "recipientsFileTooLarge": "O arquivo de destinatários é muito grande (máx. 2 MB)","caption": "Legenda","filename": "Nome do arquivo","captionPlaceholder": "Digite uma legenda...",diff --git a/dashboard/src/i18n/locales/te.json b/dashboard/src/i18n/locales/te.jsonindex 0d3eef534..ab2ee6b7a 100644--- a/dashboard/src/i18n/locales/te.json+++ b/dashboard/src/i18n/locales/te.json@@ -659,6 +659,7 @@"removeFile": "ఫైల్ను తొలగించు","fileReadError": "ఫైల్ చదవడం విఫలమైంది","fileTooLarge": "ఫైల్ చాలా పెద్దది (గరిష్టం 18 MB)",+ "recipientsFileTooLarge": "గ్రహీతల ఫైల్ చాలా పెద్దది (గరిష్టం 2 MB)","caption": "క్యాప్షన్","filename": "ఫైల్ పేరు","captionPlaceholder": "క్యాప్షన్ ఎంటర్ చేయండి...",diff --git a/dashboard/src/i18n/locales/tr.json b/dashboard/src/i18n/locales/tr.jsonindex fa60b67ea..f862c97ba 100644--- a/dashboard/src/i18n/locales/tr.json+++ b/dashboard/src/i18n/locales/tr.json@@ -659,6 +659,7 @@"removeFile": "Dosyayı kaldır","fileReadError": "Dosya okunamadı","fileTooLarge": "Dosya çok büyük (maks 18 MB)",+ "recipientsFileTooLarge": "Alıcı dosyası çok büyük (maks 2 MB)","caption": "Açıklama","filename": "Dosya Adı","captionPlaceholder": "Açıklama girin...",diff --git a/dashboard/src/i18n/locales/zh-CN.json b/dashboard/src/i18n/locales/zh-CN.jsonindex e98b97411..7d9a658e7 100644--- a/dashboard/src/i18n/locales/zh-CN.json+++ b/dashboard/src/i18n/locales/zh-CN.json@@ -659,6 +659,7 @@"removeFile": "移除文件","fileReadError": "文件读取失败","fileTooLarge": "文件过大(最大 18 MB)",+ "recipientsFileTooLarge": "收件人文件过大(最大 2 MB)","caption": "说明文字","filename": "文件名","captionPlaceholder": "输入说明文字...",diff --git a/dashboard/src/i18n/locales/zh-HK.json b/dashboard/src/i18n/locales/zh-HK.jsonindex 4481ffa7e..006375988 100644--- a/dashboard/src/i18n/locales/zh-HK.json+++ b/dashboard/src/i18n/locales/zh-HK.json@@ -659,6 +659,7 @@"removeFile": "移除檔案","fileReadError": "檔案讀取失敗","fileTooLarge": "檔案過大(最大 18 MB)",+ "recipientsFileTooLarge": "收件人檔案過大(最大 2 MB)","caption": "說明文字","filename": "檔案名稱","captionPlaceholder": "輸入說明文字...",diff --git a/dashboard/src/pages/MessageTester.tsx b/dashboard/src/pages/MessageTester.tsxindex 84319db4a..1930787f9 100644--- a/dashboard/src/pages/MessageTester.tsx+++ b/dashboard/src/pages/MessageTester.tsx@@ -12,7 +12,7 @@ import {import { useDocumentTitle } from '../hooks/useDocumentTitle';import { useRole } from '../hooks/useRole';import { useSessionsQuery, useSessionGroupsQuery } from '../hooks/queries';-import { parseBulkRecipients, BULK_MAX_RECIPIENTS } from '../utils/bulkRecipients';+import { parseBulkRecipients, BULK_MAX_RECIPIENTS, BULK_RECIPIENTS_FILE_MAX_BYTES } from '../utils/bulkRecipients';import { PageHeader } from '../components/PageHeader';import './MessageTester.css';@@ -194,6 +194,16 @@ export function MessageTester() {const file = e.target.files?.[0];e.target.value = '';if (!file) return;+ // Reject before reading, mirroring the media pick above: FileReader would materialize the whole+ // file as a string before any backend cap could weigh in.+ if (file.size > BULK_RECIPIENTS_FILE_MAX_BYTES) {+ setResponse({+ success: false,+ timestamp: new Date().toISOString(),+ error: t('messageTester.recipientsFileTooLarge'),+ });+ return;+ }const reader = new FileReader();reader.onload = () => {diff --git a/dashboard/src/utils/bulkRecipients.ts b/dashboard/src/utils/bulkRecipients.tsindex f8763a04e..436e7ec93 100644--- a/dashboard/src/utils/bulkRecipients.ts+++ b/dashboard/src/utils/bulkRecipients.ts@@ -1,6 +1,12 @@// The backend caps a bulk batch at 100 messages (ArrayMaxSize on SendBulkMessageDto).export const BULK_MAX_RECIPIENTS = 100;+// Pre-read cap for the recipients file picker. A phone list is bytes, not media: 2 MiB is roughly+// 100k entries, far past the batch cap, while still stopping a mistaken multi-hundred-MB pick from+// being materialized as a JS string before the textarea ever sees it (same shape as the media+// upload's pre-read check in MessageTester).+export const BULK_RECIPIENTS_FILE_MAX_BYTES = 2 * 1024 * 1024;+/*** Parse the bulk-recipients textarea into chat IDs: trims whitespace, drops blanks, de-dupes, and* normalizes bare phone numbers to `<digits>@c.us`. An entry containing '@' is treated as a full