Fix bookmark validation

main
Bob Mottram 2021-03-20 14:25:24 +00:00
parent eabe1ea535
commit 247bb06ba5
2 changed files with 24 additions and 8 deletions

View File

@ -534,9 +534,13 @@ def outboxBookmark(recentPostsCache: {},
if debug:
print('DEBUG: no target in bookmark Add')
return
if not isinstance(messageJson['object'], str):
if not isinstance(messageJson['object'], dict):
if debug:
print('DEBUG: bookmark Add object is not string')
print('DEBUG: bookmark Add object is not dict')
return
if not messageJson['object'].get('type'):
if debug:
print('DEBUG: no object type in bookmark Add')
return
if not isinstance(messageJson['target'], str):
if debug:
@ -599,9 +603,13 @@ def outboxUndoBookmark(recentPostsCache: {},
if debug:
print('DEBUG: no target in unbookmark Remove')
return
if not isinstance(messageJson['object'], str):
if not isinstance(messageJson['object'], dict):
if debug:
print('DEBUG: unbookmark Remove object is not string')
print('DEBUG: unbookmark Remove object is not dict')
return
if not messageJson['object'].get('type'):
if debug:
print('DEBUG: no object type in bookmark Remove')
return
if not isinstance(messageJson['target'], str):
if debug:

View File

@ -1098,10 +1098,14 @@ def _receiveBookmark(recentPostsCache: {},
if debug:
print('DEBUG: no target in inbox bookmark Add')
return False
if not isinstance(messageJson['object'], str):
if not isinstance(messageJson['object'], dict):
if debug:
print('DEBUG: inbox bookmark Add object is not string')
return False
if not messageJson['object'].get('type'):
if debug:
print('DEBUG: no object type in inbox bookmark Add')
return False
if not isinstance(messageJson['target'], str):
if debug:
print('DEBUG: inbox bookmark Add target is not string')
@ -1173,13 +1177,17 @@ def _receiveUndoBookmark(recentPostsCache: {},
if debug:
print('DEBUG: no target in inbox undo bookmark Remove')
return False
if not isinstance(messageJson['object'], str):
if not isinstance(messageJson['object'], dict):
if debug:
print('DEBUG: inbox undo bookmark Remove object is not string')
print('DEBUG: inbox Remove bookmark object is not dict')
return False
if not messageJson['object'].get('type'):
if debug:
print('DEBUG: no object type in inbox bookmark Remove')
return False
if not isinstance(messageJson['target'], str):
if debug:
print('DEBUG: inbox undo bookmark Remove target is not string')
print('DEBUG: inbox Remove bookmark target is not string')
return False
domainFull = getFullDomain(domain, port)
nickname = handle.split('@')[0]