Public-Domain-Guard (icloud.com/gmail.com etc. nie blockbar/veröffentlichbar): - neue utils/public-email-domains.ts (shared Freemail-Liste) - custom-domains/index.post + custom-domains/suggest + curated-domains/suggest lehnen Public-Domains mit 400 PUBLIC_DOMAIN ab (defense-in-depth) Mail-Detection (mo): "spins" zu GAMBLING_KEYWORDS + Subject-%-Pattern (Score 10) → fängt "Spins + 400% Bonus"-Spam von Freemail-Absendern. 61/61 Tests grün. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
74 lines
2.4 KiB
JavaScript
74 lines
2.4 KiB
JavaScript
/**
|
|
* Single-Source-of-Truth für Gambling-Keyword-Detection.
|
|
*
|
|
* Importiert von:
|
|
* - server/api/mail/scan.post.ts
|
|
* - server/api/mail/scan-internal.post.ts
|
|
* - imap-proxy/session.mjs
|
|
* - imap-idle/index.mjs
|
|
*
|
|
* Mo's DSGVO-Finding #4: vorher in 4 Files dupliziert → Drift-Risk.
|
|
*/
|
|
|
|
export const GAMBLING_KEYWORDS = [
|
|
// Major Anbieter
|
|
"casino", "bet365", "bwin", "tipico", "unibet", "betway", "888casino",
|
|
"pokerstars", "interwetten", "netbet", "leovegas", "mrgreen", "mr green",
|
|
"betsson", "neobet", "mybet", "lottoland", "betano", "william hill",
|
|
"paddypower", "betfair", "stake", "rolletto", "vbet", "1xbet", "melbet",
|
|
"mostbet", "luckyvibe", "lucky vibe", "spinz", "casinoly", "rabona",
|
|
"justcasino", "getslots", "rocketplay", "fresh casino", "freshcasino",
|
|
"nom nom",
|
|
|
|
// Generic Begriffe
|
|
"sportwetten", "jackpot", "freispiel", "free spin", "bonus code",
|
|
"auszahlung", "glücksspiel", "slots", "roulette", "spins",
|
|
|
|
// ⚠️ Risk: matcht auch unschuldige Wörter (Mo's Finding #5)
|
|
// TODO Whitelist: "wette" matcht "wettervorhersage" → False-Positive
|
|
// siehe gambling-whitelist.mjs (TODO)
|
|
"wette",
|
|
];
|
|
|
|
/**
|
|
* Whitelist — Begriffe die NICHT als Gambling gelten dürfen.
|
|
* Bei Match in GAMBLING_KEYWORDS, vor Block prüfen ob in Whitelist.
|
|
*
|
|
* TODO Mo's Finding #5: ausführen Mail-Whitelist-Check vor Auto-Delete.
|
|
*/
|
|
export const GAMBLING_WHITELIST = [
|
|
"wettervorhersage",
|
|
"wetter",
|
|
"wetterbericht",
|
|
"wettkampf", // kein Glücksspiel
|
|
"wettbewerb", // dito
|
|
// Recovery-/Anti-Gambling-Compounds mit "sucht"-Suffix.
|
|
// Ergänzung zu Sucht-Compound-Regel in mail-classifier.ts:
|
|
// Regel deckt Fälle wo keyword als exaktes Präfix vorkommt (glücksspiel→glücksspielsucht).
|
|
// "wettsucht" kann nicht via concat-Regel abgedeckt werden (kw="wette" ≠ "wett"),
|
|
// daher Whitelist als Fallback für Stamm-Varianten.
|
|
"wettsucht",
|
|
"spielsucht",
|
|
"suchtberatung",
|
|
"suchthilfe",
|
|
];
|
|
|
|
/**
|
|
* Helper: prüft ob ein Text Gambling-Keywords enthält, mit Whitelist-Check.
|
|
*/
|
|
export function isGamblingText(text) {
|
|
if (!text) return false;
|
|
const lower = text.toLowerCase();
|
|
|
|
// Erst Whitelist — wenn matched, kein Gambling
|
|
for (const w of GAMBLING_WHITELIST) {
|
|
if (lower.includes(w)) return false;
|
|
}
|
|
|
|
// Dann Gambling-Keywords
|
|
for (const kw of GAMBLING_KEYWORDS) {
|
|
if (lower.includes(kw)) return true;
|
|
}
|
|
return false;
|
|
}
|