diff --git a/aws_organizations/main_organizations.yaml b/aws_organizations/main_organizations.yaml index bc2444f7..73f1975f 100644 --- a/aws_organizations/main_organizations.yaml +++ b/aws_organizations/main_organizations.yaml @@ -147,7 +147,13 @@ Resources: def handler(event, context): '''Handle Lambda event from AWS''' try: - LOGGER.info('REQUEST RECEIVED:\n %s', event) + sanitized_event = event.copy() + if 'ResourceProperties' in sanitized_event: + if 'APIKey' in sanitized_event['ResourceProperties']: + sanitized_event['ResourceProperties']['APIKey'] = '***' # replace APIKey value with *** + if 'APPKey' in sanitized_event['ResourceProperties']: + sanitized_event['ResourceProperties']['APPKey'] = '***' # replace APPKey value with *** + LOGGER.info('REQUEST RECEIVED:\n %s', sanitized_event) LOGGER.info('REQUEST RECEIVED:\n %s', context) if event['RequestType'] == 'Create': LOGGER.info('Received Create request.') diff --git a/aws_quickstart/datadog_integration_api_call.yaml b/aws_quickstart/datadog_integration_api_call.yaml index 9ba9b4d6..b99f89cd 100644 --- a/aws_quickstart/datadog_integration_api_call.yaml +++ b/aws_quickstart/datadog_integration_api_call.yaml @@ -140,7 +140,13 @@ Resources: def handler(event, context): '''Handle Lambda event from AWS''' try: - LOGGER.info('REQUEST RECEIVED:\n %s', event) + sanitized_event = event.copy() + if 'ResourceProperties' in sanitized_event: + if 'APIKey' in sanitized_event['ResourceProperties']: + sanitized_event['ResourceProperties']['APIKey'] = '***' # replace APIKey value with *** + if 'APPKey' in sanitized_event['ResourceProperties']: + sanitized_event['ResourceProperties']['APPKey'] = '***' # replace APPKey value with *** + LOGGER.info('REQUEST RECEIVED:\n %s', sanitized_event) LOGGER.info('REQUEST RECEIVED:\n %s', context) if event['RequestType'] == 'Create': LOGGER.info('Received Create request.') diff --git a/aws_quickstart/datadog_integration_api_call_v2.yaml b/aws_quickstart/datadog_integration_api_call_v2.yaml index 0bb7dc88..35b0b3f0 100644 --- a/aws_quickstart/datadog_integration_api_call_v2.yaml +++ b/aws_quickstart/datadog_integration_api_call_v2.yaml @@ -141,7 +141,13 @@ Resources: def handler(event, context): '''Handle Lambda event from AWS''' try: - LOGGER.info('REQUEST RECEIVED:\n %s', event) + sanitized_event = event.copy() + if 'ResourceProperties' in sanitized_event: + if 'APIKey' in sanitized_event['ResourceProperties']: + sanitized_event['ResourceProperties']['APIKey'] = '***' # replace APIKey value with *** + if 'APPKey' in sanitized_event['ResourceProperties']: + sanitized_event['ResourceProperties']['APPKey'] = '***' # replace APPKey value with *** + LOGGER.info('REQUEST RECEIVED:\n %s', sanitized_event) LOGGER.info('REQUEST RECEIVED:\n %s', context) if event['RequestType'] == 'Create': LOGGER.info('Received Create request.')