Merge branch 'main' of gitlab.com:bashrc2/epicyon

main
Bob Mottram 2021-12-19 19:03:11 +00:00
commit 02cdcfec16
2 changed files with 12 additions and 3 deletions

View File

@ -179,7 +179,8 @@ def _downloadNewswireFeedFavicon(session, baseDir: str,
# check svg for dubious scripts # check svg for dubious scripts
if favUrl.endswith('.svg'): if favUrl.endswith('.svg'):
if dangerousSVG(str(imageData), False): imageDataStr = str(imageData)
if dangerousSVG(imageDataStr, False):
return False return False
# save to the cache # save to the cache

View File

@ -1010,6 +1010,8 @@ def setDisplayNickname(baseDir: str, nickname: str, domain: str,
def setBio(baseDir: str, nickname: str, domain: str, bio: str) -> bool: def setBio(baseDir: str, nickname: str, domain: str, bio: str) -> bool:
"""Only used within tests
"""
if len(bio) > 32: if len(bio) > 32:
return False return False
handle = nickname + '@' + domain handle = nickname + '@' + domain
@ -1683,13 +1685,19 @@ def validSendingActor(session, baseDir: str,
return False return False
# does the actor have a bio ? # does the actor have a bio ?
if not unitTest: 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 # allow no bio if it's an actor in this instance
if domain not in sendingActor: if domain not in sendingActor:
# probably a spam actor with no bio # probably a spam actor with no bio
print('REJECT: spam actor ' + sendingActor) print('REJECT: spam actor ' + sendingActor)
return False 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']) bioStr += ' ' + removeHtml(actorJson['preferredUsername'])
if actorJson.get('attachment'): if actorJson.get('attachment'):