temporary: assume HTTP Signature algorithm=hs2019 means rsa-sha256

still trying to figure this out. see https://github.com/snarfed/bridgy-fed/issues/430#issuecomment-1510462267, https://arewehs2019yet.vpzom.click/ , etc.
pull/482/head
Ryan Barrett 2023-04-16 16:35:31 -07:00
rodzic aae0944926
commit 842f8ac964
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -151,10 +151,17 @@ class ActivityPub(Protocol):
logger.info(f'Headers: {json_dumps(dict(request.headers), indent=2)}')
# parse_signature_header lower-cases all keys
keyId = fragmentless(parse_signature_header(sig).get('keyid'))
sig_fields = parse_signature_header(sig)
keyId = fragmentless(sig_fields.get('keyid'))
if not keyId:
error('HTTP Signature missing keyId', status=401)
# TODO: right now, assume hs2019 is rsa-sha256 🤷
# https://github.com/snarfed/bridgy-fed/issues/430#issuecomment-1510462267
# https://arewehs2019yet.vpzom.click/
if sig_fields.get('algorithm') == 'hs2019':
sig_fields['algorithm'] = 'rsa-sha256'
digest = request.headers.get('Digest') or ''
if not digest:
error('Missing Digest header, required for HTTP Signature', status=401)