

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 跨服务混淆了副手预防 AWS
<a name="cross-service-confused-deputy-prevention"></a>

混淆代理问题是一个安全性问题，即不具有某操作执行权限的实体可能会迫使具有更高权限的实体执行该操作。在中 AWS，跨服务模仿可能会导致混乱的副手问题。一个服务（*呼叫服务*）调用另一项服务（*所谓的服务*）时，可能会发生跨服务模拟。可以操纵调用服务以使用其权限对另一个客户的资源进行操作，否则该服务不应有访问权限。为了防止这种情况，我们 AWS 提供了一些工具，帮助您保护所有服务的数据，这些服务委托人已被授予访问您账户中资源的权限。

建议在资源策略中使用 [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourcearn](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourcearn) 和 [https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceaccount](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_policies_condition-keys.html#condition-keys-sourceaccount) 全局条件上下文键，以限制 Amazon Connect 为其他服务提供的资源访问权限。如果使用两个全局条件上下文键，在同一策略语句中使用时，`aws:SourceAccount` 值和 `aws:SourceArn` 值中的账户必须使用相同的账户 ID。

防止混淆座席问题的有效方法是使用要允许的资源的确切 Amazon 资源名称 (ARN)。如果不知道资源的完整 ARN，或者正在指定多个资源，请针对 ARN 未知部分使用带有通配符（`*`）的 `aws:SourceArn` 全局上下文条件键。例如 `arn:aws:servicename::region-name::your AWS account ID:*`。

## Amazon Connect Customer Profiles 跨服务混淆座席问题防范
<a name="customer-profiles-cross-service"></a>

以下示例显示了适用于将其他人设置为 Amazon Connect Customer Profiles 管理员的情形的策略。使用这些策略可防范混淆座席问题。

**用于创建 Customer Profiles 域的 Amazon Connect Customer Profiles 示例策略**

**用于创建 Customer Profiles 对象类型的 Amazon Connect Customer Profiles 示例策略**

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": {
    "Sid": "ConfusedDeputyPreventionExamplePolicy",
    "Effect": "Allow",
    "Principal": {
      "Service": "profile.amazonaws.com"
    },
    "Action": [
        "kms:GenerateDataKey",
        "kms:CreateGrant",
        "kms:Decrypt"
       ],
    "Resource": [
      "arn:aws:kms:us-east-1:111122223333:key/KeyId"
    ],
    "Condition": {
      "ArnEquals": {
        "aws:SourceArn": "arn:aws:profile:us-east-1:111122223333:domains/CustomerProfilesDomainName/objects/YourObjectType"
      },
      "StringEquals": {
        "aws:SourceAccount": "111122223333"
      }
    }
  }
}
```

------

**用于创建和更新死信队列的 Amazon Connect Customer Profiles 示例策略**

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": [
    {
      "Sid": "Allow Customer Profiles to publish messages to your queue",
      "Effect": "Allow",
      "Principal": {
        "Service": "profile.amazonaws.com"
      },
      "Action": "sqs:SendMessage",
      "Resource": "arn:aws:sqs:us-east-1:111122223333:YourDeadLetterQueueName",

      "Condition": {
        "StringEquals": {
        "aws:SourceAccount": "111122223333",
        "aws:SourceArn": "arn:aws:profile:us-east-1:111122223333:domains/CustomerProfileDomainName"
        }
      }
    }
  ]
}
```

------

**用于在身份解析过程中保护所使用的 Amazon S3 存储桶的 Amazon Connect Customer Profiles 示例策略**

```
{
    "Sid": "Allow Amazon Connect Customer Profiles to put S3 objects to your bucket",
    "Effect": "Allow",
    "Principal": {
        "Service": "profile.amazonaws.com"
    },
    "Action": "s3:PutObject",
    "Resource": "arn:aws:s3:::amzn-s3-demo-bucket/*",
    "Condition": {
        "StringEquals": {
            "aws:SourceAccount": "your AWS account ID"
        },
        "ArnEquals": {
            "aws:SourceArn": "arn:aws:profile:your region name:your AWS account ID:domains/*"
        }
    }
}
```

## Amazon Connect Voice ID 跨服务混淆座席问题防范
<a name="voiceid-cross-service"></a>

以下 Voice ID 示例显示了要应用的资源策略，以防范混淆座席问题。

------
#### [ JSON ]

****  

```
{
  "Version":"2012-10-17",		 	 	 
  "Statement": {
    "Sid": "ConfusedDeputyPreventionExamplePolicy",
    "Effect": "Allow",
    "Principal": {
      "Service": "voiceid.amazonaws.com"
    },
    "Action": "sts:AssumeRole",
    "Condition": {
      "ArnEquals": {
        "aws:SourceArn": "arn:aws:voiceid:us-east-1:111122223333:domain/YourVoiceIDDomain"
      },
      "StringEquals": {
        "aws:SourceAccount": "111122223333"
      }
    }
  }
}
```

------

## Amazon Connect 聊天消息流跨服务混淆座席问题防范
<a name="connect-message-streaming-cross-service"></a>

以下 Amazon Connect 示例显示了要应用的资源策略，以防范混淆座席问题。

------
#### [ JSON ]

****  

```
{
   "Version":"2012-10-17",		 	 	 
   "Statement":[
      {
         "Effect":"Allow",
         "Principal":{
            "Service":"connect.amazonaws.com"
         },
         "Action":"sns:Publish",
         "Resource":"arn:aws:sns:us-east-1:111122223333:TopicName",
         "Condition":{
            "StringEquals":{
            "aws:SourceAccount":"111122223333"
            },
            "ArnEquals":{
            "aws:SourceArn":"arn:aws:connect:us-east-1:111122223333:instance/InstanceId"
            }
         }
      }
   ]
}
```

------