mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 12:31:54 +00:00
fix(app): change api call for app function ftps check
This commit is contained in:
@@ -136,6 +136,11 @@ class App(AzureService):
|
||||
subscription_name, function.resource_group, function.name
|
||||
)
|
||||
|
||||
web_app_config = client.web_apps.get_configuration(
|
||||
resource_group_name=function.resource_group,
|
||||
name=function.name,
|
||||
)
|
||||
|
||||
functions[subscription_name].update(
|
||||
{
|
||||
function.id: FunctionApp(
|
||||
@@ -162,7 +167,7 @@ class App(AzureService):
|
||||
"",
|
||||
),
|
||||
ftps_state=getattr(
|
||||
function_config, "ftps_state", None
|
||||
web_app_config, "ftps_state", ""
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -200,3 +200,47 @@ class Test_App_Service:
|
||||
.name
|
||||
== "name_diagnostic_setting2"
|
||||
)
|
||||
|
||||
def test_app_service_get_functions(self):
|
||||
with (
|
||||
patch(
|
||||
"prowler.providers.common.provider.Provider.get_global_provider",
|
||||
return_value=set_mocked_azure_provider(),
|
||||
),
|
||||
patch(
|
||||
"prowler.providers.azure.services.monitor.monitor_service.Monitor",
|
||||
new=MagicMock(),
|
||||
),
|
||||
):
|
||||
from prowler.providers.azure.services.app.app_service import FunctionApp
|
||||
|
||||
mock_function = FunctionApp(
|
||||
id="/subscriptions/resource_id",
|
||||
name="functionapp-1",
|
||||
location="West Europe",
|
||||
kind="functionapp",
|
||||
function_keys=None,
|
||||
enviroment_variables=None,
|
||||
identity=ManagedServiceIdentity(type="SystemAssigned"),
|
||||
public_access=True,
|
||||
vnet_subnet_id="",
|
||||
ftps_state="FtpsOnly",
|
||||
)
|
||||
|
||||
app_service = MagicMock()
|
||||
app_service.functions = {
|
||||
"mock-subscription": {"/subscriptions/resource_id": mock_function}
|
||||
}
|
||||
|
||||
assert (
|
||||
app_service.functions["mock-subscription"][
|
||||
"/subscriptions/resource_id"
|
||||
].ftps_state
|
||||
== "FtpsOnly"
|
||||
)
|
||||
assert (
|
||||
app_service.functions["mock-subscription"][
|
||||
"/subscriptions/resource_id"
|
||||
].name
|
||||
== "functionapp-1"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user