Skip to content

Commit 487d7fd

Browse files
Add files via upload
1 parent b7d18d8 commit 487d7fd

1 file changed

Lines changed: 30 additions & 5 deletions

File tree

.github/workflows/update_confidence_blacklist.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,36 @@ jobs:
193193
# combined_threat_blacklist_ipv4.txt wird bereits beim Schreiben in
194194
# update_combined_blacklist mit is_protected_entry() gefiltert →
195195
# erneute Prüfung hier wäre 502 Netzwerk-Checks × 4,5M IPs ≈ 10 Min Zeitverschwendung.
196-
with open(BLACKLIST) as f:
197-
combined_ips = {
198-
s for line in f if (s := line.strip()) and not s.startswith("#")
199-
}
200-
print(f"Combined Blacklist: {len(combined_ips)} IPs")
196+
#
197+
# FIX BUG-TRUNCATE-PARTS: Sobald die Vollliste >= 100 MB GitHub-Push-
198+
# Limit erreicht, schreibt update_combined_blacklist die Hauptdatei
199+
# truncatiert (nur die ersten N IPs) und verteilt die vollstaendige
200+
# Liste auf combined_threat_blacklist_ipv4_part*.txt. Wenn wir hier
201+
# nur die Hauptdatei lesen, verlieren IPs die ausschliesslich in den
202+
# Parts stehen ihren Confidence-Score und landen weder in
203+
# blacklist_confidence40 noch in der Watchlist – obwohl sie in
204+
# seen_db vorhanden sind.
205+
# Loesung: Hauptdatei + alle Parts einlesen, dedupen via set-Update.
206+
# Das ist auch unter Schwelle (Parts existieren nicht) safe – glob
207+
# matcht dann nichts. Solange Combined unter SPLIT_THRESHOLD bleibt,
208+
# ist die Hauptdatei ohnehin vollstaendig und der Loop ist ein No-Op.
209+
import glob as _glob
210+
combined_ips = set()
211+
_sources_read = [BLACKLIST] + sorted(
212+
_glob.glob("combined_threat_blacklist_ipv4_part*.txt"))
213+
for _src in _sources_read:
214+
if not os.path.exists(_src):
215+
continue
216+
with open(_src) as f:
217+
for line in f:
218+
s = line.strip()
219+
if s and not s.startswith("#"):
220+
combined_ips.add(s)
221+
if len(_sources_read) > 1:
222+
print(f"Combined Blacklist: {len(combined_ips)} IPs "
223+
f"(Hauptdatei + {len(_sources_read) - 1} Part(s))")
224+
else:
225+
print(f"Combined Blacklist: {len(combined_ips)} IPs")
201226
202227
# ── FP-Vorfilter für combined_ips (einmalig, statt pro IP im Inner-Loop) ─
203228
# combined_threat_blacklist_ipv4.txt ist zwar bereits mit is_in_fp_set() gefiltert,

0 commit comments

Comments
 (0)