From d0b9441c914eeb94424f59fd71b9b3404232585d Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Thu, 10 Nov 2022 09:46:48 +0000 Subject: [PATCH] Check that there are not too many rel="me" links --- session.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/session.py b/session.py index 664a553b9..78998fe35 100644 --- a/session.py +++ b/session.py @@ -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