mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-10-30 23:34:27 +00:00
fix(aws): remove cloudwatch_log_group_no_critical_pii_in_logs check (#5735)
This commit is contained in:
1 parent
f8e0db43b3
commit
dba914dede
13 files changed
+2
-1162
No files matched your search
@@ -33,16 +33,6 @@ old_config_aws = {
|
||||
"ec2_allowed_instance_owners": ["amazon-elb"],
|
||||
"trusted_account_ids": [],
|
||||
"log_group_retention_days": 365,
|
||||
"critical_pii_entities": [
|
||||
"CREDIT_CARD", # Credit card numbers are highly sensitive financial information.
|
||||
"CRYPTO", # Crypto wallet numbers (e.g., Bitcoin addresses) can give access to cryptocurrency.
|
||||
"IBAN_CODE", # International Bank Account Numbers are critical financial information.
|
||||
"US_BANK_NUMBER", # US bank account numbers are sensitive and should be protected.
|
||||
"US_SSN", # US Social Security Numbers are critical PII used for identity verification.
|
||||
"US_PASSPORT", # US passport numbers can be used for identity theft.
|
||||
"US_ITIN", # US Individual Taxpayer Identification Numbers are sensitive personal identifiers.
|
||||
],
|
||||
"pii_language": "en", # Language for recognizing PII entities
|
||||
"max_idle_disconnect_timeout_in_seconds": 600,
|
||||
"max_disconnect_timeout_in_seconds": 300,
|
||||
"max_session_duration_seconds": 36000,
|
||||
@@ -107,16 +97,6 @@ config_aws = {
|
||||
"fargate_windows_latest_version": "1.0.0",
|
||||
"trusted_account_ids": [],
|
||||
"log_group_retention_days": 365,
|
||||
"critical_pii_entities": [
|
||||
"CREDIT_CARD", # Credit card numbers are highly sensitive financial information.
|
||||
"CRYPTO", # Crypto wallet numbers (e.g., Bitcoin addresses) can give access to cryptocurrency.
|
||||
"IBAN_CODE", # International Bank Account Numbers are critical financial information.
|
||||
"US_BANK_NUMBER", # US bank account numbers are sensitive and should be protected.
|
||||
"US_SSN", # US Social Security Numbers are critical PII used for identity verification.
|
||||
"US_PASSPORT", # US passport numbers can be used for identity theft.
|
||||
"US_ITIN", # US Individual Taxpayer Identification Numbers are sensitive personal identifiers.
|
||||
],
|
||||
"pii_language": "en", # Language for recognizing PII entities
|
||||
"max_idle_disconnect_timeout_in_seconds": 600,
|
||||
"max_disconnect_timeout_in_seconds": 300,
|
||||
"max_session_duration_seconds": 36000,
|
||||
|
||||
@@ -72,31 +72,6 @@ aws:
|
||||
# AWS Cloudwatch Configuration
|
||||
# aws.cloudwatch_log_group_retention_policy_specific_days_enabled --> by default is 365 days
|
||||
log_group_retention_days: 365
|
||||
# aws.cloudwatch_log_group_no_critical_pii_in_logs --> see all available entities in https://microsoft.github.io/presidio/supported_entities/
|
||||
critical_pii_entities : [
|
||||
"CREDIT_CARD", # Credit card numbers are highly sensitive financial information.
|
||||
"CRYPTO", # Crypto wallet numbers (e.g., Bitcoin addresses) can give access to cryptocurrency.
|
||||
"IBAN_CODE", # International Bank Account Numbers are critical financial information.
|
||||
"US_BANK_NUMBER", # US bank account numbers are sensitive and should be protected.
|
||||
"US_SSN", # US Social Security Numbers are critical PII used for identity verification.
|
||||
"US_PASSPORT", # US passport numbers can be used for identity theft.
|
||||
"US_ITIN", # US Individual Taxpayer Identification Numbers are sensitive personal identifiers.
|
||||
#"UK_NHS", # UK NHS numbers can be used to access medical records and other private information.
|
||||
#"ES_NIF", # Spanish NIF (Personal tax ID) is critical for identification and tax purposes.
|
||||
#"ES_NIE", # Spanish NIE (Foreigners ID card) is a critical identifier for foreign residents.
|
||||
#"IT_FISCAL_CODE", # Italian personal identification code is sensitive PII for tax and legal purposes.
|
||||
#"IT_PASSPORT", # Italian passport numbers are critical PII.
|
||||
#"IT_IDENTITY_CARD", # Italian identity card numbers are critical for personal identification.
|
||||
#"PL_PESEL", # Polish PESEL numbers are sensitive personal identifiers.
|
||||
#"SG_NRIC_FIN", # Singapore National Registration Identification Card is critical PII.
|
||||
#"AU_ABN", # Australian Business Numbers are critical for business identification.
|
||||
#"AU_TFN", # Australian Tax File Numbers are sensitive and used for taxation purposes.
|
||||
#"AU_MEDICARE", # Australian Medicare numbers are sensitive medical identifiers.
|
||||
#"IN_PAN", # Indian Permanent Account Numbers are critical for tax purposes and identity.
|
||||
#"IN_AADHAAR", # Indian Aadhaar numbers are highly sensitive and serve as a universal identity number.
|
||||
#"FI_PERSONAL_IDENTITY_CODE" # Finnish Personal Identity Code is sensitive PII for personal identification.
|
||||
]
|
||||
pii_language: "en" # Language for recognizing PII entities
|
||||
|
||||
# AWS AppStream Session Configuration
|
||||
# aws.appstream_fleet_session_idle_disconnect_timeout
|
||||
|
||||
@@ -28,31 +28,6 @@ trusted_account_ids: []
|
||||
# AWS Cloudwatch Configuration
|
||||
# aws.cloudwatch_log_group_retention_policy_specific_days_enabled --> by default is 365 days
|
||||
log_group_retention_days: 365
|
||||
# aws.cloudwatch_log_group_no_critical_pii_in_logs --> see all available entities in https://microsoft.github.io/presidio/supported_entities/
|
||||
critical_pii_entities : [
|
||||
"CREDIT_CARD", # Credit card numbers are highly sensitive financial information.
|
||||
"CRYPTO", # Crypto wallet numbers (e.g., Bitcoin addresses) can give access to cryptocurrency.
|
||||
"IBAN_CODE", # International Bank Account Numbers are critical financial information.
|
||||
"US_BANK_NUMBER", # US bank account numbers are sensitive and should be protected.
|
||||
"US_SSN", # US Social Security Numbers are critical PII used for identity verification.
|
||||
"US_PASSPORT", # US passport numbers can be used for identity theft.
|
||||
"US_ITIN", # US Individual Taxpayer Identification Numbers are sensitive personal identifiers.
|
||||
#"UK_NHS", # UK NHS numbers can be used to access medical records and other private information.
|
||||
#"ES_NIF", # Spanish NIF (Personal tax ID) is critical for identification and tax purposes.
|
||||
#"ES_NIE", # Spanish NIE (Foreigners ID card) is a critical identifier for foreign residents.
|
||||
#"IT_FISCAL_CODE", # Italian personal identification code is sensitive PII for tax and legal purposes.
|
||||
#"IT_PASSPORT", # Italian passport numbers are critical PII.
|
||||
#"IT_IDENTITY_CARD", # Italian identity card numbers are critical for personal identification.
|
||||
#"PL_PESEL", # Polish PESEL numbers are sensitive personal identifiers.
|
||||
#"SG_NRIC_FIN", # Singapore National Registration Identification Card is critical PII.
|
||||
#"AU_ABN", # Australian Business Numbers are critical for business identification.
|
||||
#"AU_TFN", # Australian Tax File Numbers are sensitive and used for taxation purposes.
|
||||
#"AU_MEDICARE", # Australian Medicare numbers are sensitive medical identifiers.
|
||||
#"IN_PAN", # Indian Permanent Account Numbers are critical for tax purposes and identity.
|
||||
#"IN_AADHAAR", # Indian Aadhaar numbers are highly sensitive and serve as a universal identity number.
|
||||
#"FI_PERSONAL_IDENTITY_CODE" # Finnish Personal Identity Code is sensitive PII for personal identification.
|
||||
]
|
||||
pii_language: "en" # Language for recognizing PII entities
|
||||
|
||||
# AWS AppStream Session Configuration
|
||||
# aws.appstream_fleet_session_idle_disconnect_timeout
|
||||
|
||||
-206
@@ -1,206 +0,0 @@
|
||||
from re import search
|
||||
from unittest import mock
|
||||
|
||||
from boto3 import client
|
||||
from moto import mock_aws
|
||||
from moto.core.utils import unix_time_millis
|
||||
|
||||
from tests.providers.aws.utils import (
|
||||
AWS_REGION_EU_WEST_1,
|
||||
AWS_REGION_US_EAST_1,
|
||||
set_mocked_aws_provider,
|
||||
)
|
||||
|
||||
|
||||
class Test_cloudwatch_log_group_no_critical_pii_in_logs:
|
||||
def test_cloudwatch_no_log_groups(self):
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_service import Logs
|
||||
|
||||
aws_provider = set_mocked_aws_provider(
|
||||
[AWS_REGION_EU_WEST_1, AWS_REGION_US_EAST_1]
|
||||
)
|
||||
|
||||
from prowler.providers.common.models import Audit_Metadata
|
||||
|
||||
aws_provider.audit_metadata = Audit_Metadata(
|
||||
services_scanned=0,
|
||||
# We need to set this check to call _describe_log_groups
|
||||
expected_checks=["cloudwatch_log_group_no_critical_pii_in_logs"],
|
||||
completed_checks=0,
|
||||
audit_progress=0,
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.common.provider.Provider.get_global_provider",
|
||||
return_value=aws_provider,
|
||||
), mock.patch(
|
||||
"prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs.logs_client",
|
||||
new=Logs(aws_provider),
|
||||
):
|
||||
# Test Check
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs import (
|
||||
cloudwatch_log_group_no_critical_pii_in_logs,
|
||||
)
|
||||
|
||||
check = cloudwatch_log_group_no_critical_pii_in_logs()
|
||||
result = check.execute()
|
||||
|
||||
assert len(result) == 0
|
||||
|
||||
@mock_aws
|
||||
def test_cloudwatch_log_group_without_pii(self):
|
||||
# Generate Logs Client
|
||||
logs_client = client("logs", region_name=AWS_REGION_US_EAST_1)
|
||||
# Request Logs group
|
||||
logs_client.create_log_group(logGroupName="test", tags={"test": "test"})
|
||||
logs_client.create_log_stream(logGroupName="test", logStreamName="test stream")
|
||||
logs_client.put_log_events(
|
||||
logGroupName="test",
|
||||
logStreamName="test stream",
|
||||
logEvents=[
|
||||
{
|
||||
"timestamp": int(unix_time_millis()),
|
||||
"message": "non sensitive message",
|
||||
}
|
||||
],
|
||||
)
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_service import Logs
|
||||
|
||||
aws_provider = set_mocked_aws_provider(
|
||||
[AWS_REGION_EU_WEST_1, AWS_REGION_US_EAST_1]
|
||||
)
|
||||
|
||||
from prowler.providers.common.models import Audit_Metadata
|
||||
|
||||
aws_provider.audit_metadata = Audit_Metadata(
|
||||
services_scanned=0,
|
||||
# We need to set this check to call _describe_log_groups
|
||||
expected_checks=["cloudwatch_log_group_no_critical_pii_in_logs"],
|
||||
completed_checks=0,
|
||||
audit_progress=0,
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.common.provider.Provider.get_global_provider",
|
||||
return_value=aws_provider,
|
||||
), mock.patch(
|
||||
"prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs.logs_client",
|
||||
new=Logs(aws_provider),
|
||||
):
|
||||
# Test Check
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs import (
|
||||
cloudwatch_log_group_no_critical_pii_in_logs,
|
||||
)
|
||||
|
||||
check = cloudwatch_log_group_no_critical_pii_in_logs()
|
||||
result = check.execute()
|
||||
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "PASS"
|
||||
assert (
|
||||
result[0].status_extended == "No critical PII found in test log group."
|
||||
)
|
||||
assert result[0].resource_id == "test"
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:logs:{AWS_REGION_US_EAST_1}:123456789012:log-group:test"
|
||||
)
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource_tags == [{"test": "test"}]
|
||||
|
||||
@mock_aws
|
||||
def test_cloudwatch_log_group_with_pii(self):
|
||||
# Generate Logs Client
|
||||
logs_client = client("logs", region_name=AWS_REGION_US_EAST_1)
|
||||
# Request Logs group
|
||||
logs_client.create_log_group(logGroupName="test", tags={"test": "test"})
|
||||
logs_client.create_log_stream(logGroupName="test", logStreamName="test stream")
|
||||
logs_client.put_log_events(
|
||||
logGroupName="test",
|
||||
logStreamName="test stream",
|
||||
logEvents=[
|
||||
{
|
||||
"timestamp": int(unix_time_millis()),
|
||||
"message": "Credit Card Number = 374752619478856",
|
||||
}
|
||||
],
|
||||
)
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_service import Logs
|
||||
|
||||
aws_provider = set_mocked_aws_provider(
|
||||
[AWS_REGION_EU_WEST_1, AWS_REGION_US_EAST_1]
|
||||
)
|
||||
|
||||
from prowler.providers.common.models import Audit_Metadata
|
||||
|
||||
aws_provider.audit_metadata = Audit_Metadata(
|
||||
services_scanned=0,
|
||||
# We need to set this check to call _describe_log_groups
|
||||
expected_checks=["cloudwatch_log_group_no_critical_pii_in_logs"],
|
||||
completed_checks=0,
|
||||
audit_progress=0,
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.common.provider.Provider.get_global_provider",
|
||||
return_value=aws_provider,
|
||||
), mock.patch(
|
||||
"prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs.logs_client",
|
||||
new=Logs(aws_provider),
|
||||
):
|
||||
# Test Check
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs import (
|
||||
cloudwatch_log_group_no_critical_pii_in_logs,
|
||||
)
|
||||
|
||||
check = cloudwatch_log_group_no_critical_pii_in_logs()
|
||||
result = check.execute()
|
||||
|
||||
assert len(result) == 1
|
||||
assert result[0].status == "FAIL"
|
||||
assert search(
|
||||
"Potential critical PII found in log group", result[0].status_extended
|
||||
)
|
||||
assert result[0].resource_id == "test"
|
||||
assert (
|
||||
result[0].resource_arn
|
||||
== f"arn:aws:logs:{AWS_REGION_US_EAST_1}:123456789012:log-group:test"
|
||||
)
|
||||
assert result[0].region == AWS_REGION_US_EAST_1
|
||||
assert result[0].resource_tags == [{"test": "test"}]
|
||||
|
||||
@mock_aws
|
||||
def test_access_denied(self):
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_service import Logs
|
||||
|
||||
aws_provider = set_mocked_aws_provider(
|
||||
[AWS_REGION_EU_WEST_1, AWS_REGION_US_EAST_1]
|
||||
)
|
||||
|
||||
from prowler.providers.common.models import Audit_Metadata
|
||||
|
||||
aws_provider.audit_metadata = Audit_Metadata(
|
||||
services_scanned=0,
|
||||
# We need to set this check to call _describe_log_groups
|
||||
expected_checks=["cloudwatch_log_group_no_critical_pii_in_logs"],
|
||||
completed_checks=0,
|
||||
audit_progress=0,
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
"prowler.providers.common.provider.Provider.get_global_provider",
|
||||
return_value=aws_provider,
|
||||
), mock.patch(
|
||||
"prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs.logs_client",
|
||||
new=Logs(aws_provider),
|
||||
) as logs_client:
|
||||
# Test Check
|
||||
from prowler.providers.aws.services.cloudwatch.cloudwatch_log_group_no_critical_pii_in_logs.cloudwatch_log_group_no_critical_pii_in_logs import (
|
||||
cloudwatch_log_group_no_critical_pii_in_logs,
|
||||
)
|
||||
|
||||
logs_client.log_groups = None
|
||||
check = cloudwatch_log_group_no_critical_pii_in_logs()
|
||||
result = check.execute()
|
||||
|
||||
assert len(result) == 0
|
||||
Reference in new issue
Block a user