Validate nickname when getting actor json

main
bashrc 2026-04-13 10:33:26 +01:00
parent 0ab879ebe7
commit 849bef5a74
1 changed files with 10 additions and 1 deletions

View File

@ -1879,8 +1879,10 @@ def get_actor_json(host_domain: str, handle: str, http: bool, gnunet: bool,
""" """
if debug: if debug:
print('get_actor_json for ' + handle) print('get_actor_json for ' + handle)
original_actor = handle original_actor: str = handle
group_account = False group_account = False
nickname: str = ''
domain: str = ''
# try to determine the users path # try to determine the users path
detected_users_path = _detect_users_path(handle) detected_users_path = _detect_users_path(handle)
@ -1942,6 +1944,13 @@ def get_actor_json(host_domain: str, handle: str, http: bool, gnunet: bool,
domain = handle.split('@')[1] domain = handle.split('@')[1]
domain = remove_eol(domain) domain = remove_eol(domain)
if not nickname or not domain:
return None, None
if not valid_nickname(domain, nickname):
print('WARN: get_actor_json invalid nickname ' + nickname)
return None, None
cached_webfingers = {} cached_webfingers = {}
proxy_type = None proxy_type = None
if domain.endswith('.onion'): if domain.endswith('.onion'):