Skip to content

Commit 2e0e69f

Browse files
mmhwxsoar-bot
authored andcommitted
[MicrosoftApiModule] Revert of PR 29035 (demisto#29173)
* Revert the 7839428 commit * Update RN * Update RN
1 parent 9fa4799 commit 2e0e69f

File tree

101 files changed

+284
-116
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

101 files changed

+284
-116
lines changed

Diff for: Packs/ApiModules/Scripts/MicrosoftApiModule/MicrosoftApiModule.py

+2-31
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,6 @@ def __init__(self, tenant_id: str = '',
735735
self.resources = resources if resources else []
736736
self.resource_to_access_token: dict[str, str] = {}
737737

738-
self.auth_code_reconfigured = False
739-
740738
# for Azure Managed Identities purpose
741739
self.managed_identities_client_id = managed_identities_client_id
742740
self.managed_identities_resource_uri = managed_identities_resource_uri
@@ -869,11 +867,7 @@ def get_access_token(self, resource: str = '', scope: str | None = None) -> str:
869867

870868
valid_until = integration_context.get(valid_until_keyword)
871869

872-
self.auth_code_reconfigured = self.is_auth_code_reconfigured(integration_context.get('auth_code', ''))
873-
if self.auth_code_reconfigured:
874-
demisto.debug("Auth code reconfigured, saving new auth code to integration context")
875-
integration_context['auth_code'] = self.auth_code
876-
elif access_token and valid_until and self.epoch_seconds() < valid_until:
870+
if access_token and valid_until and self.epoch_seconds() < valid_until:
877871
return access_token
878872

879873
if self.auth_type == OPROXY_AUTH_TYPE:
@@ -1107,7 +1101,7 @@ def _get_self_deployed_token_auth_code(
11071101
data['scope'] = scope
11081102

11091103
refresh_token = refresh_token or self._get_refresh_token_from_auth_code_param()
1110-
if refresh_token and not self.auth_code_reconfigured:
1104+
if refresh_token:
11111105
data['grant_type'] = REFRESH_TOKEN
11121106
data['refresh_token'] = refresh_token
11131107
else:
@@ -1393,29 +1387,6 @@ def start_auth(self, complete_command: str) -> str:
13931387
and enter the code **{user_code}** to authenticate.
13941388
2. Run the **{complete_command}** command in the War Room."""
13951389

1396-
def is_auth_code_reconfigured(self, auth_code) -> bool:
1397-
"""
1398-
Checks if the auth_code is reconfigured by comparing to the self.auth_code from the instance params.
1399-
Args:
1400-
auth_code: The auth_code form the integration context.
1401-
Returns:
1402-
bool: True if the auth_code is reconfigured, otherwise False.
1403-
"""
1404-
# Case of oproxy
1405-
if self.auth_type == OPROXY_AUTH_TYPE:
1406-
return False
1407-
# Case of the next times or after reconfigured the auth_code
1408-
if auth_code and self.auth_code:
1409-
is_reconfigured = auth_code != self.auth_code
1410-
demisto.debug(f'Auth code is reconfigured: {is_reconfigured}')
1411-
return is_reconfigured
1412-
# Case of the first time or after deleting the auth_code
1413-
elif auth_code or self.auth_code:
1414-
demisto.debug('Auth code is only in ' + ('integration_context' if auth_code else 'params'))
1415-
return True
1416-
else:
1417-
return False
1418-
14191390

14201391
class NotFoundError(Exception):
14211392
"""Exception raised for 404 - Not Found errors.

Diff for: Packs/ApiModules/Scripts/MicrosoftApiModule/MicrosoftApiModule_test.py

+2-52
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
CLIENT_ID = 'dummy_client'
1919
CLIENT_SECRET = 'dummy_secret'
2020
APP_URL = 'https://login.microsoftonline.com/dummy_tenant/oauth2/v2.0/token'
21-
AUTH_CODE = 'dummy_auth_code'
22-
REDIRECT_URI = 'https://localhost/myapp'
2321
SCOPE = 'https://graph.microsoft.com/.default'
2422
RESOURCE = 'https://defender.windows.com/shtak'
2523
RESOURCES = ['https://resource1.com', 'https://resource2.com']
@@ -64,17 +62,15 @@ def oproxy_client_refresh():
6462
)
6563

6664

67-
def self_deployed_client(grant_type=CLIENT_CREDENTIALS):
65+
def self_deployed_client():
6866
tenant_id = TENANT
6967
client_id = CLIENT_ID
7068
client_secret = CLIENT_SECRET
7169
base_url = BASE_URL
72-
auth_code = AUTH_CODE if grant_type == AUTHORIZATION_CODE else ''
7370
resource = RESOURCE
7471
ok_codes = OK_CODES
7572

7673
return MicrosoftClient(self_deployed=True, tenant_id=tenant_id, auth_id=client_id, enc_key=client_secret,
77-
grant_type=grant_type, auth_code=auth_code,
7874
resource=resource, base_url=base_url, verify=True, proxy=False, ok_codes=ok_codes)
7975

8076

@@ -721,57 +717,11 @@ def test_generate_login_url():
721717
"""
722718
from MicrosoftApiModule import generate_login_url
723719

724-
client = self_deployed_client(grant_type=AUTHORIZATION_CODE)
720+
client = self_deployed_client()
725721

726722
result = generate_login_url(client)
727723

728724
expected_url = f'[login URL](https://login.microsoftonline.com/{TENANT}/oauth2/v2.0/authorize?' \
729725
f'response_type=code&scope=offline_access%20https://graph.microsoft.com/.default' \
730726
f'&client_id={CLIENT_ID}&redirect_uri=https://localhost/myapp)'
731727
assert expected_url in result.readable_output, "Login URL is incorrect"
732-
733-
734-
def test_get_access_token_auth_code_reconfigured(mocker, requests_mock):
735-
"""
736-
Given:
737-
- The auth code was reconfigured
738-
When:
739-
- Calling function get_access_token
740-
Then:
741-
- Ensure the access token is as expected in the body of the request and in the integration context
742-
"""
743-
context = {'auth_code': AUTH_CODE, 'access_token': TOKEN,
744-
'valid_until': 3605, 'current_refresh_token': REFRESH_TOKEN}
745-
746-
mocker.patch.object(demisto, 'getIntegrationContext', return_value=context)
747-
mocker.patch.object(demisto, 'setIntegrationContext')
748-
749-
tenant_id = TENANT
750-
client_id = CLIENT_ID
751-
client_secret = CLIENT_SECRET
752-
base_url = BASE_URL
753-
new_auth_code = 'reconfigured_auth_code'
754-
resource = None
755-
ok_codes = OK_CODES
756-
grant_type = AUTHORIZATION_CODE
757-
758-
client = MicrosoftClient(self_deployed=True, tenant_id=tenant_id, auth_id=client_id, enc_key=client_secret,
759-
grant_type=grant_type, auth_code=new_auth_code,
760-
resource=resource, base_url=base_url, verify=True, proxy=False, ok_codes=ok_codes)
761-
762-
requests_mock.post(
763-
APP_URL,
764-
json={'access_token': TOKEN, 'expires_in': '3600'})
765-
766-
body = {
767-
'client_id': CLIENT_ID,
768-
'client_secret': CLIENT_SECRET,
769-
'redirect_uri': REDIRECT_URI,
770-
'grant_type': AUTHORIZATION_CODE,
771-
'code': new_auth_code,
772-
}
773-
774-
assert client.get_access_token()
775-
req_body = requests_mock._adapter.last_request._request.body
776-
assert urllib.parse.urlencode(body) == req_body
777-
assert demisto.getIntegrationContext().get('auth_code') == new_auth_code

Diff for: Packs/AzureActiveDirectory/ReleaseNotes/1_3_16.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureActiveDirectory/ReleaseNotes/1_3_17.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Active Directory Identity Protection (Deprecated)
5+
6+
Fixed an issue where instances using version 1.3.16 of the pack could have authentication issues.

Diff for: Packs/AzureActiveDirectory/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"description": "Deprecated. Use Microsoft Graph Identity and Access instead.",
44
"support": "xsoar",
55
"hidden": true,
6-
"currentVersion": "1.3.16",
6+
"currentVersion": "1.3.17",
77
"author": "Cortex XSOAR",
88
"url": "https://www.paloaltonetworks.com/cortex",
99
"email": "",

Diff for: Packs/AzureCompute/ReleaseNotes/1_2_13.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureCompute/ReleaseNotes/1_2_14.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Compute v2
5+
6+
Fixed an issue where instances using version 1.2.13 of the pack could have authentication issues.

Diff for: Packs/AzureCompute/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Compute",
33
"description": "Create and Manage Azure Virtual Machines",
44
"support": "xsoar",
5-
"currentVersion": "1.2.13",
5+
"currentVersion": "1.2.14",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureDataExplorer/ReleaseNotes/1_2_25.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureDataExplorer/ReleaseNotes/1_2_26.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Data Explorer
5+
6+
Fixed an issue where instances using version 1.2.25 of the pack could have authentication issues.

Diff for: Packs/AzureDataExplorer/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Data Explorer",
33
"description": "Use Azure Data Explorer integration to collect and analyze data inside clusters of Azure Data Explorer and manage search queries.",
44
"support": "xsoar",
5-
"currentVersion": "1.2.25",
5+
"currentVersion": "1.2.26",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureDevOps/ReleaseNotes/1_2_17.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureDevOps/ReleaseNotes/1_3_1.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### AzureDevOps
5+
6+
Fixed an issue where instances using version 1.2.17 of the pack could have authentication issues.

Diff for: Packs/AzureDevOps/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "AzureDevOps",
33
"description": "Create and manage Git repositories in Azure DevOps Services.",
44
"support": "xsoar",
5-
"currentVersion": "1.3.0",
5+
"currentVersion": "1.3.1",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureFirewall/ReleaseNotes/1_1_25.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureFirewall/ReleaseNotes/1_1_26.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Firewall
5+
6+
Fixed an issue where instances using version 1.1.25 of the pack could have authentication issues.

Diff for: Packs/AzureFirewall/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Firewall",
33
"description": "Azure Firewall is a cloud-native and intelligent network firewall security service that provides breed threat protection for cloud workloads running in Azure.It's a fully stateful, firewall as a service with built-in high availability and unrestricted cloud scalability.",
44
"support": "xsoar",
5-
"currentVersion": "1.1.25",
5+
"currentVersion": "1.1.26",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureKeyVault/ReleaseNotes/1_1_26.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureKeyVault/ReleaseNotes/1_1_27.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Key Vault
5+
6+
Fixed an issue where instances using version 1.1.26 of the pack could have authentication issues.

Diff for: Packs/AzureKeyVault/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Key Vault",
33
"description": "Use Key Vault to safeguard and manage cryptographic keys and secrets used by cloud applications and services.",
44
"support": "xsoar",
5-
"currentVersion": "1.1.26",
5+
"currentVersion": "1.1.27",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureKubernetesServices/ReleaseNotes/1_1_18.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureKubernetesServices/ReleaseNotes/1_1_19.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Kubernetes Services
5+
6+
Fixed an issue where instances using version 1.1.18 of the pack could have authentication issues.

Diff for: Packs/AzureKubernetesServices/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Kubernetes Services",
33
"description": "Deploy and manage containerized applications with a fully managed Kubernetes service.",
44
"support": "xsoar",
5-
"currentVersion": "1.1.18",
5+
"currentVersion": "1.1.19",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureLogAnalytics/ReleaseNotes/1_1_16.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureLogAnalytics/ReleaseNotes/1_1_17.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Log Analytics
5+
6+
Fixed an issue where instances using version 1.1.16 of the pack could have authentication issues.

Diff for: Packs/AzureLogAnalytics/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Log Analytics",
33
"description": "Log Analytics is a service that helps you collect and analyze data generated by resources in your cloud and on-premises environments.",
44
"support": "xsoar",
5-
"currentVersion": "1.1.16",
5+
"currentVersion": "1.1.17",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureNetworkSecurityGroups/ReleaseNotes/1_2_18.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Network Security Groups
5+
6+
Fixed an issue where instances using version 1.2.18 of the pack could have authentication issues.

Diff for: Packs/AzureNetworkSecurityGroups/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Network Security Groups",
33
"description": "Azure Network Security Groups are used to filter network traffic to and from Azure resources in an Azure virtual network",
44
"support": "xsoar",
5-
"currentVersion": "1.2.18",
5+
"currentVersion": "1.2.19",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureRiskyUsers/ReleaseNotes/1_1_16.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureRiskyUsers/ReleaseNotes/1_1_17.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure Risky Users
5+
6+
Fixed an issue where instances using version 1.1.16 of the pack could have authentication issues.

Diff for: Packs/AzureRiskyUsers/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure Risky Users",
33
"description": "Azure Risky Users provides access to all at-risk users and risk detections in Azure AD environment.",
44
"support": "xsoar",
5-
"currentVersion": "1.1.16",
5+
"currentVersion": "1.1.17",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureSQLManagement/ReleaseNotes/1_1_27.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureSQLManagement/ReleaseNotes/1_1_28.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
#### Integrations
3+
4+
##### Azure SQL Management
5+
6+
Fixed an issue where instances using version 1.1.27 of the pack could have authentication issues.

Diff for: Packs/AzureSQLManagement/pack_metadata.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "Azure SQL Management",
33
"description": "Microsoft Azure SQL Database is a managed cloud database provided as part of Microsoft Azure",
44
"support": "xsoar",
5-
"currentVersion": "1.1.27",
5+
"currentVersion": "1.1.28",
66
"author": "Cortex XSOAR",
77
"url": "https://www.paloaltonetworks.com/cortex",
88
"email": "",

Diff for: Packs/AzureSecurityCenter/ReleaseNotes/2_0_8.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
***WARNING: This version is invalid. Please install a different version.***
12

23
#### Integrations
34

Diff for: Packs/AzureSecurityCenter/ReleaseNotes/2_0_9.md

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
#### Integrations
3+
4+
##### Microsoft Defender for Cloud Event Collector
5+
6+
Fixed an issue where instances using version 2.0.8 of the pack could have authentication issues.
7+
8+
##### Microsoft Defender for Cloud
9+
10+
Fixed an issue where instances using version 2.0.8 of the pack could have authentication issues.

0 commit comments

Comments
 (0)