From a4849367930f13614499025faeec7705a65efa62 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Tue, 25 Aug 2020 20:45:15 +0100 Subject: [PATCH] More content warning validation --- inbox.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/inbox.py b/inbox.py index 8fdc6137..6e7838f7 100644 --- a/inbox.py +++ b/inbox.py @@ -50,6 +50,7 @@ from filters import isFiltered from announce import updateAnnounceCollection from announce import undoAnnounceCollectionEntry from httpsig import messageContentDigest +from posts import validContentWarning from posts import downloadAnnounce from posts import isDM from posts import isReply @@ -1708,6 +1709,15 @@ def validPostContent(baseDir: str, nickname: str, domain: str, if 'Z' not in messageJson['object']['published']: return False + if messageJson['object'].get('summary'): + summary = messageJson['object']['summary'] + if not isinstance(summary, str): + print('WARN: content warning is not a string') + return False + if summary != validContentWarning(summary): + print('WARN: invalid content warning ' + summary) + return False + if isGitPatch(baseDir, nickname, domain, messageJson['object']['type'], messageJson['object']['summary'],