mirror of https://gitlab.com/bashrc2/epicyon
Checking domains
parent
15d0c1defa
commit
ce7cc8d7de
|
|
@ -96,6 +96,7 @@ from flags import is_artist
|
||||||
from flags import is_blog_post
|
from flags import is_blog_post
|
||||||
from timeFunctions import date_utcnow
|
from timeFunctions import date_utcnow
|
||||||
from timeFunctions import get_current_time_int
|
from timeFunctions import get_current_time_int
|
||||||
|
from utils import resembles_domain
|
||||||
from utils import string_starts_with
|
from utils import string_starts_with
|
||||||
from utils import is_yggdrasil_address
|
from utils import is_yggdrasil_address
|
||||||
from utils import replace_strings
|
from utils import replace_strings
|
||||||
|
|
@ -6364,9 +6365,7 @@ def _security_txt(self, ua_str: str, calling_domain: str,
|
||||||
# is this a real website making the call ?
|
# is this a real website making the call ?
|
||||||
if not debug and not self.server.unit_test and referer_domain:
|
if not debug and not self.server.unit_test and referer_domain:
|
||||||
# Does calling_domain look like a domain?
|
# Does calling_domain look like a domain?
|
||||||
if ' ' in referer_domain or \
|
if not resembles_domain(referer_domain):
|
||||||
';' in referer_domain or \
|
|
||||||
'.' not in referer_domain:
|
|
||||||
print('security.txt ' +
|
print('security.txt ' +
|
||||||
'referer domain does not look like a domain ' +
|
'referer domain does not look like a domain ' +
|
||||||
referer_domain)
|
referer_domain)
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ def _masto_api_v1(self, path: str, calling_domain: str,
|
||||||
# is this a real website making the call ?
|
# is this a real website making the call ?
|
||||||
if not debug and not unit_test and referer_domain:
|
if not debug and not unit_test and referer_domain:
|
||||||
# Does calling_domain look like a domain?
|
# Does calling_domain look like a domain?
|
||||||
if resembles_domain(referer_domain):
|
if not resembles_domain(referer_domain):
|
||||||
print('mastodon api ' +
|
print('mastodon api ' +
|
||||||
'referer does not look like a domain ' +
|
'referer does not look like a domain ' +
|
||||||
referer_domain)
|
referer_domain)
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ from httpcodes import http_404
|
||||||
from httpcodes import http_503
|
from httpcodes import http_503
|
||||||
from httpcodes import write2
|
from httpcodes import write2
|
||||||
from httpheaders import set_headers
|
from httpheaders import set_headers
|
||||||
|
from utils import resembles_domain
|
||||||
from utils import string_starts_with
|
from utils import string_starts_with
|
||||||
from utils import convert_domains
|
from utils import convert_domains
|
||||||
from utils import get_instance_url
|
from utils import get_instance_url
|
||||||
|
|
@ -73,9 +74,7 @@ def get_nodeinfo(self, ua_str: str, calling_domain: str,
|
||||||
# is this a real website making the call ?
|
# is this a real website making the call ?
|
||||||
if not debug and not unit_test and referer_domain:
|
if not debug and not unit_test and referer_domain:
|
||||||
# Does calling_domain look like a domain?
|
# Does calling_domain look like a domain?
|
||||||
if ' ' in referer_domain or \
|
if not resembles_domain(referer_domain):
|
||||||
';' in referer_domain or \
|
|
||||||
'.' not in referer_domain:
|
|
||||||
print('nodeinfo referer domain does not look like a domain ' +
|
print('nodeinfo referer domain does not look like a domain ' +
|
||||||
referer_domain)
|
referer_domain)
|
||||||
http_400(self)
|
http_400(self)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue