Skip to content

app_function_application_insights_enabled bug resulting in false positives #7298

@b3n-j4m1n

Description

@b3n-j4m1n

Steps to Reproduce

prowler azure --check app_function_application_insights_enabled

Expected behavior

check is only looking for APPINSIGHTS_INSTRUMENTATIONKEY environment variable and not APPLICATIONINSIGHTS_CONNECTION_STRING, either or both means Application Insights is enabled, currently if only APPLICATIONINSIGHTS_CONNECTION_STRING exists Prowler will report it as a FAIL when it is actually a PASS.

Actual Result with Screenshots or Logs

n/a

How did you install Prowler?

Cloning the repository from github.com (git clone)

Environment Resource

workstation

OS used

Windows

Prowler version

5.4.0

Pip version

24.0

Context

suggested updates:

prowler\providers\azure\services\app\app_service.py

...
instrumentation_key=getattr(
    component, "instrumentation_key", "Not Found"
        ),
    connection_string=getattr(
        component, "connection_string", "Not Found"
        ),
...
...
class Component(BaseModel):
    resource_id: str
    resource_name: str
    location: str
    instrumentation_key: str
    connection_string: str
...

prowler\providers\azure\services\app\app_function_application_insights_enabled\app_function_application_insights_enabled.py

...
if function.enviroment_variables.get(
                    "APPINSIGHTS_INSTRUMENTATIONKEY", ""
                ) in [
                    component.instrumentation_key
                    for component in appinsights_client.components[
                        subscription_name
                    ].values()
                ] or function.enviroment_variables.get(
                    "APPLICATIONINSIGHTS_CONNECTION_STRING", ""
                ) in [
                    component.connection_string
                    for component in appinsights_client.components[
                        subscription_name
                    ].values()
...

Metadata

Metadata

Assignees

Labels

bugprovider/azureIssues/PRs related with the Azure providerseverity/highBug capable of collapsing large parts of the execution.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions