Check posting to permitted url

main
Bob Mottram 2021-12-31 10:14:22 +00:00
parent 59c88dd2e0
commit 19bd33e885
1 changed files with 6 additions and 0 deletions

View File

@ -348,6 +348,12 @@ def post_json_string(session, post_jsonStr: str,
conversions between string and json format don't invalidate conversions between string and json format don't invalidate
the message body digest of http signatures the message body digest of http signatures
""" """
# check that we are posting to a permitted domain
if not url_permitted(inbox_url, federation_list):
if not quiet:
print('post_json_string: ' + inbox_url + ' not permitted')
return None, None, 0
try: try:
post_result = \ post_result = \
session.post(url=inbox_url, data=post_jsonStr, session.post(url=inbox_url, data=post_jsonStr,