

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 中的跨服務混淆代理人預防 AWS
<a name="cross-service-confused-deputy-prevention"></a>

混淆代理人問題屬於安全性議題，其中沒有執行動作許可的實體可以強制具有更多許可的實體執行該動作。在 中 AWS，跨服務模擬可能會導致混淆代理人問題。在某個服務 (*呼叫服務*) 呼叫另一個服務 (*被呼叫服務*) 時，可能會發生跨服務模擬。可以操縱呼叫服務來使用其許可，以其不應有存取許可的方式對其他客戶的資源採取動作。為了防止這種情況， AWS 提供的工具可協助您保護所有 服務的資料，其服務主體已獲得您帳戶中資源的存取權。

若要限制 Amazon Connect 為資源提供另一項服務的許可，我們建議在資源政策中使用 [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) 全域條件內容金鑰。如果同時使用全域條件內容金鑰，則在相同政策陳述式中使用 `aws:SourceAccount` 值和 `aws:SourceArn` 值中的帳戶時，必須使用相同的帳戶 ID。

防範混淆代理人問題的最有效方法是精確使用您允許的資源 Amazon Resource Name (ARN) 資源。如果不知道資源的完整 ARN，或者如果您指定了多個資源，請使用 `aws:SourceArn` 全域條件內容金鑰，同時使用萬用字元 (`*`) 表示 ARN 的未知部分。例如 `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 Profile 網域的 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"
            }
         }
      }
   ]
}
```

------