]> git.mxchange.org Git - fba.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 21 Jun 2023 03:37:16 +0000 (05:37 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 21 Jun 2023 03:37:16 +0000 (05:37 +0200)
- first check validity and if not wanted TLDs like '.arpa' or '.tld'
- then check blacklist

fba/http/federation.py

index 28b04a26de065d372695565ad81978120396b5cc..492d932ef7ba8148c3ae7ff970cf9ebdb2c584da 100644 (file)
@@ -628,8 +628,17 @@ def add_peers(rows: dict) -> list:
                 peer = tidyup.domain(peer)
 
                 # DEBUG: print(f"DEBUG: peer='{peer}' - AFTER!")
-                if blacklist.is_blacklisted(peer):
-                    # DEBUG: print(f"DEBUG: peer='{peer}' is blacklisted, skipped!")
+                if not validators.domain(peer):
+                    print(f"WARNING: peer='{peer}' is not a valid domain - SKIPPED!")
+                    continue
+                elif peer.endswith(".arpa"):
+                    print(f"WARNING: peer='{peer}' is a domain for reversed IP addresses -SKIPPED!")
+                    continue
+                elif peer.endswith(".tld"):
+                    print(f"WARNING: peer='{peer}' is a fake domain - SKIPPED!")
+                    continue
+                elif blacklist.is_blacklisted(peer):
+                    print(f"WARNING: peer='{peer}' is blacklisted - SKIPPED!")
                     continue
 
                 # DEBUG: print(f"DEBUG: Adding peer='{peer}' ...")