muaddib-scanner 2.11.156 → 2.11.157
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/package.json
CHANGED
package/src/monitor/webhook.js
CHANGED
|
@@ -270,11 +270,30 @@ function buildBurstPreAlertEmbed(name, count, ecosystem = 'npm') {
|
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
+
/**
|
|
274
|
+
* Burst pre-alert Discord toggle — OFF by default. Measured 2026-07: the burst
|
|
275
|
+
* heads-up fires ~700×/day and is anti-correlated with real kills/incidents, so it is
|
|
276
|
+
* pure #alerts noise. This gates ONLY the Discord POST in sendBurstPreAlert(): the
|
|
277
|
+
* burst versions are still queued + scanned (queue.js), and the `[MONITOR] BURST
|
|
278
|
+
* PRE-ALERT` console.log + the `stats.burstPreAlerts` counter (used by the daily
|
|
279
|
+
* summary) are emitted BEFORE the send at the call site, so they are unaffected.
|
|
280
|
+
* Opt back in with MUADDIB_BURST_PREALERT_WEBHOOK=1 (also accepts true/yes/on).
|
|
281
|
+
* Read at call time so a restart re-toggles it without a code change (and tests can flip it).
|
|
282
|
+
*/
|
|
283
|
+
function burstPreAlertWebhookEnabled() {
|
|
284
|
+
const v = (process.env.MUADDIB_BURST_PREALERT_WEBHOOK || '').trim().toLowerCase();
|
|
285
|
+
return v === '1' || v === 'true' || v === 'yes' || v === 'on';
|
|
286
|
+
}
|
|
287
|
+
|
|
273
288
|
/**
|
|
274
289
|
* Layer 1c: Send a burst pre-alert webhook. Fire-and-forget; callers dedupe per
|
|
275
|
-
* name/window so a burst pings once, not once per version.
|
|
290
|
+
* name/window so a burst pings once, not once per version. Discord POST is muted by
|
|
291
|
+
* default — see burstPreAlertWebhookEnabled(). Scoped to this sender only; the shared
|
|
292
|
+
* sendWebhook() and every other alert type (IOC/campaign pre-alerts, scan results,
|
|
293
|
+
* DEGRADED, daily report) are untouched.
|
|
276
294
|
*/
|
|
277
295
|
async function sendBurstPreAlert(name, count, ecosystem = 'npm') {
|
|
296
|
+
if (!burstPreAlertWebhookEnabled()) return;
|
|
278
297
|
const url = getWebhookUrl();
|
|
279
298
|
if (!url) return;
|
|
280
299
|
await sendWebhook(url, buildBurstPreAlertEmbed(name, count, ecosystem), { rawPayload: true });
|
|
@@ -1739,6 +1758,7 @@ module.exports = {
|
|
|
1739
1758
|
sendCampaignPreAlert,
|
|
1740
1759
|
buildBurstPreAlertEmbed,
|
|
1741
1760
|
sendBurstPreAlert,
|
|
1761
|
+
burstPreAlertWebhookEnabled,
|
|
1742
1762
|
matchVersionedIOC,
|
|
1743
1763
|
computeRiskLevel,
|
|
1744
1764
|
computeRiskScore,
|