fix: suppression de tous les LIMIT hardcodés dans les requêtes SQL

Supprime les LIMIT arbitraires qui tronquaient silencieusement les résultats:

- analysis.py   : LIMIT 5, 10, 100, 500 (pays ASN, top pays, UAs)
- variability.py: LIMIT 10, 20 (JA4s, pays, ASNs, hosts, UAs)
- fingerprints.py: LIMIT 10, 20, 100 (IPs, UAs, JA4 spoofing)
- entities.py   : LIMIT 100 (IPs associées)
- tcp_spoofing.py: LIMIT 10, 12, 15 (distributions TTL/MSS/window)
- heatmap.py    : LIMIT 15
- search.py     : LIMIT 5 (suggestions de recherche)

Conservés: LIMIT 1 (lookup d'un seul enregistrement) et
LIMIT %(limit)s / OFFSET (pagination contrôlée par le frontend).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
SOC Analyst
2026-03-19 18:10:55 +01:00
parent 868dd68e34
commit 533072a157
7 changed files with 4 additions and 25 deletions

View File

@ -436,7 +436,6 @@ async def get_ua_analysis(
AND is_ua_rotating = true
GROUP BY clean_ip
ORDER BY avg_ua_ch_mismatch DESC
LIMIT 100
"""
rotating_ips: list = []
try:
@ -548,7 +547,6 @@ async def get_ip_fingerprint_coherence(ip: str):
FROM ml_detected_anomalies
WHERE src_ip = %(ip)s
ORDER BY detected_at DESC
LIMIT 20
"""
ml_res = db.query(ml_query, {"ip": ip})
@ -563,7 +561,7 @@ async def get_ip_fingerprint_coherence(ip: str):
WHERE toString(src_ip) = %(ip)s
AND hour >= now() - INTERVAL 72 HOUR
AND ua != ''
GROUP BY ua ORDER BY cnt DESC LIMIT 10
GROUP BY ua ORDER BY cnt DESC
"""
ua_res = db.query(ua_query, {"ip": ip})
top_uas = [{"ua": str(r[0]), "count": int(r[1] or 0), "type": _classify_ua(str(r[0]))}
@ -703,7 +701,6 @@ async def get_legitimate_ja4(
AND avg_browser_score > 60
AND rare_count = 0
ORDER BY unique_ips DESC
LIMIT 100
"""
result = db.query(query, {"hours": hours, "min_ips": min_ips})