
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
safety-safe
Advanced tools
Firewall cerdas untuk Bot WhatsApp untuk mendeteksi dan memfilter pesan bug/crash/spam (Baileys).
Firewall Cerdas buat Bot WhatsApp Lu.
Bot lu sering crash atau nge-lag parah gara-gara dikirimin pesan aneh? Sering mati total diserang orang iseng? Tenang, safety-safe ini gue bikin buat jadi tameng bot lu. Ini firewall super ringan yang bakal nyaring semua pesan masuk dari berbagai macem bug, spam, atau pesan perusak lainnya.
dokumen dan lokasi yang paling sering bikin aplikasi WhatsApp crash.node_modules lu jadi bengkak. Fokusnya cuma satu: keamanan.@whiskeysockets/baileys.Gak pake ribet, cukup satu baris di terminal lu:
npm install safety-safe
Gini, safety-safe itu ibarat alarm mobil. Tugasnya cuma teriak sekenceng-kencengnya kalo ada maling (isMalicious: true). Dia gak bertugas buat nangkep malingnya. Nah, lu sebagai pemilik mobil (bot), yang mutusin mau ngapain: mau ngejar malingnya, mau nelpon polisi, atau mau cuekin aja.
Pemisahan tugas ini bikin safety-safe tetep enteng dan ngasih lu kontrol penuh buat nentuin aksi apa yang paling pas buat bot lu.
Ini contoh paling umum. Kalo ada pesan bahaya, kita langsung hapus pesannya, blokir pengirimnya, dan lapor ke nomor admin (nomor lu sendiri).
import { makeWASocket } from '@whiskeysockets/baileys';
import { analyzeMessage } from 'safety-safe';
// 1. Setup client Baileys lu kayak biasa
const client = makeWASocket({ /* ...konfigurasi lu di sini */ });
const myNumber = "6281234567890"; // Ganti pake nomor admin/owner
// 2. Terapkan di dalam event 'messages.upsert'
client.ev.on('messages.upsert', async (m) => {
const msg = m.messages;
// Cek dasar, abaikan kalo pesan gak valid, dari diri sendiri, atau dari grup
if (!msg.message || msg.key.fromMe || msg.key.remoteJid.endsWith('@g.us')) {
return;
}
// 3. Analisis pesannya pake safety-safe
const { isMalicious, reason, severity } = analyzeMessage(msg.message);
// 4. Kalo ternyata berbahaya, ambil tindakan!
if (isMalicious) {
console.log(`[!] Ancaman Terdeteksi dari ${msg.pushName} (${msg.key.remoteJid})`);
console.log(` Alasan: ${reason} | Level Bahaya: ${severity}`);
try {
// CONTOH AKSI: Hapus pesan, blokir, dan lapor ke Admin
await client.sendMessage(msg.key.remoteJid, { delete: msg.key });
await client.updateBlockStatus(msg.key.remoteJid, "block");
await client.sendMessage(`${myNumber}@s.whatsapp.net`, {
text: `🔒 User *${msg.pushName}* (${msg.key.remoteJid}) udah gue blokir otomatis.\nAlasan: *${reason}*.`
});
} catch (err) {
console.error('[!] Gagal ngambil tindakan blokir/hapus:', err);
}
return; // Penting: Hentikan pemrosesan pesan ini lebih lanjut
}
// Kalo pesan aman, lanjutkan logika bot normal lu di sini...
console.log(`[+] Pesan aman dari ${msg.pushName}`);
// ...
});
Lu bisa atur sendiri "tingkat kesabaran" bot lu. Cukup kasih objek konfigurasi di argumen kedua. Gampang kan?
import { analyzeMessage } from 'safety-safe';
// Aturan custom yang lebih ketat dari default
const myRules = {
maxTextLength: 4096,
maxMentions: 25
};
const { isMalicious } = analyzeMessage(msg.message, myRules);
Daftar Konfigurasi Lengkap:
| Opsi | Default | Deskripsi |
|---|---|---|
maxTextLength | 10000 | Panjang teks/caption maksimal yang diizinkan. |
maxMentions | 100 | Jumlah mention maksimal dalam satu pesan. |
maxFileLength | 2147483648 (2 GB) | Ukuran file (dalam byte) maksimal yang tertera di properti pesan. |
maxPageCount | 10000 | Jumlah halaman maksimal di properti dokumen. |
maxCharacterFlood | 20000 | Jumlah karakter maksimal di pesan interaktif (buat nangkal bug flood). |
Fungsi analyzeMessage ngasih lu objek berisi info penting:
| Properti | Tipe | Penjelasan |
|---|---|---|
isMalicious | boolean | true kalo berbahaya, false kalo aman. Ini yang paling penting. |
reason | string | Alasan kenapa pesan ditandai berbahaya. |
severity | string | Tingkat bahayanya: CRITICAL, HIGH, atau MEDIUM. |
threatType | string | Jenis ancamannya: CRASH, LAG, atau SPAM. |
fileLength, pageCount)Nemuin bug baru yang lolos? Atau punya ide buat bikin ini lebih GG? Langsung aja buka Issue atau kirim Pull Request di GitHub. Bantuan dari lu sangat gue hargai!
Proyek ini pake Lisensi MIT. Santai aja pakenya.
FAQs
Firewall cerdas untuk Bot WhatsApp untuk mendeteksi dan memfilter pesan bug/crash/spam (Baileys).
We found that safety-safe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.