mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-07-23 12:31:54 +00:00
chore(findings): enhance m365 authentication method information (#7681)
This commit is contained in:
committed by
GitHub
parent
c20f07ced4
commit
b78f53a722
@@ -64,6 +64,7 @@ All notable changes to the **Prowler SDK** are documented in this file.
|
||||
- Add snapshots to m365 documentation. [(#7673)](https://github.com/prowler-cloud/prowler/pull/7673)
|
||||
- Add support for static credentials for sending findings to Amazon S3 and AWS Security Hub. [(#7322)](https://github.com/prowler-cloud/prowler/pull/7322)
|
||||
- Add Prowler ThreatScore for M365 provider. [(#7692)](https://github.com/prowler-cloud/prowler/pull/7692)
|
||||
- Add Microsoft User and User Credential auth to reports [(#7681)](https://github.com/prowler-cloud/prowler/pull/7681)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -581,6 +581,9 @@ class HTML(Output):
|
||||
<li class="list-group-item">
|
||||
<b>M365 Identity ID:</b> {provider.identity.identity_id}
|
||||
</li>
|
||||
{f'''<li class="list-group-item">
|
||||
<b>M365 User:</b> {provider.identity.user}
|
||||
</li>''' if hasattr(provider.identity, 'user') and provider.identity.user is not None else ""}
|
||||
</ul>
|
||||
</div>
|
||||
</div>"""
|
||||
|
||||
@@ -207,6 +207,7 @@ class M365Provider(Provider):
|
||||
m365_credentials=m365_credentials,
|
||||
provider_id=self.identity.tenant_domain,
|
||||
init_modules=init_modules,
|
||||
identity=self.identity,
|
||||
)
|
||||
|
||||
# Audit Config
|
||||
@@ -382,6 +383,7 @@ class M365Provider(Provider):
|
||||
m365_credentials: dict = {},
|
||||
provider_id: str = None,
|
||||
init_modules: bool = False,
|
||||
identity: M365IdentityInfo = None,
|
||||
) -> M365Credentials:
|
||||
"""Gets the M365 credentials.
|
||||
|
||||
@@ -394,6 +396,7 @@ class M365Provider(Provider):
|
||||
If False, returns empty credentials.
|
||||
"""
|
||||
credentials = None
|
||||
|
||||
if m365_credentials:
|
||||
credentials = M365Credentials(
|
||||
user=m365_credentials.get("user", ""),
|
||||
@@ -428,6 +431,9 @@ class M365Provider(Provider):
|
||||
)
|
||||
|
||||
if credentials:
|
||||
if identity:
|
||||
identity.identity_type = "Service Principal and User Credentials"
|
||||
identity.user = credentials.user
|
||||
test_session = M365PowerShell(credentials)
|
||||
try:
|
||||
if test_session.test_credentials(credentials):
|
||||
|
||||
@@ -10,6 +10,7 @@ class M365IdentityInfo(BaseModel):
|
||||
tenant_id: str = ""
|
||||
tenant_domain: str = "Unknown tenant domain (missing AAD permissions)"
|
||||
location: str = ""
|
||||
user: str = None
|
||||
|
||||
|
||||
class M365RegionConfig(BaseModel):
|
||||
|
||||
@@ -12,6 +12,7 @@ from tests.providers.gcp.gcp_fixtures import GCP_PROJECT_ID, set_mocked_gcp_prov
|
||||
from tests.providers.kubernetes.kubernetes_fixtures import (
|
||||
set_mocked_kubernetes_provider,
|
||||
)
|
||||
from tests.providers.m365.m365_fixtures import set_mocked_m365_provider
|
||||
|
||||
html_stats = {
|
||||
"total_pass": 25,
|
||||
@@ -222,6 +223,38 @@ kubernetes_html_assessment_summary = """
|
||||
</div>
|
||||
</div>"""
|
||||
|
||||
m365_html_assessment_summary = """
|
||||
<div class="col-md-2">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
M365 Assessment Summary
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<b>M365 Tenant Domain:</b> user.onmicrosoft.com
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
M365 Credentials
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">
|
||||
<b>M365 Identity Type:</b> Application
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>M365 Identity ID:</b> 00000000-0000-0000-0000-000000000000
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<b>M365 User:</b> user@email.com
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>"""
|
||||
|
||||
|
||||
def get_aws_html_header(args: list) -> str:
|
||||
"""
|
||||
@@ -554,3 +587,13 @@ class TestHTML:
|
||||
summary = output.get_assessment_summary(provider)
|
||||
|
||||
assert summary == kubernetes_html_assessment_summary
|
||||
|
||||
def test_m365_get_assessment_summary(self):
|
||||
findings = [generate_finding_output()]
|
||||
output = HTML(findings)
|
||||
provider = set_mocked_m365_provider()
|
||||
|
||||
summary = output.get_assessment_summary(provider)
|
||||
|
||||
expected_summary = m365_html_assessment_summary
|
||||
assert summary == expected_summary
|
||||
|
||||
@@ -29,6 +29,7 @@ def set_mocked_m365_provider(
|
||||
identity_type=IDENTITY_TYPE,
|
||||
tenant_id=TENANT_ID,
|
||||
tenant_domain=DOMAIN,
|
||||
user="user@email.com",
|
||||
),
|
||||
audit_config: dict = None,
|
||||
azure_region_config: M365RegionConfig = M365RegionConfig(),
|
||||
|
||||
Reference in New Issue
Block a user