Extra json signature checks

main
Bob Mottram 2021-01-03 19:20:28 +00:00
parent 5fc36f6ebb
commit 6aa1cc8389
1 changed files with 8 additions and 0 deletions

View File

@ -2706,8 +2706,16 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
print('DEBUG: http header signature check success')
# check json signature
checkJsonSignature = False
if queueJson['original'].get('@context') and \
queueJson['original'].get('signature'):
if isinstance(queueJson['original']['signature'], dict):
if queueJson['original']['signature'].get('type') and \
queueJson['original']['signature'].get('signatureValue'):
if queueJson['original']['signature']['type'] == \
'RsaSignature2017':
checkJsonSignature = True
if checkJsonSignature:
# use the original json message received, not one which may have
# been modified along the way
if not jsonldVerify(queueJson['original'], pubKey):