mirror of https://gitlab.com/bashrc2/epicyon
Remove browser contradiction check
The real user agents are themselves contradictorymain
parent
832838df57
commit
1c5f050db6
|
|
@ -96,7 +96,6 @@ from flags import is_artist
|
|||
from flags import is_blog_post
|
||||
from timeFunctions import date_utcnow
|
||||
from timeFunctions import get_current_time_int
|
||||
from utils import check_mixed_user_agent
|
||||
from utils import string_starts_with
|
||||
from utils import is_yggdrasil_address
|
||||
from utils import replace_strings
|
||||
|
|
@ -383,14 +382,6 @@ def daemon_http_get(self) -> None:
|
|||
|
||||
ua_str = get_user_agent(self)
|
||||
|
||||
# contradictory browsers within the user agent indicate
|
||||
# malevolent intent
|
||||
if check_mixed_user_agent(ua_str):
|
||||
print('GET HTTP contradictory browsers within user agent ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
if ua_str:
|
||||
if 'Epicyon/' in ua_str:
|
||||
log_epicyon_instances(self.server.base_dir, ua_str,
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ import errno
|
|||
import json
|
||||
from socket import error as SocketError
|
||||
from flags import is_corporate
|
||||
from utils import check_mixed_user_agent
|
||||
from utils import string_starts_with
|
||||
from utils import is_yggdrasil_address
|
||||
from utils import replace_strings
|
||||
|
|
@ -283,14 +282,6 @@ def daemon_http_post(self) -> None:
|
|||
|
||||
ua_str = get_user_agent(self)
|
||||
|
||||
# contradictory browsers within the user agent indicate
|
||||
# malevolent intent
|
||||
if check_mixed_user_agent(ua_str):
|
||||
print('POST HTTP contradictory browsers within user agent ' +
|
||||
str(self.headers).replace('\n', ' '))
|
||||
http_400(self)
|
||||
return
|
||||
|
||||
if ua_str:
|
||||
if 'Epicyon/' in ua_str:
|
||||
log_epicyon_instances(self.server.base_dir, ua_str,
|
||||
|
|
|
|||
26
utils.py
26
utils.py
|
|
@ -4104,32 +4104,6 @@ def get_instance_url(calling_domain: str,
|
|||
return instance_url
|
||||
|
||||
|
||||
def check_mixed_user_agent(ua_str: str):
|
||||
"""Check if there are contradicting browsers within the user agent
|
||||
"""
|
||||
if not ua_str:
|
||||
return False
|
||||
|
||||
client_user_agents = ('Mozilla', 'Chrome', 'Safari')
|
||||
matching_agents = []
|
||||
for client_ua in client_user_agents:
|
||||
if client_ua in ua_str:
|
||||
matching_agents.append(client_ua)
|
||||
if len(matching_agents) > 1:
|
||||
if len(matching_agents) == 2:
|
||||
if matching_agents[0] == 'Mozilla':
|
||||
# Safari browser oddly starts with Mozilla
|
||||
# https://www.useragentstring.com/pages/Safari
|
||||
if matching_agents[1] == 'Safari':
|
||||
return False
|
||||
# Chrome browser oddly starts with Mozilla
|
||||
# https://www.useragentstring.com/pages/Chrome
|
||||
if matching_agents[1] == 'Chrome':
|
||||
return False
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def check_bad_path(path: str):
|
||||
"""for http GET or POST check that the path looks valid
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in New Issue