Protocol.receive: drop fed.brid.gy domain check

this happens after protocols pre-process objects and eg fill in BF AP actor ids. moved this check to *.send and user entity pre post hooks instead. for #597
pull/598/head
Ryan Barrett 2023-07-22 20:11:12 -10:00
rodzic 9a7597b365
commit c3f9c56c31
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 6BE31FDF4776E9D4
2 zmienionych plików z 2 dodań i 8 usunięć

Wyświetl plik

@ -375,14 +375,6 @@ class Protocol:
if not id:
error('No id provided')
# block intra-BF ids
if util.domain_from_link(id) in common.DOMAINS:
error(f'{id} is on a Bridgy Fed domain, which is not supported')
for field in 'id', 'actor', 'author', 'attributedTo':
val = as1.get_object(obj.as1, field).get('id')
if util.domain_from_link(val) in common.DOMAINS:
error(f'{field} {val} is on Bridgy Fed, which is not supported')
# short circuit if we've already seen this activity id.
# (don't do this for bare objects since we need to check further down
# whether they've been updated since we saw them last.)

Wyświetl plik

@ -1,4 +1,5 @@
"""Unit tests for protocol.py."""
from unittest import skip
from unittest.mock import patch
from flask import g
@ -1074,6 +1075,7 @@ class ProtocolReceiveTest(TestCase):
self.assertEqual('fake:stop-following', obj.key.id())
self.assertEqual('fake:user:target', target)
@skip
def test_receive_from_bridgy_fed_domain_fails(self):
with self.assertRaises(BadRequest):
Fake.receive({