Skip to content

Commit b12dea4

Browse files
committed
fix: remove event info logging across all the lambdas, to prevent potential leak of sensitive customer data
1 parent 09425b6 commit b12dea4

File tree

20 files changed

+0
-102
lines changed
  • aws_sra_examples/solutions
    • account/account_alternate_contacts/lambda/src
    • cloudtrail/cloudtrail_org/lambda/src
    • common
      • common_prerequisites/lambda/src
      • common_register_delegated_administrator/lambda/src
    • config
      • config_management_account/lambda/src
      • config_org/lambda/src
    • detective/detective_org/lambda/src
    • ec2/ec2_default_ebs_encryption/lambda/src
    • firewall_manager/firewall_manager_org/lambda/src
    • genai
      • bedrock_guardrails/lambda/src
      • bedrock_org/lambda/src
    • guardduty/guardduty_org/lambda/src
    • iam/iam_password_policy/lambda/src
    • inspector/inspector_org/lambda/src
    • macie/macie_org/lambda/src
    • patch_mgmt/patch_mgmt_org/lambda/src
    • s3/s3_block_account_public_access/lambda/src
    • security_lake/security_lake_org/lambda/src
    • securityhub/securityhub_org/lambda/src
    • shield_advanced/shield_advanced/lambda/src

20 files changed

+0
-102
lines changed

aws_sra_examples/solutions/account/account_alternate_contacts/lambda/src/app.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,6 @@ def process_event(event: dict) -> None:
365365
Args:
366366
event: event data
367367
"""
368-
event_info = {"Event": event}
369-
LOGGER.info(event_info)
370368
params = get_validated_parameters({})
371369

372370
process_accounts(event, params)
@@ -398,8 +396,6 @@ def process_event_organizations(event: dict) -> None:
398396
Args:
399397
event: event data
400398
"""
401-
event_info = {"Event": event}
402-
LOGGER.info(event_info)
403399
params = get_validated_parameters({})
404400

405401
if event["detail"]["eventName"] == "TagResource" and params["EXCLUDE_ACCOUNT_TAGS"]:
@@ -427,8 +423,6 @@ def process_event_lifecycle(event: dict) -> None:
427423
Raises:
428424
ValueError: Control Tower Lifecycle Event not 'createManagedAccountStatus' or 'updateManagedAccountStatus'
429425
"""
430-
event_info = {"Event": event}
431-
LOGGER.info(event_info)
432426
params = get_validated_parameters({})
433427

434428
aws_account_id = ""
@@ -455,8 +449,6 @@ def process_event_cloudformation(event: CloudFormationCustomResourceEvent, conte
455449
Returns:
456450
AWS CloudFormation physical resource id
457451
"""
458-
event_info = {"Event": event}
459-
LOGGER.info(event_info)
460452

461453
if event["RequestType"] in ["Create", "Update"]:
462454
params = get_validated_parameters({"RequestType": event["RequestType"]})
@@ -619,8 +611,6 @@ def lambda_handler(event: dict, context: Any) -> None:
619611
"""
620612
LOGGER.info("....Lambda Handler Started....")
621613
try:
622-
event_info = {"Event": event}
623-
LOGGER.info(event_info)
624614
orchestrator(event, context)
625615
except Exception:
626616
LOGGER.exception(UNEXPECTED)

aws_sra_examples/solutions/cloudtrail/cloudtrail_org/lambda/src/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,6 @@ def process_event(event: CloudFormationCustomResourceEvent, context: Context) ->
323323
Returns:
324324
AWS CloudFormation physical resource id
325325
"""
326-
event_info = {"Event": event}
327-
LOGGER.info(event_info)
328326
LOGGER.debug(f"{context}")
329327

330328
params = get_validated_parameters(event)

aws_sra_examples/solutions/common/common_prerequisites/lambda/src/app.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,8 +444,6 @@ def create_update_event(event: CloudFormationCustomResourceEvent, context: Conte
444444
Returns:
445445
AWS CloudFormation physical resource id
446446
"""
447-
event_info = {"Event": event}
448-
LOGGER.info(event_info)
449447
params = get_validated_parameters(event)
450448
tags: Sequence[TagTypeDef] = [{"Key": params["TAG_KEY"], "Value": params["TAG_VALUE"]}]
451449

@@ -473,8 +471,6 @@ def delete_event(event: CloudFormationCustomResourceEvent, context: Context) ->
473471
event: event data
474472
context: runtime information
475473
"""
476-
event_info = {"Event": event}
477-
LOGGER.info(event_info)
478474
LOGGER.info("SRA SSM Parameters are being retained.")
479475
# delete_ssm_parameters_in_regions(get_enabled_regions()) # noqa: E800
480476

aws_sra_examples/solutions/common/common_register_delegated_administrator/lambda/src/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,6 @@ def terraform_handler(event: dict, context: Context) -> None:
276276
ValueError: Unexpected error executing Lambda function
277277
"""
278278
LOGGER.info("....Lambda Handler Started....")
279-
event_info = {"Event": event}
280-
LOGGER.info(event_info)
281279
try:
282280
request_type = event["RequestType"]
283281

aws_sra_examples/solutions/config/config_management_account/lambda/src/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ def process_event(event: CloudFormationCustomResourceEvent, context: Context) ->
171171
Returns:
172172
AWS CloudFormation physical resource id
173173
"""
174-
event_info = {"Event": event}
175-
LOGGER.info(event_info)
176174
params = get_validated_parameters(event)
177175

178176
management_account: str = context.invoked_function_arn.split(":")[4]

aws_sra_examples/solutions/config/config_org/lambda/src/app.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ def process_event(event: dict) -> None:
7474
Args:
7575
event: event data
7676
"""
77-
event_info = {"Event": event}
78-
LOGGER.info(event_info)
7977
params = get_validated_parameters({"RequestType": "Update"})
8078

8179
accounts = common.get_active_organization_accounts()
@@ -117,8 +115,6 @@ def process_event_organizations(event: dict) -> None:
117115
Args:
118116
event: event data
119117
"""
120-
event_info = {"Event": event}
121-
LOGGER.info(event_info)
122118
params = get_validated_parameters({})
123119

124120
if event["detail"]["eventName"] == "AcceptHandshake" and event["detail"]["responseElements"]["handshake"]["state"] == "ACCEPTED":
@@ -481,8 +477,6 @@ def process_event_cloudformation(event: CloudFormationCustomResourceEvent, conte
481477
Returns:
482478
AWS CloudFormation physical resource id
483479
"""
484-
event_info = {"Event": event}
485-
LOGGER.info(event_info)
486480

487481
params = get_validated_parameters({"RequestType": event["RequestType"]})
488482
accounts = common.get_active_organization_accounts()
@@ -533,8 +527,6 @@ def lambda_handler(event: Dict[str, Any], context: Any) -> None:
533527
LOGGER.info("....Lambda Handler Started....")
534528
boto3_version = boto3.__version__
535529
LOGGER.info(f"boto3 version: {boto3_version}")
536-
event_info = {"Event": event}
537-
LOGGER.info(event_info)
538530
try:
539531
orchestrator(event, context)
540532
except Exception:

aws_sra_examples/solutions/detective/detective_org/lambda/src/app.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,6 @@ def process_event(event: dict) -> None:
7272
Args:
7373
event: event data
7474
"""
75-
event_info = {"Event": event}
76-
LOGGER.info(event_info)
7775
params = get_validated_parameters({"RequestType": "Update"})
7876

7977
excluded_accounts: list = [params["DELEGATED_ADMIN_ACCOUNT_ID"]]
@@ -366,8 +364,6 @@ def process_event_cloudformation(event: CloudFormationCustomResourceEvent, conte
366364
Returns:
367365
AWS CloudFormation physical resource id
368366
"""
369-
event_info = {"Event": event}
370-
LOGGER.info(event_info)
371367

372368
params = get_validated_parameters({"RequestType": event["RequestType"]})
373369
excluded_accounts: list = [params["DELEGATED_ADMIN_ACCOUNT_ID"]]
@@ -412,8 +408,6 @@ def lambda_handler(event: Dict[str, Any], context: Any) -> None:
412408
LOGGER.info("....Lambda Handler Started....")
413409
boto3_version = boto3.__version__
414410
LOGGER.info(f"boto3 version: {boto3_version}")
415-
event_info = {"Event": event}
416-
LOGGER.info(event_info)
417411
try:
418412
orchestrator(event, context)
419413
except Exception:

aws_sra_examples/solutions/ec2/ec2_default_ebs_encryption/lambda/src/app.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ def process_event(event: dict) -> None:
345345
Args:
346346
event: event data
347347
"""
348-
event_info = {"Event": event}
349-
LOGGER.info(event_info)
350348
params = get_validated_parameters({})
351349

352350
process_accounts(event, params)
@@ -379,8 +377,6 @@ def process_event_organizations(event: dict) -> None:
379377
Args:
380378
event: event data
381379
"""
382-
event_info = {"Event": event}
383-
LOGGER.info(event_info)
384380
params = get_validated_parameters({})
385381

386382
if event["detail"]["eventName"] == "TagResource" and params["EXCLUDE_ACCOUNT_TAGS"]:
@@ -408,8 +404,6 @@ def process_event_lifecycle(event: dict) -> None:
408404
Raises:
409405
ValueError: Control Tower Lifecycle Event not 'createManagedAccountStatus' or 'updateManagedAccountStatus'
410406
"""
411-
event_info = {"Event": event}
412-
LOGGER.info(event_info)
413407
params = get_validated_parameters({})
414408

415409
aws_account_id = ""
@@ -436,8 +430,6 @@ def process_event_cloudformation(event: CloudFormationCustomResourceEvent, conte
436430
Returns:
437431
AWS CloudFormation physical resource id
438432
"""
439-
event_info = {"Event": event}
440-
LOGGER.info(event_info)
441433

442434
if event["RequestType"] in ["Create", "Update"]:
443435
params = get_validated_parameters({"RequestType": event["RequestType"]})
@@ -582,8 +574,6 @@ def lambda_handler(event: dict, context: Any) -> None:
582574
"""
583575
LOGGER.info("....Lambda Handler Started....")
584576
try:
585-
event_info = {"Event": event}
586-
LOGGER.info(event_info)
587577
orchestrator(event, context)
588578
except Exception:
589579
LOGGER.exception(UNEXPECTED)

aws_sra_examples/solutions/firewall_manager/firewall_manager_org/lambda/src/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,8 +188,6 @@ def process_event(event: CloudFormationCustomResourceEvent, context: Context) ->
188188
Raises:
189189
botocore.exceptions.ClientError: Client error
190190
"""
191-
event_info = {"Event": event}
192-
LOGGER.info(event_info)
193191
params = get_validated_parameters(event)
194192

195193
if params["action"] == "Add":

aws_sra_examples/solutions/genai/bedrock_guardrails/lambda/src/app.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -838,8 +838,6 @@ def create_event(event: dict, context: Any) -> str:
838838
DRY_RUN_DATA = {}
839839
LIVE_RUN_DATA = {}
840840

841-
event_info = {"Event": event}
842-
LOGGER.info(event_info)
843841
LOGGER.info(f"CFN_RESPONSE_DATA START: {CFN_RESPONSE_DATA}")
844842
# Deploy state table
845843
deploy_state_table()

0 commit comments

Comments
 (0)