From 44daf317fc1c30d3f99c298ada11b1651e49efac Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Sun, 19 Dec 2021 18:29:43 +0000 Subject: [PATCH] Check actor bio length --- newswire.py | 3 ++- person.py | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/newswire.py b/newswire.py index 482ccb2cb..bc563812a 100644 --- a/newswire.py +++ b/newswire.py @@ -179,7 +179,8 @@ def _downloadNewswireFeedFavicon(session, baseDir: str, # check svg for dubious scripts if favUrl.endswith('.svg'): - if dangerousSVG(str(imageData), False): + imageDataStr = str(imageData) + if dangerousSVG(imageDataStr, False): return False # save to the cache diff --git a/person.py b/person.py index 6e8ddd4b8..c3bcada06 100644 --- a/person.py +++ b/person.py @@ -1685,13 +1685,19 @@ def validSendingActor(session, baseDir: str, return False # does the actor have a bio ? if not unitTest: - if not actorJson.get('summary'): + bioStr = '' + if actorJson.get('summary'): + bioStr = removeHtml(actorJson['summary']).strip() + if not bioStr: # allow no bio if it's an actor in this instance if domain not in sendingActor: # probably a spam actor with no bio print('REJECT: spam actor ' + sendingActor) return False - bioStr = removeHtml(actorJson['summary']) + if len(bioStr) < 10: + print('REJECT: actor bio is not long enough ' + + sendingActor + ' ' + bioStr) + return False bioStr += ' ' + removeHtml(actorJson['preferredUsername']) if actorJson.get('attachment'):