Check that there are not too many rel="me" links

main
Bob Mottram 2022-11-10 09:46:48 +00:00
parent fad7a0dd6a
commit d0b9441c91
1 changed files with 11 additions and 0 deletions

View File

@ -396,6 +396,17 @@ def verify_html(session, url: str, debug: bool,
url)
return False
verification_site_html = verification_site_html.decode()
# does the site contain rel="me" links?
if ' rel="me" ' not in verification_site_html:
return False
# ensure that there are not too many rel="me" links
sections = verification_site_html.split(' rel="me" ')
me_links_count = len(sections) - 1
if me_links_count > 5:
return False
actor_links = [
domain + '/@' + nickname,
domain + '/users/' + nickname