fix(whatsapp): log allowlist drops in bridge

This commit is contained in:
helix4u 2026-04-13 15:07:37 -06:00 committed by kshitij
parent 7c10761dd2
commit 3ade655999

View file

@ -26,7 +26,7 @@ import path from 'path';
import { mkdirSync, readFileSync, writeFileSync, existsSync, readdirSync } from 'fs';
import { randomBytes } from 'crypto';
import qrcode from 'qrcode-terminal';
import { matchesAllowedUser, parseAllowedUsers } from './allowlist.js';
import { expandWhatsAppIdentifiers, matchesAllowedUser, parseAllowedUsers } from './allowlist.js';
// Parse CLI args
const args = process.argv.slice(2);
@ -229,6 +229,15 @@ async function startSocket() {
// Check allowlist for messages from others (resolve LID ↔ phone aliases)
if (!msg.key.fromMe && !matchesAllowedUser(senderId, ALLOWED_USERS, SESSION_DIR)) {
try {
console.log(JSON.stringify({
event: 'ignored',
reason: 'allowlist_mismatch',
chatId,
senderId,
senderAliases: Array.from(expandWhatsAppIdentifiers(senderId, SESSION_DIR)),
}));
} catch {}
continue;
}