Repository navigation
fix(dnsfw): dead URLhaus hostfile preset (HTTP 410) -> keyless NetAPI domain list - #117
Conversation
|
Merci Slava — this is exactly right. I verified both claims before merging: the URLhaus hostfile indeed answers HTTP 410 since their keyless-download retirement, and the NetAPI list serves fine without a key. What I especially appreciate: the deliberate new preset key so a saved Merging now. Welcome aboard, and feel very free to pick anything else that looks off. |
|
Thank you for the careful review and the kind words, @aixisstudio! Glad it fits. I will keep an eye out for anything else that looks off. |
Wiretap already uses the NetAPI IP list as the
netapi_compromisedpreset (#101). This PR fixes the malware category of the DNS firewall with the NetAPI domain list.The
malware_abusechcategory of the DNS firewall loads nothing: on 2026-10-21 URLhaus stopped serving its hostfile (https://urlhaus.abuse.ch/downloads/hostfile/). Throughfetch_list()today it givesfetch failed: HTTP Error 410: Gone.This PR replaces the preset with a list that answers without a key:
About the list:
"domains"format (as the OpenPhish preset). Regenerated hourly, no key, CC BY 4.0. How it is built: https://netapi.com/compromised-urls/DomainFilter._MAX_DOMAINS(400,000).A saved
malware_abusechchoice is dropped byconfigure(), as any unknown key already is, and is not moved to the new preset: that choice was consent for abuse.ch, and the ground rule is no new outbound host without an opt-in. The category shows up unchecked in Settings. If you prefer a migration, tell me and I will add the mapping.Changes:
backend/detection/dnsfw.py: the preset and the header comment (EN/FR)backend/tests/test_dnsfw.py: five tests. No preset points at abuse.ch, preset metadata and its entry instatus(), the list shape through_parse_hosts(),refresh_lists()withurlopenmocked (the preset URL is fetched once, listed names and their subdomains are blocked, the second refresh is served from the disk cache), and a savedmalware_abusechchoice contacts no hostNo frontend change: the label comes from
available_categories.Tested:
python:3.11-slim):ruff check backend --select E9,Fclean,pytest tests/431 passed, 14 skipped.tests/test_dnsfw.pyon Windows (Python 3.13): 15 passedpython:3.11-slim-bookworm,NET_ADMIN+NET_RAW) with the backend started byrun_backend.py:POST /dnsfw/configwith{"categories": ["malicious_netapi"], "enabled": true}, thenPOST /dnsfw/refreshreportedfetched 128184 domains (2605 KiB).dig @127.0.0.1 -p 5353returned NXDOMAIN for a listed name and forwww.of another listed name, and NOERROR with A records forexample.com./dnsfw/blockedshowed both names with the categorymalicious_netapi, andper_categorycounted 2One more thing I saw on the way, not touched here to keep the diff to one concern:
refresh_lists()writes the cache as bare domains and reads it back with the preset's format, so for the hosts-format presets (all the StevenBlack ones) the cache parses to nothing and the list is fetched again on every refresh instead of once a day. I can send that as a separate PR with a test.Thanks!
Slava
Disclosure: I run NetAPI, which publishes this list.