More descriptive jsonld failures

main
Bob Mottram 2021-02-14 15:45:42 +00:00
parent e6b9382a0a
commit 5c5e6c7d1a
1 changed files with 10 additions and 3 deletions

View File

@ -2743,6 +2743,7 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
# check if a json signature exists on this post # check if a json signature exists on this post
hasJsonSignature = False hasJsonSignature = False
jwebsigType = None
originalJson = queueJson['original'] originalJson = queueJson['original']
if originalJson.get('@context') and \ if originalJson.get('@context') and \
originalJson.get('signature'): originalJson.get('signature'):
@ -2751,7 +2752,8 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
jwebsig = originalJson['signature'] jwebsig = originalJson['signature']
# signature exists and is of the expected type # signature exists and is of the expected type
if jwebsig.get('type') and jwebsig.get('signatureValue'): if jwebsig.get('type') and jwebsig.get('signatureValue'):
if jwebsig['type'] == 'RsaSignature2017': jwebsigType = jwebsig['type']
if jwebsigType == 'RsaSignature2017':
if hasValidContext(originalJson): if hasValidContext(originalJson):
hasJsonSignature = True hasJsonSignature = True
else: else:
@ -2761,8 +2763,13 @@ def runInboxQueue(recentPostsCache: {}, maxRecentPosts: int,
# strict enforcement of json signatures # strict enforcement of json signatures
if not hasJsonSignature: if not hasJsonSignature:
if httpSignatureFailed: if httpSignatureFailed:
print('Queue: Header signature check failed and ' + if jwebsigType:
'unable to check json signature') print('Queue: Header signature check failed and does ' +
'not have a recognised jsonld signature type ' +
jwebsigType)
else:
print('Queue: Header signature check failed and ' +
'does not have jsonld signature')
if verifyAllSignatures: if verifyAllSignatures:
print('Queue: inbox post does not have a jsonld signature ' + print('Queue: inbox post does not have a jsonld signature ' +