From 5cb82c487674c0f1ede9217a132e0c10d3c87661 Mon Sep 17 00:00:00 2001 From: Patrick Decat Date: Thu, 14 Sep 2023 10:33:43 +0200 Subject: [PATCH] fix: drop user-agent header from requests as it only seems to cause issues, especially with Duo --- aws_adfs/_duo_authenticator.py | 2 -- aws_adfs/_duo_universal_prompt_authenticator.py | 3 --- aws_adfs/account_aliases_fetcher.py | 1 - 3 files changed, 6 deletions(-) diff --git a/aws_adfs/_duo_authenticator.py b/aws_adfs/_duo_authenticator.py index c9dc241..873caf1 100644 --- a/aws_adfs/_duo_authenticator.py +++ b/aws_adfs/_duo_authenticator.py @@ -38,7 +38,6 @@ _headers = { 'Accept-Language': 'en', - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Accept': 'text/plain, */*; q=0.01', } @@ -418,7 +417,6 @@ def _initiate_authentication(duo_host, duo_request_signature, roles_page_url, se verify=ssl_verification_enabled, headers={ 'Host': duo_host, - 'User-Agent': "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36", 'Accept': "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8", 'Accept-Language': "en-US,en;q=0.5", 'Accept-Encoding': "gzip, deflate, br", diff --git a/aws_adfs/_duo_universal_prompt_authenticator.py b/aws_adfs/_duo_universal_prompt_authenticator.py index fe2c623..9273072 100644 --- a/aws_adfs/_duo_universal_prompt_authenticator.py +++ b/aws_adfs/_duo_universal_prompt_authenticator.py @@ -39,9 +39,6 @@ _headers = { "Accept-Language": "en", - "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) like Gecko" - if platform.system() in ("Linux", "Darwin") - else "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko", "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8", "Accept": "text/plain, */*; q=0.01", } diff --git a/aws_adfs/account_aliases_fetcher.py b/aws_adfs/account_aliases_fetcher.py index 204ceb7..a3643c2 100644 --- a/aws_adfs/account_aliases_fetcher.py +++ b/aws_adfs/account_aliases_fetcher.py @@ -16,7 +16,6 @@ def account_aliases(session, username, password, auth_method, saml_response, con verify=config.ssl_verification, headers={ 'Accept-Language': 'en', - 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Accept': 'text/plain, */*; q=0.01', },