Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@

from TIPCommon.extraction import extract_action_param, extract_configuration_param

from ..core.consts import INTEGRATION_NAME, GET_AUTHORIZATION_SCRIPT_NAME
from ..core.consts import (
INTEGRATION_NAME,
GET_AUTHORIZATION_SCRIPT_NAME,
DEFAULT_LOGIN_API_ROOT,
DEFAULT_API_ROOT,
)

AUTHORIZATION_URL = (
"https://login.microsoftonline.com/{tenant_id}/oauth2/v2.0/authorize?"
"{login_api_root}/{tenant_id}/oauth2/v2.0/authorize?"
"response_type=code&client_id={client_id}&redirect_uri={redirect_uri}&response_mode=query&"
"scope=https://management.azure.com/.default&state=12345"
"scope={api_root}/.default&state=12345"
)


Expand All @@ -49,6 +54,22 @@ def main():
is_mandatory=True,
print_value=True,
)
login_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Login API Root",
default_value=DEFAULT_LOGIN_API_ROOT,
is_mandatory=False,
print_value=True,
)
api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="API Root",
default_value=DEFAULT_API_ROOT,
is_mandatory=False,
print_value=True,
)

# Action configuration
redirect_url = extract_action_param(
Expand All @@ -58,7 +79,11 @@ def main():

try:
auth_link = AUTHORIZATION_URL.format(
tenant_id=tenant_id, client_id=client_id, redirect_uri=redirect_url
login_api_root=(login_api_root or DEFAULT_LOGIN_API_ROOT).rstrip("/"),
api_root=(api_root or DEFAULT_API_ROOT).rstrip("/"),
tenant_id=tenant_id,
client_id=client_id,
redirect_uri=redirect_url,
)
siemplify.result.add_link("Authorization Code Link", auth_link)
output_message = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@
from TIPCommon.extraction import extract_action_param, extract_configuration_param

from ..core.AzureSecurityCenterManager import AzureSecurityCenterManager
from ..core.consts import INTEGRATION_NAME, GENERATE_TOKEN_SCRIPT_NAME
from ..core.consts import (
INTEGRATION_NAME,
GENERATE_TOKEN_SCRIPT_NAME,
DEFAULT_LOGIN_API_ROOT,
)


@output_handler
Expand Down Expand Up @@ -50,6 +54,14 @@ def main():
param_name="Client Secret",
is_mandatory=True,
)
login_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Login API Root",
default_value=DEFAULT_LOGIN_API_ROOT,
is_mandatory=False,
print_value=True,
)
verify_ssl = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
Expand All @@ -76,6 +88,7 @@ def main():
code=authorization_code,
tenant_id=tenant_id,
verify_ssl=verify_ssl,
login_api_root=login_api_root,
)
siemplify.result.add_result_json(response_json)
output_message = f"Successfully generated refresh token in {INTEGRATION_NAME}."
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,8 @@ parameters:
description: Specify the authorization code from action "Get OAuth Authorization
Code"
is_mandatory: true
dynamic_results_metadata: []
dynamic_results_metadata:
- result_example_path: resources/GetOAuthRefreshToken_JsonResult_example.json
result_name: JsonResult
show_result: true
creator: admin
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@
LIST_REGULATORY_STANDARD_CONTROLS_SCRIPT_NAME,
REGULATORY_STANDARD_STATES,
DEFAULT_NUM_STANDARDS_TO_RETURN,
DEFAULT_LOGIN_API_ROOT,
DEFAULT_API_ROOT,
DEFAULT_GRAPH_API_ROOT,
)
from ..core.AzureSecurityCenterManager import AzureSecurityCenterManager
from ..core.exceptions import AzureSecurityCenterValidationException
Expand Down Expand Up @@ -89,6 +92,30 @@ def main():
param_name="Refresh Token",
is_mandatory=False,
)
login_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Login API Root",
default_value=DEFAULT_LOGIN_API_ROOT,
is_mandatory=False,
print_value=True,
)
api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="API Root",
default_value=DEFAULT_API_ROOT,
is_mandatory=False,
print_value=True,
)
graph_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Graph API Root",
default_value=DEFAULT_GRAPH_API_ROOT,
is_mandatory=False,
print_value=True,
)
verify_ssl = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
Expand Down Expand Up @@ -171,6 +198,9 @@ def main():
tenant_id=tenant_id,
refresh_token=refresh_token,
verify_ssl=verify_ssl,
login_api_root=login_api_root,
api_root=api_root,
graph_api_root=graph_api_root,
)

manager.get_regulatory_compliance_standards(subscription_id=subscription_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ parameters:
description: Specify how many controls to return per standard.
is_mandatory: false
dynamic_results_metadata:
- result_example_path: resources/list_regulatory_standard_controls_JsonResult_example.json
- result_example_path: resources/ListRegulatoryStandardControls_JsonResult_example.json
Comment thread
patilgp-oss marked this conversation as resolved.
result_name: JsonResult
show_result: true
creator: Admin
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
LIST_REGULATORY_STANDARDS_SCRIPT_NAME,
REGULATORY_STANDARD_STATES,
DEFAULT_NUM_STANDARDS_TO_RETURN,
DEFAULT_LOGIN_API_ROOT,
DEFAULT_API_ROOT,
DEFAULT_GRAPH_API_ROOT,
)
from ..core.exceptions import AzureSecurityCenterValidationException
from ..core.utils import load_csv_to_list
Expand Down Expand Up @@ -89,6 +92,30 @@ def main():
param_name="Refresh Token",
is_mandatory=False,
)
login_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Login API Root",
default_value=DEFAULT_LOGIN_API_ROOT,
is_mandatory=False,
print_value=True,
)
api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="API Root",
default_value=DEFAULT_API_ROOT,
is_mandatory=False,
print_value=True,
)
graph_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Graph API Root",
default_value=DEFAULT_GRAPH_API_ROOT,
is_mandatory=False,
print_value=True,
)
verify_ssl = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
Expand Down Expand Up @@ -161,6 +188,9 @@ def main():
tenant_id=tenant_id,
refresh_token=refresh_token,
verify_ssl=verify_ssl,
login_api_root=login_api_root,
api_root=api_root,
graph_api_root=graph_api_root,
)
regulatory_standards = manager.get_regulatory_standards(
state_filters=state_filter, limit=max_standards_to_return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ parameters:
description: Specify how many standards to return.
is_mandatory: false
dynamic_results_metadata:
- result_example_path: resources/list_regulatory_standards_JsonResult_example.json
- result_example_path: resources/ListRegulatoryStandards_JsonResult_example.json
Comment thread
patilgp-oss marked this conversation as resolved.
result_name: JsonResult
show_result: true
creator: Admin
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
from TIPCommon.extraction import extract_configuration_param

from ..core.AzureSecurityCenterManager import AzureSecurityCenterManager
from ..core.consts import PING_SCRIPT_NAME, INTEGRATION_NAME
from ..core.consts import (
PING_SCRIPT_NAME,
INTEGRATION_NAME,
DEFAULT_LOGIN_API_ROOT,
DEFAULT_API_ROOT,
DEFAULT_GRAPH_API_ROOT,
)


@output_handler
Expand Down Expand Up @@ -73,6 +79,30 @@ def main():
param_name="Refresh Token",
is_mandatory=False,
)
login_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Login API Root",
default_value=DEFAULT_LOGIN_API_ROOT,
is_mandatory=False,
print_value=True,
)
api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="API Root",
default_value=DEFAULT_API_ROOT,
is_mandatory=False,
print_value=True,
)
graph_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Graph API Root",
default_value=DEFAULT_GRAPH_API_ROOT,
is_mandatory=False,
print_value=True,
)
verify_ssl = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
Expand All @@ -93,6 +123,9 @@ def main():
tenant_id=tenant_id,
refresh_token=refresh_token,
verify_ssl=verify_ssl,
login_api_root=login_api_root,
api_root=api_root,
graph_api_root=graph_api_root,
)
manager.test_connectivity()
status = EXECUTION_STATE_COMPLETED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
DEFAULT_ALERT_STATUS,
MAPPED_ALERT_STATUS,
PLURAL_ALERT_STATUS,
DEFAULT_LOGIN_API_ROOT,
DEFAULT_API_ROOT,
DEFAULT_GRAPH_API_ROOT,
)
from ..core.utils import get_mapped_value

Expand Down Expand Up @@ -86,6 +89,30 @@ def main():
param_name="Refresh Token",
is_mandatory=False,
)
login_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Login API Root",
default_value=DEFAULT_LOGIN_API_ROOT,
is_mandatory=False,
print_value=True,
)
api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="API Root",
default_value=DEFAULT_API_ROOT,
is_mandatory=False,
print_value=True,
)
graph_api_root = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
param_name="Graph API Root",
default_value=DEFAULT_GRAPH_API_ROOT,
is_mandatory=False,
print_value=True,
)
verify_ssl = extract_configuration_param(
siemplify,
provider_name=INTEGRATION_NAME,
Expand Down Expand Up @@ -135,6 +162,9 @@ def main():
tenant_id=tenant_id,
refresh_token=refresh_token,
verify_ssl=verify_ssl,
login_api_root=login_api_root,
api_root=api_root,
graph_api_root=graph_api_root,
)
alert_status = get_mapped_value(MAPPED_ALERT_STATUS, alert_status)
manager.update_alert_status(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
TIME_FORMAT,
MAX_EVENTS_PER_ALERT,
HOURS_LIMIT_IN_IDS_FILE,
DEFAULT_LOGIN_API_ROOT,
DEFAULT_API_ROOT,
DEFAULT_GRAPH_API_ROOT,
)
from ..core.exceptions import AzureSecurityCenterValidationException
from ..core import utils
Expand Down Expand Up @@ -88,6 +91,27 @@ def main(is_test_run):
refresh_token = extract_connector_param(
siemplify, param_name="Refresh Token", is_mandatory=False, print_value=False
)
login_api_root = extract_connector_param(
siemplify,
param_name="Login API Root",
default_value=DEFAULT_LOGIN_API_ROOT,
is_mandatory=False,
print_value=True,
)
api_root = extract_connector_param(
siemplify,
param_name="API Root",
default_value=DEFAULT_API_ROOT,
is_mandatory=False,
print_value=True,
)
graph_api_root = extract_connector_param(
siemplify,
param_name="Graph API Root",
default_value=DEFAULT_GRAPH_API_ROOT,
is_mandatory=False,
print_value=True,
)
max_alerts_to_fetch = extract_connector_param(
siemplify,
param_name="Max Alerts To Fetch",
Expand Down Expand Up @@ -175,6 +199,9 @@ def main(is_test_run):
tenant_id=tenant_id,
siemplify=siemplify,
refresh_token=refresh_token,
login_api_root=login_api_root,
api_root=api_root,
graph_api_root=graph_api_root,
)

# Read already existing alerts ids
Expand Down
Loading
Loading