diff --git a/.changes/8e7992a3-5add-4fc4-987f-c8bd0c6ef405.json b/.changes/8e7992a3-5add-4fc4-987f-c8bd0c6ef405.json new file mode 100644 index 00000000000..c9fce11bbbd --- /dev/null +++ b/.changes/8e7992a3-5add-4fc4-987f-c8bd0c6ef405.json @@ -0,0 +1,5 @@ +{ + "id": "8e7992a3-5add-4fc4-987f-c8bd0c6ef405", + "type": "bugfix", + "description": "Fix an issue where sections were not properly divided when parsing the config file" +} diff --git a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsConfigParser.kt b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsConfigParser.kt index 6b900f045bb..54afcd1b2ff 100644 --- a/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsConfigParser.kt +++ b/aws-runtime/aws-config/common/src/aws/sdk/kotlin/runtime/config/profile/AwsConfigParser.kt @@ -169,7 +169,7 @@ private fun mergeSections(tokenIndexMap: Map true false -> { - val prefixVariantExists = tokenIndexMap.keys.any { it.hasSectionPrefix && it.name == entry.key.name } + val prefixVariantExists = tokenIndexMap.keys.any { it.hasSectionPrefix && it.name == entry.key.name && it.type == entry.key.type } !prefixVariantExists } } diff --git a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/profile/SpecTestSuites.kt b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/profile/SpecTestSuites.kt index 05faed81aa3..e7b30a8134d 100644 --- a/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/profile/SpecTestSuites.kt +++ b/aws-runtime/aws-config/common/test/aws/sdk/kotlin/runtime/config/profile/SpecTestSuites.kt @@ -819,6 +819,24 @@ internal const val parserTestSuiteJson = """ } } } + }, + { + "name": "SSO Session in config file with same name as default profile", + "input": { + "configFile": "[default]\nname = profile-default\n[sso-session default]\nname = sso-session-default" + }, + "output": { + "profiles": { + "default": { + "name": "profile-default" + } + }, + "sso-sessions": { + "default": { + "name": "sso-session-default" + } + } + } } ] }