AWS code-library documentation change
Summary
Updated client initialization methods to use fromEnvironment() and improved JSON policy formatting using Kotlin multiline strings
Security assessment
The changes primarily focus on code style improvements and using environment-aware client initialization. While using fromEnvironment() could be related to credential handling best practices, there's no direct evidence of addressing a specific security vulnerability. The JSON policy formatting change improves readability but doesn't alter security semantics. The SNS policy shown maintains the same permissions structure as before.
Diff
diff --git a/code-library/latest/ug/eventbridge_example_eventbridge_Scenario_GettingStarted_section.md b/code-library/latest/ug/eventbridge_example_eventbridge_Scenario_GettingStarted_section.md index 2aef0c1d3..7b64e9bcc 100644 --- a//code-library/latest/ug/eventbridge_example_eventbridge_Scenario_GettingStarted_section.md +++ b//code-library/latest/ug/eventbridge_example_eventbridge_Scenario_GettingStarted_section.md @@ -2052 +2052 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - IamClient { region = "us-east-1" }.use { iam -> + IamClient.fromEnvironment { region = "us-east-1" }.use { iam -> @@ -2073 +2073 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2117 +2117 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SnsClient { region = "us-east-1" }.use { snsClient -> + SnsClient.fromEnvironment { region = "us-east-1" }.use { snsClient -> @@ -2128 +2128 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2141 +2141 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2180 +2180 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2210 +2210 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2228 +2228 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2262 +2262 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2273 +2273 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2298 +2298 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2322 +2322 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2333 +2333 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2347 +2347 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2380 +2380 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2398 +2398 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SnsClient { region = "us-east-1" }.use { snsClient -> + SnsClient.fromEnvironment { region = "us-east-1" }.use { snsClient -> @@ -2405,13 +2405,16 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - val topicPolicy = - "{" + - "\"Version\": \"2012-10-17\"," + - "\"Statement\": [{" + - "\"Sid\": \"EventBridgePublishTopic\"," + - "\"Effect\": \"Allow\"," + - "\"Principal\": {" + - "\"Service\": \"events.amazonaws.com\"" + - "}," + - "\"Resource\": \"*\"," + - "\"Action\": \"sns:Publish\"" + - "}]" + - "}" + val topicPolicy = """ + { + "Version": "2012-10-17", + "Statement": [ + { + "Sid": "EventBridgePublishTopic", + "Effect": "Allow", + "Principal": { + "Service": "events.amazonaws.com" + }, + "Resource": "*", + "Action": "sns:Publish" + } + ] + } + """.trimIndent() @@ -2428 +2431 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - SnsClient { region = "us-east-1" }.use { snsClient -> + SnsClient.fromEnvironment { region = "us-east-1" }.use { snsClient -> @@ -2442 +2445 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2457 +2460,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - val pattern = """{ + val pattern = """ + { @@ -2465 +2469,2 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - }""" + } + """.trimIndent() @@ -2475 +2480 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - EventBridgeClient { region = "us-east-1" }.use { eventBrClient -> + EventBridgeClient.fromEnvironment { region = "us-east-1" }.use { eventBrClient -> @@ -2499 +2504 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2512 +2517 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3 -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3 -> @@ -2529 +2534 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - S3Client { region = "us-east-1" }.use { s3Client -> + S3Client.fromEnvironment { region = "us-east-1" }.use { s3Client -> @@ -2556 +2561 @@ There's more on GitHub. Find the complete example and learn how to set up and ru - IamClient { region = "us-east-1" }.use { iam -> + IamClient.fromEnvironment { region = "us-east-1" }.use { iam ->