Access Analyzer 策略检查参考 - AWS Identity and Access Management
错误 — 不允许 ARN 账户错误 — 不允许 ARN 区域错误 — 数据类型不匹配错误 — 使用不同的大小写重复密钥错误 — 无效的操作错误 — 无效的 ARN 账户错误 — 无效的 ARN 前缀错误 — 无效的 ARN 区域错误 — 无效的 ARN 资源错误 — 无效的 ARN 服务案例错误 — 无效的条件数据类型错误 — 无效的条件键格式错误 — 无效条件多个布尔值错误 — 无效的条件运算符错误 — 无效的效果错误 — 无效的全局条件键错误 — 无效的分区错误 — 无效的策略元素错误 — 无效的主体格式错误 — 无效的主体密钥错误 — 无效的区域错误 — 无效的服务错误 — 无效的服务条件键错误 — 操作中的无效服务错误 — 无效的运算符的变量错误 — 无效的版本错误 — Json 语法错误错误 — Json 语法错误错误 — 缺少操作错误 — 缺少 ARN 字段错误 — 缺少 ARN 区域错误 — 缺少效果错误 — 缺少主体错误 — 缺少限定符错误 — 缺少资源错误 — 缺少语句错误 — 如果存在则为空错误 — SCP 语法错误操作通配符错误 — SCP 语法错误允许条件错误 — SCP 语法错误允许 NotAction错误 — SCP 语法错误允许资源错误 — SCP 语法错误 NotResource错误 — SCP 语法错误主体错误 — 需要唯一的 Sid错误 — 策略中不支持的操作错误 — 不支持的元素组合错误 — 不支持的全局条件键错误 — 不支持的主体错误 — 策略中不支持的资源 ARN错误 — 不支持的 Sid错误 — 主体中不支持的通配符错误 — 变量中缺少大括号错误 — 变量中缺少引号错误 — 变量中不支持的空间错误 — 空变量错误 — 元素中不支持变量错误 — 版本中不支持变量错误 — 私有 IP 地址错误 — 私有 NotIpAddress错误 — 策略大小超过 SCP 配额错误 — 无效的服务主体格式错误 — 条件中缺少标签密钥错误 — VPC 格式无效错误 — vpce 格式无效错误 — 不支持联合主体错误 — 条件密钥的不支持的操作错误 — 策略中不支持的操作错误 — 策略中不支持的资源 ARN错误 — 服务主体的条件密钥不受支持错误 - 角色信任策略语法错误 notprincipal错误 - 主体中不支持的角色信任策略通配符错误 - 角色信任策略语法错误资源错误 - 类型与 IP 范围不匹配错误 - 缺少条件键的操作错误 - 角色信任策略中的联合主体语法无效错误 - 主体的操作不匹配错误 - 缺少 Roles Anywhere 信任策略的操作常规警告 — 使用 NotResource 创建 SLR常规警告 — 使用带有星号的操作和 NotResource 创建 SLR常规警告 — 使用 NotAction 和 NotResource 创建 SLR常规警告 — 使用带星号的资源创建 SLR常规警告 — 使用带星号的行动和资源创建 SLR常规警告 — 使用带有星号的资源和 NotAction 创建 SLR常规警告 — 已弃用的全局条件键常规警告 — 无效的日期值常规警告 — 无效的角色引用常规警告 — 无效的用户引用常规警告 — 缺少版本一般警告 — 建议的使用唯一的 Sid常规警告 — 没有类似运算符的通配符常规警告 — 策略大小超出身份策略配额常规警告 — 策略大小超出资源策略配额常规警告 — 类型不匹配常规警告 — 类型不匹配布尔值常规警告 — 类型不匹配日期常规警告 — 类型不匹配的数字常规警告 — 类型不匹配的字符串常规警告 - 建议使用特定的 github 存储库和分支常规警告 - 策略大小超出角色信任策略配额安全警告 — 允许使用 NotPrincipal安全警告 — 带有单值密钥的 ForAllValues安全警告 — 使用 NotResource 传递角色安全警告 — 使用带有星号的操作和 NotResource 传递角色安全警告 — 使用 NotAction 和 NotResource 传递角色安全警告 — 使用带有星号的资源传递角色安全警告 — 使用带有星号的行动和资源传递角色安全警告 — 使用带有星号的资源和 NotAction 传递角色安全警告 — 缺少配对条件键安全警告 — 使用不支持的标签条件键拒绝服务安全警告 — 使用不支持的标签条件键拒绝服务的 NotAction安全警告 — 限制对服务主体的访问安全警告 - 缺少 oidc 主体的条件键安全警告 - 缺少 github 存储库条件键建议 — 空数组操作建议 — 空数组条件建议 — 空数组条件 ForAllValues建议 — 空数组条件 ForAnyValue建议 — 空数组条件 IfExists建议 — 空数组主体建议 — 空数组资源建议 — 空对象条件建议 — 空对象主体建议 — 空 Sid 值建议 — 改善 IP 范围建议 — 带限定符的空值建议 — 私有 IP 地址子集建议 — 私有 NotIpAddress 子集建议 — 冗余操作建议 — 冗余条件值编号建议 — 冗余资源建议 — 冗余语句建议 — 服务名称中的通配符建议 — 使用不支持的标签条件键允许服务建议 — 使用不支持的标签条件键允许服务的 NotAction建议 — 服务主体的推荐条件密钥建议 — 策略中的条件密钥无关建议 - 角色信任政策中的冗余主体建议 - 确认受众声明类型

Access Analyzer 策略检查参考

您可以使用 AWS Identity and Access Management Access Analyzer 策略验证来验证您的策略。您可以在 IAM 控制台中使用 AWS CLI、AWS API 或 JSON 策略编辑器创建或编辑策略。IAM Access Analyzer 将根据 IAM policy 语法AWS 最佳实践来验证您的策略。您可以查看策略验证检查结果,其中包括策略的安全警告、错误、常规警告和策略建议。这些结果提供了可操作的建议,可帮助您编写可操作且符合安全最佳实践的策略。IAM Access Analyzer 提供的基本策略检查列表如下。运行策略验证检查不收取额外费用。要了解有关使用策略验证来验证策略的更多信息,请参阅 IAM Access Analyzer 策略验证

错误 — 不允许 ARN 账户

在 AWS Management Console 中,此检查的结果包括以下消息:

ARN account not allowed: The service {{service}} does not support specifying an account ID in the resource ARN.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The service {{service}} does not support specifying an account ID in the resource ARN."

解决错误

请从资源 ARN 中删除账户 ID。某些 AWS 服务的资源 ARN不支持指定账户 ID。

例如,Amazon S3 不支持将账户 ID 作为存储桶 ARN 中的命名空间。Amazon S3 存储桶名称是全局唯一的,并且命名空间由所有 AWS 账户共享。要查看 Amazon S3 中所有可用的资源类型,请参阅服务授权参考中的 Amazon S3 定义的资源类型

相关术语

错误 — 不允许 ARN 区域

在 AWS Management Console 中,此检查的结果包括以下消息:

ARN Region not allowed: The service {{service}} does not support specifying a Region in the resource ARN.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The service {{service}} does not support specifying a Region in the resource ARN."

解决错误

请从资源 ARN 中删除区域。某些 AWS 服务的资源 ARN不支持指定区域。

例如,IAM 是一项全球性服务。IAM 资源 ARN 的区域部分始终保留为空。IAM 资源是全球性的,如同现在的 AWS 账户。例如,以 IAM 用户身份登录后,您可以在任何地理区域访问 AWS 服务。

错误 — 数据类型不匹配

在 AWS Management Console 中,此检查的结果包括以下消息:

Data type mismatch: The text does not match the expected JSON data type {{data_type}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The text does not match the expected JSON data type {{data_type}}."

解决错误

请更新文本以使用支持的数据类型。

例如,Version 全局条件键需要 String 数据类型。如果您提供日期或整数,则数据类型将不匹配。

相关术语

错误 — 使用不同的大小写重复密钥

在 AWS Management Console 中,此检查的结果包括以下消息:

Duplicate keys with different case: The condition key {{key}} appears more than once with different capitalization in the same condition block. Remove the duplicate condition keys.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key {{key}} appears more than once with different capitalization in the same condition block. Remove the duplicate condition keys."

解决错误

查看同一条件数据块中的类似条件键,并对所有实例使用相同的大写字母。

条件数据块是策略语句 Condition 元素中的文本。条件键名称 不区分大小写。条件键是否区分大小写取决于您使用的条件运算符。有关条件键中区分大小写的更多信息,请参阅 IAM JSON 策略元素:Condition

相关术语

错误 — 无效的操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid action: The action {{action}} does not exist. Did you mean {{valid_action}}?

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The action {{action}} does not exist. Did you mean {{valid_action}}?"

解决错误

指定的操作无效。如果您键入了错误的服务前缀或操作名称,则可能会发生这种情况。对于一些常见问题,策略检查将返回建议的操作。

相关术语

出现此错误的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

以下 AWS 托管策略在其策略语句中包含无效操作。无效操作不会影响策略所授予的权限。使用 AWS 托管策略作为创建托管策略的参考时,AWS 会建议您从策略中删除无效操作。

错误 — 无效的 ARN 账户

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid ARN account: The resource ARN account ID {{account}} is not valid. Provide a 12-digit account ID.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The resource ARN account ID {{account}} is not valid. Provide a 12-digit account ID."

解决错误

请更新资源 ARN 中的账户 ID。账户 ID 是 12 位整数。要了解如何查看您的账户 ID,请参阅查找您的 AWS 账户 ID

相关术语

错误 — 无效的 ARN 前缀

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid ARN prefix: Add the required prefix (arn) to the resource ARN.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add the required prefix (arn) to the resource ARN."

解决错误

AWS 资源 ARN 必须包含所需 arn: 前缀。

相关术语

错误 — 无效的 ARN 区域

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid ARN Region: The Region {{region}} is not valid for this resource. Update the resource ARN to include a supported Region.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The Region {{region}} is not valid for this resource. Update the resource ARN to include a supported Region."

解决错误

资源类型在指定区域不支持。有关每个区域(不带终端节点)支持的 AWS 服务表,请参阅区域列表

相关术语

错误 — 无效的 ARN 资源

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid ARN resource: Resource ARN does not match the expected ARN format. Update the resource portion of the ARN.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Resource ARN does not match the expected ARN format. Update the resource portion of the ARN."

解决错误

资源 ARN 必须与已知资源类型的规范相匹配。要查看服务的预期 ARN 格式,请参阅AWS 服务的操作、资源和条件键。请选择服务的名称以查看其资源类型和 ARN 格式。

相关术语

错误 — 无效的 ARN 服务案例

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid ARN service case: Update the service name ${service} in the resource ARN to use all lowercase letters.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Update the service name ${service} in the resource ARN to use all lowercase letters."

解决错误

资源 ARN 中的服务必须与服务前缀的规范(包括大写)匹配。要查看服务的前缀,请参阅AWS 服务的操作、资源和条件键。请选择服务的名称并在第一句中找到服务的前缀。

相关术语

错误 — 无效的条件数据类型

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid condition data type: The condition value data types do not match. Use condition values of the same JSON data type.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition value data types do not match. Use condition values of the same JSON data type."

解决错误

条件键值对中的值必须与条件键和条件运算符的数据类型匹配。要查看服务的条件键数据类型,请参阅AWS 服务的操作、资源和条件键。请选择服务名称以查看该服务的条件键。

例如,CurrentTime 全局条件键支持 Date 条件运算符。如果为条件数据块中的值提供字符串或整数,则数据类型将不匹配。

相关术语

错误 — 无效的条件键格式

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid condition key format: The condition key format is not valid. Use the format service:keyname.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key format is not valid. Use the format service:keyname."

解决错误

条件键值对中的键必须与服务的规格匹配。要查看每个服务定义的条件键,请参阅 AWS 服务的操作、资源和条件键。请选择服务名称以查看该服务的条件键。

相关术语

错误 — 无效条件多个布尔值

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid condition multiple Boolean: The condition key does not support multiple Boolean values. Use a single Boolean value.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key does not support multiple Boolean values. Use a single Boolean value."

解决错误

条件键值对中的键需要一个布尔值。当您提供多个布尔值时,条件匹配可能不会返回您期望的结果。

要查看每个服务定义的条件键,请参阅 AWS 服务的操作、资源和条件键。请选择服务名称以查看该服务的条件键。

错误 — 无效的条件运算符

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid condition operator: The condition operator {{operator}} is not valid. Use a valid condition operator.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition operator {{operator}} is not valid. Use a valid condition operator."

解决错误

请更新条件以使用受支持的条件运算符。

相关术语

错误 — 无效的效果

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid effect: The effect {{effect}} is not valid. Use Allow or Deny.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The effect {{effect}} is not valid. Use Allow or Deny."

解决错误

请更新 Effect 元素以使用有效的效果。Effect 的有效值为 AllowDeny

相关术语

错误 — 无效的全局条件键

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid global condition key: The condition key {{key}} does not exist. Use a valid condition key.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key {{key}} does not exist. Use a valid condition key."

解决错误

请更新条件键值对中的条件键以使用受支持的全局条件键。

全局条件键是带有 aws: 前缀的条件键。AWS 服务既可支持全局条件键,也可提供包含服务前缀的服务特定键。例如,IAM 条件键包含 iam: 前缀。有关更多信息,请参阅 AWS 服务的操作、资源和条件键,然后选择要查看其键的服务。

相关术语

错误 — 无效的分区

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid partition: The resource ARN for the service {{service}} does not support the partition {{partition}}. Use the supported values: {{partitions}}

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The resource ARN for the service {{service}} does not support the partition {{partition}}. Use the supported values: {{partitions}}"

解决错误

请更新资源 ARN 以包含支持的分区。如果您已包含支持的分区,则服务或资源可能不支持您包含的分区。

分区 是一组 AWS 区域。每个 AWS 账户的作用域为一个分区。在 Classic 区域中,使用 aws 分区。在中国区域中,使用 aws-cn

相关术语

错误 — 无效的策略元素

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid policy element: The policy element {{element}} is not valid.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The policy element {{element}} is not valid."

解决错误

请更新策略以仅包含受支持的 JSON 策略元素。

相关术语

错误 — 无效的主体格式

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid principal format: The Principal element contents are not valid. Specify a key-value pair in the Principal element.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The Principal element contents are not valid. Specify a key-value pair in the Principal element."

解决错误

更新主体以使用受支持的键值对格式。

您可以在基于资源的策略中指定主体,但不能采用基于身份的策略。

例如,要为 AWS 账户中的每个人定义访问权限,请在策略中使用以下主体:

"Principal": { "AWS": "123456789012" }

相关术语

错误 — 无效的主体密钥

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid principal key: The principal key {{principal-key}} is not valid.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The principal key {{principal-key}} is not valid."

解决错误

更新主体键值对中的键以使用受支持的主体密钥。以下是受支持的主体密钥:

  • AWS

  • CanonicalUser

  • 联合身份

  • 服务

相关术语

错误 — 无效的区域

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid Region: The Region {{region}} is not valid. Update the condition value to a suported Region.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The Region {{region}} is not valid. Update the condition value to a suported Region."

解决错误

请更新条件键值对的值以包含受支持的区域。有关每个区域(不带终端节点)支持的 AWS 服务表,请参阅区域列表

相关术语

错误 — 无效的服务

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid service: The service {{service}} does not exist. Use a valid service name.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The service {{service}} does not exist. Use a valid service name."

解决错误

操作或条件键中的服务前缀必须与服务前缀的规范(包括大写)匹配。要查看服务的前缀,请参阅 AWS 服务的操作、资源和条件键。请选择服务的名称并在第一句中找到服务的前缀。

相关术语

错误 — 无效的服务条件键

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid service condition key: The condition key {{key}} does not exist in the service {{service}}. Use a valid condition key.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key {{key}} does not exist in the service {{service}}. Use a valid condition key."

解决错误

请更新条件键值对中的键以使用服务的已知条件键。全局条件键名称以 aws 前缀开头。AWS 服务可提供包含服务前缀的服务特定密钥。要查看服务的前缀,请参阅 AWS 服务的操作、资源和条件键

相关术语

错误 — 操作中的无效服务

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid service in action: The service {{service}} specified in the action does not exist. Did you mean {{service2}}?

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The service {{service}} specified in the action does not exist. Did you mean {{service2}}?"

解决错误

操作中的服务前缀必须与服务前缀的规范(包括大写)匹配。要查看服务的前缀,请参阅 AWS 服务的操作、资源和条件键。请选择服务的名称并在第一句中找到服务的前缀。

相关术语

错误 — 无效的运算符的变量

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid variable for operator: Policy variables can only be used with String and ARN operators.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Policy variables can only be used with String and ARN operators."

解决错误

您可以在 Resource 元素中和 Condition 元素的字符串比较中使用策略变量。当您使用字符串运算符或 ARN 运算符时,条件支持变量。字符串运算符包括 StringEqualsStringLikeStringNotLike。ARN 运算符包括 ArnEqualsArnLike。不能将策略变量与其他运算符(如数字、日期、布尔值、二进制、IP 地址或 Null 运算符)一起使用。

相关术语

错误 — 无效的版本

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid version: The version ${version} is not valid. Use one of the following versions: ${versions}

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The version ${version} is not valid. Use one of the following versions: ${versions}"

解决错误

Version 策略元素指定 AWS 用于处理策略的语言语法规则。要使用所有可用策略功能,将以下 Version 元素包含在所有策略中的 Statement 元素之前。

"Version": "2012-10-17"

相关术语

错误 — Json 语法错误

在 AWS Management Console 中,此检查的结果包括以下消息:

Json syntax error: Fix the JSON syntax error at index {{index}} line {{line}} column {{column}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Fix the JSON syntax error at index {{index}} line {{line}} column {{column}}."

解决错误

您的策略包含语法错误。请检查您的 JSON 语法。

相关术语

错误 — Json 语法错误

在 AWS Management Console 中,此检查的结果包括以下消息:

Json syntax error: Fix the JSON syntax error.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Fix the JSON syntax error."

解决错误

您的策略包含语法错误。请检查您的 JSON 语法。

相关术语

错误 — 缺少操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing action: Add an Action or NotAction element to the policy statement.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add an Action or NotAction element to the policy statement."

解决错误

AWS JSON 策略必须包含 Action 或者 NotAction 元素。

相关术语

错误 — 缺少 ARN 字段

在 AWS Management Console 中,则此检查的结果包括以下消息:

Missing ARN field: Resource ARNs must include at least {{fields}} fields in the following structure: arn:partition:service:region:account:resource

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Resource ARNs must include at least {{fields}} fields in the following structure: arn:partition:service:region:account:resource"

解决错误

资源 ARN 中的所有字段都必须与已知资源类型的规范相匹配。要查看服务的预期 ARN 格式,请参阅AWS 服务的操作、资源和条件键。请选择服务的名称以查看其资源类型和 ARN 格式。

相关术语

错误 — 缺少 ARN 区域

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing ARN Region: Add a Region to the {{service}} resource ARN.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a Region to the {{service}} resource ARN."

解决错误

大多数 AWS 服务的资源 ARN 都需要您指定一个区域。有关每个区域(不带终端节点)支持的 AWS 服务表,请参阅区域列表

相关术语

错误 — 缺少效果

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing effect: Add an Effect element to the policy statement with a value of Allow or Deny.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add an Effect element to the policy statement with a value of Allow or Deny."

解决错误

AWS JSON 策略必须包含 Effect 元素,其值为 AllowDeny

相关术语

错误 — 缺少主体

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing principal: Add a Principal element to the policy statement.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a Principal element to the policy statement."

解决错误

基于资源的策略必须包含 Principal 元素。

例如,要为 AWS 账户中的每个人定义访问权限,请在策略中使用以下主体:

"Principal": { "AWS": "123456789012" }

相关术语

错误 — 缺少限定符

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing qualifier: The request context key ${key} has multiple values. Use the ForAllValues or ForAnyValue condition key qualifiers in your policy.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The request context key ${key} has multiple values. Use the ForAllValues or ForAnyValue condition key qualifiers in your policy."

解决错误

Condition 元素中,您可构建表达式并使用条件运算符(等于、小于等)将策略中的条件键和值与请求上下文中的键和值进行匹配。对于包含单个条件键的多个值的请求,必须将条件括在方括号内,例如数组 ("Key2":["Value2A", "Value2B"])。您还必须将 ForAllValuesForAnyValue 集合运算符与 StringLike 条件运算符搭配使用。这些限定词为条件运算符添加了集合运算功能,以便您针对多个条件值测试多个请求值。

相关术语

出现此错误的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

以下 AWS 托管策略在其策略语句中包含缺少的条件键限定符。使用 AWS 托管策略作为创建客户托管策略的参考时,AWS 会建议您将 ForAllValuesForAnyValue 条件键限定符添加到 Condition 元素。

错误 — 缺少资源

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing resource: Add a Resource or NotResource element to the policy statement.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a Resource or NotResource element to the policy statement."

解决错误

除角色信任策略之外的所有策略都必须包含 ResourceNotResource 元素。

相关术语

错误 — 缺少语句

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing statement: Add a statement to the policy

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a statement to the policy"

解决错误

JSON 策略必须包含语句。

相关术语

错误 — 如果存在则为空

在 AWS Management Console 中,此检查的结果包括以下消息:

Null with if exists: The Null condition operator cannot be used with the IfExists suffix. Update the operator or the suffix.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The Null condition operator cannot be used with the IfExists suffix. Update the operator or the suffix."

解决错误

Null 条件运算符外,您可在任何条件运算符名称的末尾添加 IfExists。使用 Null 条件运算符检查授权时是否有条件键。使用 ...ifExists “如果请求的内容中存在策略键,则依照策略所述来处理键。如果该键不存在,则条件元素的计算结果将为 true。”

相关术语

错误 — SCP 语法错误操作通配符

在 AWS Management Console 中,此检查的结果包括以下消息:

SCP syntax error action wildcard: SCP actions can include wildcards (*) only at the end of a string. Update {{action}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "SCP actions can include wildcards (*) only at the end of a string. Update {{action}}."

解决错误

AWS Organizations 服务控制策略 (SCP) 支持在 ActionNotAction 元素中指定值。但是,这些值只能在字符串末尾包含通配符 (*)。这意味着您可以指定 iam:Get* 但不能指定 iam:*role

要指定多个操作,AWS 建议您单独列出它们。

相关术语

错误 — SCP 语法错误允许条件

在 AWS Management Console 中,此检查的结果包括以下消息:

SCP syntax error allow condition: SCPs do not support the Condition element with effect Allow. Update the element Condition or the effect.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "SCPs do not support the Condition element with effect Allow. Update the element Condition or the effect."

解决错误

AWS Organizations 服务控制策略 (SCP) 仅支持当您在使用 "Effect": "Deny" 时指定 Condition 元素。

要仅允许执行单个操作,您可以拒绝除对使用 ...NotEquals 版本条件运算符指定的条件以外的所有访问。这否定了运算符所做的比较。

相关术语

错误 — SCP 语法错误允许 NotAction

在 AWS Management Console 中,此检查的结果包括以下消息:

SCP syntax error allow NotAction: SCPs do not support NotAction with effect Allow. Update the element NotAction or the effect.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "SCPs do not support NotAction with effect Allow. Update the element NotAction or the effect."

解决错误

AWS Organizations 服务控制策略 (SCP) 不支持使用带有元素 "Effect": "Allow"NotAction

您必须重写逻辑以允许操作列表或拒绝所有未列出的操作。

相关术语

错误 — SCP 语法错误允许资源

在 AWS Management Console 中,此检查的结果包括以下消息:

SCP syntax error allow resource: SCPs do not support Resource with effect Allow. Update the element Resource or the effect.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "SCPs do not support Resource with effect Allow. Update the element Resource or the effect."

解决错误

AWS Organizations 服务控制策略 (SCP) 仅支持当您在使用 "Effect": "Deny" 时指定 Resource 元素。

您必须重写逻辑以允许所有资源或拒绝列出的每个资源。

相关术语

错误 — SCP 语法错误 NotResource

在 AWS Management Console 中,此检查的结果包括以下消息:

SCP syntax error NotResource: SCPs do not support the NotResource element. Update the policy to use Resource instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "SCPs do not support the NotResource element. Update the policy to use Resource instead."

解决错误

AWS Organizations 服务控制策略 (SCP) 不支持 NotResource 元素。

您必须重写逻辑以允许所有资源或拒绝列出的每个资源。

相关术语

错误 — SCP 语法错误主体

在 AWS Management Console 中,此检查的结果包括以下消息:

SCP syntax error principal: SCPs do not support specifying principals. Remove the Principal or NotPrincipal element.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "SCPs do not support specifying principals. Remove the Principal or NotPrincipal element."

解决错误

AWS Organizations 服务控制策略 (SCP) 不支持 PrincipalNotPrincipal 元素。

您可以使用 aws:PrincipalArn 全局条件键在 Condition 元素中指定 Amazon Resource Name (ARN)。

相关术语

错误 — 需要唯一的 Sid

在 AWS Management Console 中,此检查的结果包括以下消息:

Unique Sids required: Duplicate statement IDs are not supported for this policy type. Update the Sid value.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Duplicate statement IDs are not supported for this policy type. Update the Sid value."

解决错误

对于某些策略类型,语句 ID 必须是唯一的。Sid(声明 ID)元素允许您针对策略语句输入可选标识符。您可以在使用 SID 元素的语句数组中为每个语句指定语句 ID 的值。在允许您指定 ID 元素的产品中,例如 SQS 和 SNS,Sid 值正是策略文件 ID 的子 ID。例如,在 IAM 中,Sid 值必须在 JSON 策略中是唯一的。

相关术语

错误 — 策略中不支持的操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported action in policy: The action {{action}} is not supported for the resource-based policy attached to the resource type {{resourceType}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The action {{action}} is not supported for the resource-based policy attached to the resource type {{resourceType}}."

解决错误

附加到不同资源类型的基于资源策略中的 Action 元素不支持某些操作。例如,Amazon S3 存储桶策略中不支持 AWS Key Management Service 操作。指定附加到基于资源的策略的资源类型支持的操作。

相关术语

错误 — 不支持的元素组合

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported element combination: The policy elements ${element1} and ${element2} can not be used in the same statement. Remove one of these elements.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The policy elements ${element1} and ${element2} can not be used in the same statement. Remove one of these elements."

解决错误

某些 JSON 策略元素的组合不能一起使用。例如,您不能在同一策略语句中同时使用 ActionNotAction。相互排斥的其他对包括 Principal/NotPrincipalResource/NotResource

相关术语

错误 — 不支持的全局条件键

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported global condition key: The condition key aws:ARN is not supported. Use aws:PrincipalArn or aws:SourceArn instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key aws:ARN is not supported. Use aws:PrincipalArn or aws:SourceArn instead."

解决错误

AWS 不支持使用指定的全局条件键。根据您的使用案例,您可以使用 aws:PrincipalArnaws:SourceArn 全局条件键。例如,与 aws:ARN 不同,使用 aws:PrincipalArn 将发出请求的主体的 Amazon Resource Name (ARN) 与您在策略中指定的 ARN 进行比较。或者,使用 aws:SourceArn 全局条件键可将发出服务到服务请求的资源的 Amazon Resource Name (ARN) 与您在策略中指定的 ARN 进行比较。

相关术语

错误 — 不支持的主体

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported principal: The policy type ${policy_type} does not support the Principal element. Remove the Principal element.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The policy type ${policy_type} does not support the Principal element. Remove the Principal element."

解决错误

Principal 元素指定允许或拒绝访问资源的主体。无法在基于 IAM 身份的策略中使用 Principal 元素。可以在 IAM 角色的信任策略和基于资源的策略中使用它。基于资源的策略是直接嵌入资源中的策略。例如,您可以在 Amazon S3 存储桶或 AWS KMS 键中嵌入策略。

相关术语

错误 — 策略中不支持的资源 ARN

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported resource ARN in policy: The resource ARN is not supported for the resource-based policy attached to the resource type {{resourceType}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The resource ARN is not supported for the resource-based policy attached to the resource type {{resourceType}}."

解决错误

策略附加到不同资源类型时,基于资源策略中的 Resource 元素不支持某些操作。例如,Amazon S3 存储桶策略的 Resource 元素中不支持 AWS KMS ARN。指定附加到基于资源的策略的资源类型支持的资源 ARN。

相关术语

错误 — 不支持的 Sid

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported Sid: Update the characters in the Sid element to use one of the following character types: [a-z, A-Z, 0-9]

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Update the characters in the Sid element to use one of the following character types: [a-z, A-Z, 0-9]"

解决错误

Sid 元素支持大写字母、小写字母和数字。

相关术语

错误 — 主体中不支持的通配符

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported wildcard in principal: Wildcards (*, ?) are not supported with the principal key {{principal_key}}. Replace the wildcard with a valid principal value.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Wildcards (*, ?) are not supported with the principal key {{principal_key}}. Replace the wildcard with a valid principal value."

解决错误

Principal 元素结构支持使用键值对。策略中指定的主体值包含通配符 (*)。您不能在指定的主体密钥中包含通配符。当在 Principal 元素中指定用户时,不能使用通配符表示“所有用户”。您必须对一个特定用户或多个用户命名。同样地,当您指定代入角色会话时,不能使用通配符表示“所有会话”。您必须指明特定会话。同时,您不能使用通配符匹配一部分名称或 ARN。

要解决此结果,请移除通配符并提供更具体的主体。

相关术语

错误 — 变量中缺少大括号

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing brace in variable: The policy variable is missing a closing curly brace. Add } after the variable text.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The policy variable is missing a closing curly brace. Add } after the variable text."

解决错误

策略变量结构支持使用 $ 前缀,后跟一对大括号 ({ })。在 ${ } 字符内,包含想要在策略中使用的请求中的值名称。

若要解决此结果,请添加缺少的大括号,以确保存在完整的大括号开闭集。

相关术语

错误 — 变量中缺少引号

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing quote in variable: The policy variable default value must begin and end with a single quote. Add the missing quote.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The policy variable default value must begin and end with a single quote. Add the missing quote."

解决错误

向策略添加变量时,您可以为变量指定默认值。如果不存在变量,则 AWS 使用您提供的原定设置文本。

要向变量添加默认值,请用单引号 (' ') 括起默认值,并用逗号和空格 (, ) 分隔变量文本和默认值。

例如,如果主体使用 team=yellow 标记,他们可以访问名为 DOC-EXAMPLE-BUCKET-yellowDOC-EXAMPLE-BUCKET Amazon S3 存储桶。使用此资源的策略可能允许团队成员访问自己的资源,但不能访问其他团队的资源。对于没有团队标签的用户,您可以将原定设置值设为 company-wide。这些用户只能访问 DOC-EXAMPLE-BUCKET-company-wide 存储桶,他们可以在其中查看广泛的信息,例如加入团队的说明。

"Resource":"arn:aws:s3:::DOC-EXAMPLE-BUCKET-${aws:PrincipalTag/team, 'company-wide'}"

相关术语

错误 — 变量中不支持的空间

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported space in variable: A space is not supported within the policy variable text. Remove the space.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "A space is not supported within the policy variable text. Remove the space."

解决错误

策略变量结构支持使用 $ 前缀,后跟一对大括号 ({ })。在 ${ } 字符内,包含想要在策略中使用的请求中的值名称。虽然在指定默认变量时可以包含空格,但不能在变量名称中包含空格。

相关术语

错误 — 空变量

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty variable: Empty policy variable. Remove the ${ } variable structure or provide a variable within the structure.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Empty policy variable. Remove the ${ } variable structure or provide a variable within the structure."

解决错误

策略变量结构支持使用 $ 前缀,后跟一对大括号 ({ })。在 ${ } 字符内,包含想要在策略中使用的请求中的值名称。

相关术语

错误 — 元素中不支持变量

在 AWS Management Console 中,此检查的结果包括以下消息:

Variable unsupported in element: Policy variables are supported in the Resource and Condition elements. Remove the policy variable {{variable}} from this element.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Policy variables are supported in the Resource and Condition elements. Remove the policy variable {{variable}} from this element."

解决错误

您可以在 Resource 元素中和 Condition 元素的字符串比较中使用策略变量。

相关术语

错误 — 版本中不支持变量

在 AWS Management Console 中,此检查的结果包括以下消息:

Variable unsupported in version: To include variables in your policy, use the policy version 2012-10-17 or later.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "To include variables in your policy, use the policy version 2012-10-17 or later."

解决错误

要使用策略变量,您必须在语句中包含 Version 元素,而且版本必须设置为支持策略变量的版本。变量是在 2012-10-17 版本中引入的。较早版本的策略语言不支持策略变量。如果您未将 Version 设置为 2012-10-17 或更高版本,则 ${aws:username} 等变量在策略中被视为文字字符串。

Version 策略元素与策略版本不同。Version 策略元素用在策略之中,用于定义策略语言的版本。当您更改 IAM 中的客户托管策略时,将创建一个策略版本。已更改的策略不会覆盖现有策略。而是由 IAM 创建新的托管策略版本。

相关术语

错误 — 私有 IP 地址

在 AWS Management Console 中,此检查的结果包括以下消息:

Private IP address: aws:SourceIp works only for public IP address ranges. The values for condition key aws:SourceIp include only private IP addresses and will not have the desired effect. Update the value to include only public IP addresses.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "aws:SourceIp works only for public IP address ranges. The values for condition key aws:SourceIp include only private IP addresses and will not have the desired effect. Update the value to include only public IP addresses."

解决错误

全局条件键 aws:SourceIp 仅适用于公有 IP 地址范围。当您的策略仅允许私有 IP 地址时,您会收到此错误。在这种情况下,条件将永远不匹配。

错误 — 私有 NotIpAddress

在 AWS Management Console 中,此检查的结果包括以下消息:

Private NotIpAddress: The values for condition key aws:SourceIp include only private IP addresses and has no effect. aws:SourceIp works only for public IP address ranges. Update the value to include only public IP addresses.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The values for condition key aws:SourceIp include only private IP addresses and has no effect. aws:SourceIp works only for public IP address ranges. Update the value to include only public IP addresses."

解决错误

全局条件键 aws:SourceIp 仅适用于公有 IP 地址范围。当您使用 NotIpAddress 条件运算符并仅列出私有 IP 地址时,就会收到此错误。在这种情况下,条件将始终匹配并且无效。

错误 — 策略大小超过 SCP 配额

在 AWS Management Console 中,此检查的结果包括以下消息:

Policy size exceeds SCP quota: The {{policySize}} characters in the service control policy (SCP) exceed the {{policySizeQuota}} character maximum for SCPs. We recommend that you use multiple granular policies.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The {{policySize}} characters in the service control policy (SCP) exceed the {{policySizeQuota}} character maximum for SCPs. We recommend that you use multiple granular policies."

解决错误

AWS Organizations 服务控制策略 (SCP) 支持在 ActionNotAction 元素中指定值。但是,这些值只能在字符串末尾包含通配符 (*)。这意味着您可以指定 iam:Get* 但不能指定 iam:*role

要指定多个操作,AWS 建议您单独列出它们。

相关术语

错误 — 无效的服务主体格式

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid service principal format: The service principal does not match the expected format. Use the format {{expectedFormat}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The service principal does not match the expected format. Use the format {{expectedFormat}}."

解决错误

条件键值对中的值必须与定义的服务主体格式匹配。

服务主体是一个标识符,用于向服务授予权限。您可以在 Principal 元素中指定服务主体,也可以将其作为某些全局条件键和特定于服务的键的值。服务主体由每项服务定义。

服务主体的标识符包括服务名称,通常采用以下格式(都是小写字母):

service-name.amazonaws.com

某些特定于服务的键可能会对服务主体使用不同的格式。例如,kms:ViaService 条件密钥要求所有小写字母的服务主体采用以下格式:

service-name.AWS_region.amazonaws.com

相关术语

错误 — 条件中缺少标签密钥

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing tag key in condition: The condition key {{conditionKeyName}} must include a tag key to control access based on tags. Use the format {{conditionKeyName}}tag-key and specify a key name for tag-key.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key {{conditionKeyName}} must include a tag key to control access based on tags. Use the format {{conditionKeyName}}tag-key and specify a key name for tag-key."

解决错误

要基于标签控制访问,您需要在策略的条件元素中提供标签信息。

例如,要控制对 AWS 资源的访问权限,您可以包含 aws:ResourceTag 条件键。此键需要格式 aws:ResourceTag/tag-key。要指定条件中的标签密钥 owner 和标签值 JaneDoe,请使用以下格式。

"Condition": { "StringEquals": {"aws:ResourceTag/owner": "JaneDoe"} }

相关术语

错误 — VPC 格式无效

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid vpc format: The VPC identifier in the condition key value is not valid. Use the prefix 'vpc-' followed by 8 or 17 alphanumeric characters.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The VPC identifier in the condition key value is not valid. Use the prefix 'vpc-' followed by 8 or 17 alphanumeric characters."

解决错误

aws:SourceVpc 条件密钥必须使用前缀 vpc-,并且后面跟 8 或 17 个字母数字字符,例如 vpc-11223344556677889vpc-12345678

相关术语

错误 — vpce 格式无效

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid vpce format: The VPCE identifier in the condition key value is not valid. Use the prefix 'vpce-' followed by 8 or 17 alphanumeric characters.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The VPCE identifier in the condition key value is not valid. Use the prefix 'vpce-' followed by 8 or 17 alphanumeric characters."

解决错误

aws:SourceVpce 条件密钥必须使用前缀 vpce-,并且后面跟 8 或 17 个字母数字字符,例如 vpce-11223344556677889vpce-12345678

相关术语

错误 — 不支持联合主体

在 AWS Management Console 中,此检查的结果包括以下消息:

Federated principal not supported: The policy type does not support a federated identity provider in the principal element. Use a supported principal.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The policy type does not support a federated identity provider in the principal element. Use a supported principal."

解决错误

这些区域有:Principal 元素将联合主体用于附加到 IAM 角色的信任策略,以便通过联合身份验证提供访问权限 标识策略和其他基于资源的策略不支持 Principal 元素中的联合标识提供程序。例如,您不能在 Amazon S3 存储桶策略中使用 SAML 主体。将 Principal元素更改为受支持的主体类型。

相关术语

错误 — 条件密钥的不支持的操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported action for condition key: The following actions: {{actions}} are not supported by the condition key {{key}}. The condition will not be evaluated for these actions. We recommend that you move these actions to a different statement without this condition key.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The following actions: {{actions}} are not supported by the condition key {{key}}. The condition will not be evaluated for these actions. We recommend that you move these actions to a different statement without this condition key."

解决错误

确保策略声明 Condition 元素中的条件密钥适用于 Action 元素中的每个操作。为确保您的策略有效允许或拒绝指定的操作,应将不受支持的操作移动到不带条件密钥的其他语句中。

注意

如果 Action 元素具有带通配符的操作,IAM Access Analyzer 不会对此错误的这些操作进行评估。

相关术语

错误 — 策略中不支持的操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported action in policy: The action {{action}} is not supported for the resource-based policy attached to the resource type {{resourceType}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The action {{action}} is not supported for the resource-based policy attached to the resource type {{resourceType}}."

解决错误

附加到不同资源类型的基于资源策略中的 Action 元素不支持某些操作。例如,Amazon S3 存储桶策略中不支持 AWS Key Management Service 操作。指定附加到基于资源的策略的资源类型支持的操作。

相关术语

错误 — 策略中不支持的资源 ARN

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported resource ARN in policy: The resource ARN is not supported for the resource-based policy attached to the resource type {{resourceType}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The resource ARN is not supported for the resource-based policy attached to the resource type {{resourceType}}."

解决错误

策略附加到不同资源类型时,基于资源策略中的 Resource 元素不支持某些操作。例如,Amazon S3 存储桶策略的 Resource 元素中不支持 AWS KMS ARN。指定附加到基于资源的策略的资源类型支持的资源 ARN。

相关术语

错误 — 服务主体的条件密钥不受支持

在 AWS Management Console 中,此检查的结果包括以下消息:

Unsupported condition key for service principal: The following condition keys are not supported when used with the service principal: {{conditionKeys}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The following condition keys are not supported when used with the service principal: {{conditionKeys}}."

解决错误

您可以使用服务主体指定基于资源策略的 Principal 元素中的 AWS 服务,这是服务的标识符。您不能对某些服务主体使用某些条件密钥。例如,您不能使用带有服务主体 cloudfront.amazonaws.comaws:PrincipalOrgID 条件密钥。您应该移除 Principal 元素中不适用于服务主体的条件密钥。

相关术语

错误 - 角色信任策略语法错误 notprincipal

在 AWS Management Console 中,此检查的结果包括以下消息:

Role trust policy syntax error notprincipal: Role trust policies do not support NotPrincipal. Update the policy to use a Principal element instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Role trust policies do not support NotPrincipal. Update the policy to use a Principal element instead."

解决错误

角色信任策略是附加到 IAM 角色的、基于资源的策略。信任策略定义哪些主体实体(账户、用户、角色和联合身份用户)可以代入该角色。角色信任策略不支持 NotPrincipal。更新策略以改用 Principal 元素。

相关术语

错误 - 主体中不支持的角色信任策略通配符

在 AWS Management Console 中,此检查的结果包括以下消息:

Role trust policy unsupported wildcard in principal: "Principal:" "*" is not supported in the principal element of a role trust policy. Replace the wildcard with a valid principal value.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": ""Principal:" "*" is not supported in the principal element of a role trust policy. Replace the wildcard with a valid principal value."

解决错误

角色信任策略是附加到 IAM 角色的、基于资源的策略。信任策略定义哪些主体实体(账户、用户、角色和联合用户)可以代入该角色。角色信任策略的 Principal 元素中不支持 "Principal:" "*"。将通配符替换为有效的主体值。

相关术语

错误 - 角色信任策略语法错误资源

在 AWS Management Console 中,此检查的结果包括以下消息:

Role trust policy syntax error resource: Role trust policies apply to the role that they are attached to. You cannot specify a resource. Remove the Resource or NotResource element.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Role trust policies apply to the role that they are attached to. You cannot specify a resource. Remove the Resource or NotResource element."

解决错误

角色信任策略是附加到 IAM 角色的、基于资源的策略。信任策略定义哪些主体实体(账户、用户、角色和联合身份用户)可以代入该角色。角色信任策略适用于其附加到的角色。您不能在角色信任策略中指定 ResourceNotResource 元素。删除 ResourceNotResource 元素。

错误 - 类型与 IP 范围不匹配

在 AWS Management Console 中,此检查的结果包括以下消息:

Type mismatch IP range: The condition operator {{operator}} is used with an invalid IP range value. Specify the IP range in standard CIDR format.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition operator {{operator}} is used with an invalid IP range value. Specify the IP range in standard CIDR format."

解决错误

请更新文本以使用 CIDR 格式的 IP 地址条件运算符数据类型。

相关术语

错误 - 缺少条件键的操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing action for condition key: The {{actionName}} action must be in the action block to allow setting values for the condition key {{keyName}}. Add {{actionName}} to the action block.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The {{actionName}} action must be in the action block to allow setting values for the condition key {{keyName}}. Add {{actionName}} to the action block."

解决错误

除非指定的操作在 Action 元素中,否则不会评估策略语句 Condition 元素中的条件键。要确保策略有效地允许或拒绝您指定的条件键,请将操作添加到 Action 元素。

相关术语

错误 - 角色信任策略中的联合主体语法无效

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid federated principal syntax in role trust policy: The principal value specifies a federated principal that does not match the expected format. Update the federated principal to a domain name or a SAML metadata ARN.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The principal value specifies a federated principal that does not match the expected format. Update the federated principal to a domain name or a SAML metadata ARN."

解决错误

主体值指定的联合主体与预期格式不匹配。将联合主体的格式更新为有效的域名或 SAML 元数据 ARN。

相关术语

错误 - 主体的操作不匹配

在 AWS Management Console 中,此检查的结果包括以下消息:

Mismatched action for principal: The {{actionName}} action is invalid with the following principal(s): {{principalNames}}. Use a SAML provider principal with the sts:AssumeRoleWithSAML action or use an OIDC provider principal with the sts:AssumeRoleWithWebIdentity action. Ensure the provider is Federated if you use either of the two options.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The {{actionName}} action is invalid with the following principal(s): {{principalNames}}. Use a SAML provider principal with the sts:AssumeRoleWithSAML action or use an OIDC provider principal with the sts:AssumeRoleWithWebIdentity action. Ensure the provider is Federated if you use either of the two options."

解决错误

策略语句 Action 元素中指定的操作对于 Principal 元素中指定的主体无效。例如,不能将 SAML 提供商主体与 sts:AssumeRoleWithWebIdentity 操作一起使用。应将 SAML 提供商主体与 sts:AssumeRoleWithSAML 操作一起使用,或者将 OIDC 提供商主体与 sts:AssumeRoleWithWebIdentity 操作一起使用。

相关术语

错误 - 缺少 Roles Anywhere 信任策略的操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing action for roles anywhere trust policy: The rolesanywhere.amazonaws.com service principal requires the sts:AssumeRole, sts:SetSourceIdentity, and sts:TagSession permissions to assume a role. Add the missing permissions to the policy.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The rolesanywhere.amazonaws.com service principal requires the sts:AssumeRole, sts:SetSourceIdentity, and sts:TagSession permissions to assume a role. Add the missing permissions to the policy."

解决错误

要使 IAM Roles Anywhere 能够代入角色并提供临时 AWS 凭证,该角色必须信任 IAM Roles Anywhere 服务主体。IAM Roles Anywhere 服务主体需要 sts:AssumeRolests:SetSourceIdentitysts:TagSession 权限才能代入角色。如果缺少任何权限,则必须将其添加到策略中。

相关术语

常规警告 — 使用 NotResource 创建 SLR

在 AWS Management Console 中,此检查的结果包括以下消息:

Create SLR with NotResource: Using the iam:CreateServiceLinkedRole action with NotResource can allow creation of unintended service-linked roles for multiple resources. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the iam:CreateServiceLinkedRole action with NotResource can allow creation of unintended service-linked roles for multiple resources. We recommend that you specify resource ARNs instead."

解决一般警告

操作 iam:CreateServiceLinkedRole 授予权限以创建 IAM 角色,它允许 AWS 服务代表您执行操作。在带有 NotResource 元素的策略中使用 iam:CreateServiceLinkedRole 可以允许为多个资源创建意外的服务关联角色。AWS 会建议您在 Resource 元素中指定允许的 ARN。

常规警告 — 使用带有星号的操作和 NotResource 创建 SLR

在 AWS Management Console 中,此检查的结果包括以下消息:

Create SLR with star in action and NotResource: Using an action with a wildcard(*) and NotResource can allow creation of unintended service-linked roles because it can allow iam:CreateServiceLinkedRole permissions on multiple resources. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using an action with a wildcard(*) and NotResource can allow creation of unintended service-linked roles because it can allow iam:CreateServiceLinkedRole permissions on multiple resources. We recommend that you specify resource ARNs instead."

解决一般警告

操作 iam:CreateServiceLinkedRole 授予权限以创建 IAM 角色,它允许 AWS 服务代表您执行操作。在 Action 中具有通配符 (*) 且 NotResource 元素的策略可以允许为多个资源创建意外的服务关联角色。AWS 会建议您在 Resource 元素中指定允许的 ARN。

常规警告 — 使用 NotAction 和 NotResource 创建 SLR

在 AWS Management Console 中,此检查的结果包括以下消息:

Create SLR with NotAction and NotResource: Using NotAction with NotResource can allow creation of unintended service-linked roles because it allows iam:CreateServiceLinkedRole permissions on multiple resources. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using NotAction with NotResource can allow creation of unintended service-linked roles because it allows iam:CreateServiceLinkedRole permissions on multiple resources. We recommend that you specify resource ARNs instead."

解决一般警告

操作 iam:CreateServiceLinkedRole 授予权限以创建 IAM 角色,它允许 AWS 服务代表您执行操作。将 NotAction 元素与 NotResource 元素搭配使用可以允许为多个资源创建意外的服务链接角色。AWS 会建议您重写策略以允许 Resource 元素中 ARN 有限列表上的 iam:CreateServiceLinkedRole。您还可以将 iam:CreateServiceLinkedRole 添加到 NotAction 元素。

常规警告 — 使用带星号的资源创建 SLR

在 AWS Management Console 中,此检查的结果包括以下消息:

Create SLR with star in resource: Using the iam:CreateServiceLinkedRole action with wildcards (*) in the resource can allow creation of unintended service-linked roles. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the iam:CreateServiceLinkedRole action with wildcards (*) in the resource can allow creation of unintended service-linked roles. We recommend that you specify resource ARNs instead."

解决一般警告

操作 iam:CreateServiceLinkedRole 授予权限以创建 IAM 角色,它允许 AWS 服务代表您执行操作。在带有包含通配符 (*) 的 Resource 元素的策略中使用 iam:CreateServiceLinkedRole 可以允许为多个资源创建意外的服务关联角色。AWS 会建议您在 Resource 元素中指定允许的 ARN。

带有此常规警告的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

其中一些使用案例适用于您的账户中的高级用户。以下 AWS 托管策略提供高级用户访问权限并授予为任何 AWS 服务创建服务关联角色的权限。AWS 建议您仅将以下 AWS 托管策略附加到您认为是高级用户的 IAM 身份。

常规警告 — 使用带星号的行动和资源创建 SLR

在 AWS Management Console 中,此检查的结果包括以下消息:

Create SLR with star in action and resource: Using wildcards (*) in the action and the resource can allow creation of unintended service-linked roles because it allows iam:CreateServiceLinkedRole permissions on all resources. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using wildcards (*) in the action and the resource can allow creation of unintended service-linked roles because it allows iam:CreateServiceLinkedRole permissions on all resources. We recommend that you specify resource ARNs instead."

解决一般警告

操作 iam:CreateServiceLinkedRole 授予权限以创建 IAM 角色,它允许 AWS 服务代表您执行操作。在 ActionResource 元素中带有通配符 (*) 的策略可以允许为多个资源创建意外的服务关联角色。这允许您在指定 "Action": "*""Action": "iam:*""Action": "iam:Create*" 时创建服务关联角色。AWS 会建议您在 Resource 元素中指定允许的 ARN。

带有此常规警告的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

其中一些使用案例适用于您账户中的管理员。以下 AWS 托管策略提供管理员访问权限并授予为任何 AWS 服务创建服务关联角色的权限。AWS 建议您仅将以下 AWS 托管策略附加到您认为是管理员的 IAM 身份。

常规警告 — 使用带有星号的资源和 NotAction 创建 SLR

在 AWS Management Console 中,此检查的结果包括以下消息:

Create SLR with star in resource and NotAction: Using a resource with wildcards (*) and NotAction can allow creation of unintended service-linked roles because it allows iam:CreateServiceLinkedRole permissions on all resources. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using a resource with wildcards (*) and NotAction can allow creation of unintended service-linked roles because it allows iam:CreateServiceLinkedRole permissions on all resources. We recommend that you specify resource ARNs instead."

解决一般警告

操作 iam:CreateServiceLinkedRole 授予权限以创建 IAM 角色,它允许 AWS 服务代表您执行操作。在带有包含通配符 (*) 的 Resource 元素的策略中使用 NotAction 元素可以允许为多个资源创建意外的服务关联角色。AWS 会建议您在 Resource 元素中指定允许的 ARN。您还可以将 iam:CreateServiceLinkedRole 添加到 NotAction 元素。

常规警告 — 已弃用的全局条件键

在 AWS Management Console 中,则此检查的结果包括以下消息:

Deprecated global condition key: We recommend that you update aws:ARN to use the newer condition key aws:PrincipalArn.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "We recommend that you update aws:ARN to use the newer condition key aws:PrincipalArn."

解决一般警告

该策略包含已弃用的全局条件键。请更新条件键值对中的条件键以使用受支持的全局条件键。

常规警告 — 无效的日期值

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid date value: The date {{date}} might not resolve as expected. We recommend that you use the YYYY-MM-DD format.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The date {{date}} might not resolve as expected. We recommend that you use the YYYY-MM-DD format."

解决一般警告

Unix Epoch 时间描述自 1970 年 1 月 1 日以来已经过去的时间点,减去闰秒。Epoch 时间可能无法解析到您期望的精确时间。AWS 建议您对日期和时间格式使用 W3C 标准。例如,您可以指定一个完整的日期,如 YYYY-MMM-DD (1997-07-16),也可以将时间附加到秒,例如 YYYY-MM-DDThh:mm:ssTZD (1997-07-16T19:20:30+01:00)。

常规警告 — 无效的角色引用

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid role reference: The Principal element includes the IAM role ID {{roleid}}. We recommend that you use a role ARN instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The Principal element includes the IAM role ID {{roleid}}. We recommend that you use a role ARN instead."

解决一般警告

AWS 建议您为 IAM 角色指定 Amazon Resource Name (ARN),而不是其主体 ID。当 IAM 保存策略时,它会将 ARN 转换为现有角色的主体 ID。AWS 包括安全预防措施。如果某人删除并重新创建该角色,则该角色将有一个新 ID,并且策略不会与新角色的 ID 匹配。

常规警告 — 无效的用户引用

在 AWS Management Console 中,此检查的结果包括以下消息:

Invalid user reference: The Principal element includes the IAM user ID {{userid}}. We recommend that you use a user ARN instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The Principal element includes the IAM user ID {{userid}}. We recommend that you use a user ARN instead."

解决一般警告

AWS 建议您为 IAM 用户指定 Amazon Resource Name (ARN),而不是其主体 ID。当 IAM 保存策略时,它会将 ARN 转换为现有用户的主体 ID。AWS 包括安全预防措施。如果某人删除并重新创建该用户,则该用户将有一个新 ID,并且策略不会与新用户的 ID 匹配。

常规警告 — 缺少版本

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing version: We recommend that you specify the Version element to help you with debugging permission issues.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "We recommend that you specify the Version element to help you with debugging permission issues."

解决一般警告

AWS 建议在您的策略中包括可选的 Version 参数。如果未包含 Version 元素,则此值默认为 2012-10-17,但策略变量等较新的功能将不适用于您的策略。例如,系统不会将 ${aws:username} 等变量识别为变量,而是将其视为策略中的文本字符串。

在 AWS Management Console 中,此检查的结果包括以下消息:

Unique Sids recommended: We recommend that you use statement IDs that are unique to your policy. Update the Sid value.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "We recommend that you use statement IDs that are unique to your policy. Update the Sid value."

解决一般警告

AWS 建议您使用唯一语句 ID。Sid (声明 ID) 元素允许您针对策略语句输入可选标识符。您可以在使用 SID 元素的语句数组中为每个语句指定语句 ID 的值。

相关术语

常规警告 — 没有类似运算符的通配符

在 AWS Management Console 中,此检查的结果包括以下消息:

Wildcard without like operator: Your condition value includes a * or ? character. If you meant to use a wildcard (*, ?), update the condition operator to include Like.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Your condition value includes a * or ? character. If you meant to use a wildcard (*, ?), update the condition operator to include Like."

解决一般警告

Condition 元素结构要求您使用条件运算符和键值对。当您指定使用通配符 (*, ?) 的条件值时,必须使用 Like 版本的条件运算符。例如,请使用 StringLike,而不是 StringEquals 字符串条件运算符。

"Condition": {"StringLike": {"aws:PrincipalTag/job-category": "admin-*"}}

带有此常规警告的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

以下 AWS 托管策略在其条件值中包含通配符,而不带有包含用于模式匹配的 Like 的条件运算符。使用 AWS 托管策略作为创建客户管理策略的参考时,AWS 会建议您使用支持模式匹配且带有通配符 (*, ?) 的条件运算符,例如 StringLike

常规警告 — 策略大小超出身份策略配额

在 AWS Management Console 中,此检查的结果包括以下消息:

Policy size exceeds identity policy quota: The {{policySize}} characters in the identity policy, excluding whitespace, exceed the {{policySizeQuota}} character maximum for inline and managed policies. We recommend that you use multiple granular policies.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The {{policySize}} characters in the identity policy, excluding whitespace, exceed the {{policySizeQuota}} character maximum for inline and managed policies. We recommend that you use multiple granular policies."

解决一般警告

您可以将最多 10 个托管策略附加到 IAM 身份(用户、用户组或角色)。但是,每个托管策略的大小不能超过默认配额的 6144 个字符。在计算策略大小时,IAM 不会将空格计入该配额。配额,也称为 AWS 中的限制,是 AWS 账户中资源、操作和项目的最大值。

此外,您还可以向 IAM 身份添加所需数量的内联策略。但是,每个身份的所有内联策略的总大小不能超过指定的配额。

如果您的策略大于配额,您可以将策略组织为多个语句,并将这些语句分组为多个策略。

相关术语

带有此常规警告的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

以下 AWS 托管策略向跨多个 AWS 服务的操作授予权限,且超过了最大策略大小。使用 AWS 托管策略作为参考来创建托管策略时,您必须将策略拆分为多个策略。

常规警告 — 策略大小超出资源策略配额

在 AWS Management Console 中,此检查的结果包括以下消息:

Policy size exceeds resource policy quota: The {{policySize}} characters in the resource policy exceed the {{policySizeQuota}} character maximum for resource policies. We recommend that you use multiple granular policies.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The {{policySize}} characters in the resource policy exceed the {{policySizeQuota}} character maximum for resource policies. We recommend that you use multiple granular policies."

解决一般警告

基于资源的策略是附加到资源(如 Amazon S3 存储桶)的 JSON 策略文档。这些策略授予指定的主体对该资源执行特定操作的权限,并定义这在哪些条件下适用。基于资源的策略的大小不能超过为该资源设置的配额。配额,也称为 AWS 中的限制,是 AWS 账户中资源、操作和项目的最大值。

如果您的策略大于配额,您可以将策略组织为多个语句,并将这些语句分组为多个策略。

相关术语

常规警告 — 类型不匹配

在 AWS Management Console 中,此检查的结果包括以下消息:

Type mismatch: Use the operator type {{allowed}} instead of operator {{operator}} for the condition key {{key}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Use the operator type {{allowed}} instead of operator {{operator}} for the condition key {{key}}."

解决一般警告

请更新文本以使用支持的条件运算符数据类型。

例如,aws:MultiFactorAuthPresent 全局条件键需要带有 Boolean 数据类型的条件运算符。如果您提供日期或整数,则数据类型将不匹配。

相关术语

常规警告 — 类型不匹配布尔值

在 AWS Management Console 中,此检查的结果包括以下消息:

Type mismatch Boolean: Add a valid Boolean value (true or false) for the condition operator {{operator}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a valid Boolean value (true or false) for the condition operator {{operator}}."

解决一般警告

请更新文本以使用布尔条件运算符数据类型,例如 truefalse

例如,aws:MultiFactorAuthPresent 全局条件键需要带有 Boolean 数据类型的条件运算符。如果您提供日期或整数,则数据类型将不匹配。

相关术语

常规警告 — 类型不匹配日期

在 AWS Management Console 中,此检查的结果包括以下消息:

Type mismatch date: The date condition operator is used with an invalid value. Specify a valid date using YYYY-MM-DD or other ISO 8601 date/time format.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The date condition operator is used with an invalid value. Specify a valid date using YYYY-MM-DD or other ISO 8601 date/time format."

解决一般警告

请更新文本以使用日期条件运算符数据类型,采用 YYYY-MM-DD 或其他 ISO 8601 日期时间格式。

相关术语

常规警告 — 类型不匹配的数字

在 AWS Management Console 中,此检查的结果包括以下消息:

Type mismatch number: Add a valid numeric value for the condition operator {{operator}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a valid numeric value for the condition operator {{operator}}."

解决一般警告

请更新文本以使用数字条件运算符数据类型。

相关术语

常规警告 — 类型不匹配的字符串

在 AWS Management Console 中,此检查的结果包括以下消息:

Type mismatch string: Add a valid base64-encoded string value for the condition operator {{operator}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a valid base64-encoded string value for the condition operator {{operator}}."

解决一般警告

请更新文本以使用字符串条件运算符数据类型。

相关术语

在 AWS Management Console 中,此检查的结果包括以下消息:

Specific github repo and branch recommended: Using a wildcard (*) in token.actions.githubusercontent.com:sub can allow requests from more sources than you intended. Specify the value of token.actions.githubusercontent.com:sub with the repository and branch name.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using a wildcard (*) in token.actions.githubusercontent.com:sub can allow requests from more sources than you intended. Specify the value of token.actions.githubusercontent.com:sub with the repository and branch name."

解决一般警告

如果您将 GitHub 用作 OIDC IdP,则最佳实践是限制可以代入与 IAM IdP 关联的角色的实体。如果信任策略中包含 Condition 语句,则可将角色限制为特定的 GitHub 组织、存储库或分支。您可以使用条件键 token.actions.githubusercontent.com:sub 限制访问。我们建议您将条件限制为一组特定的存储库或分支。如果在 token.actions.githubusercontent.com:sub 中使用通配符(*),则来自您控制范围之外的组织或存储库的 GitHub 操作可代入与您 AWS 账户中的 GitHub IAM IdP 关联的角色。

相关术语

常规警告 - 策略大小超出角色信任策略配额

在 AWS Management Console 中,此检查的结果包括以下消息:

Policy size exceeds role trust policy quota: The characters in the role trust policy, excluding whitespace, exceed the character maximum. We recommend that you request a role trust policy length quota increase using Service Quotas and AWS Support Center. If the quotas have already been increased, then you can ignore this warning.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The characters in the role trust policy, excluding whitespace, exceed the character maximum. We recommend that you request a role trust policy length quota increase using Service Quotas and AWS Support Center. If the quotas have already been increased, then you can ignore this warning."

解决一般警告

IAM 与 AWS STS 具有限制角色信任策略大小的配额。角色信任策略中的字符(不包括空格)超过了最大字符数。我们建议您使用服务限额和 AWS Support Center Console 请求增加角色信任策略长度配额。

相关术语

安全警告 — 允许使用 NotPrincipal

在 AWS Management Console 中,此检查的结果包括以下消息:

Allow with NotPrincipal: Using Allow with NotPrincipal can be overly permissive. We recommend that you use Principal instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using Allow with NotPrincipal can be overly permissive. We recommend that you use Principal instead."

解决安全警告

使用 "Effect": "Allow"NotPrincipal 可能会过于宽松。例如,这可以向匿名主体授予权限。AWS 会建议您使用 Principal 元素指定需要访问权限的主体。或者,您可以允许广泛访问,然后添加另一个使用带有 “Effect”: “Deny”NotPrincipal 元素的语句。

安全警告 — 带有单值密钥的 ForAllValues

在 AWS Management Console 中,此检查的结果包括以下消息:

ForAllValues with single valued key: Using ForAllValues qualifier with the single-valued condition key {{key}} can be overly permissive. We recommend that you remove ForAllValues:.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using ForAllValues qualifier with the single-valued condition key {{key}} can be overly permissive. We recommend that you remove ForAllValues:."

解决安全警告

AWS 会建议您仅将 ForAllValues 用于多值条件。ForAllValues 集合运算符测试请求集的每个成员的值是否为条件键集的子集。如果请求中的每个键值均与策略中的至少一个值匹配,则条件返回 true。如果请求中没有键或者键值解析为空数据集(如空字符串),则也会返回 true。

要了解条件是支持单个值还是多个值,请查看该服务的操作、资源和条件密钥页面。带有 ArrayOf 数据类型前缀的条件密钥是多值条件密钥。例如,Amazon SES 支持具有单个值 (String) 的密钥和 ArrayOfString 多值数据类型。

安全警告 — 使用 NotResource 传递角色

在 AWS Management Console 中,此检查的结果包括以下消息:

Pass role with NotResource: Using the iam:PassRole action with NotResource can be overly permissive because it can allow iam:PassRole permissions on multiple resources. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the iam:PassRole action with NotResource can be overly permissive because it can allow iam:PassRole permissions on multiple resources. We recommend that you specify resource ARNs instead."

解决安全警告

要配置多项 AWS 服务,您必须将 IAM 角色传递 给相应服务。要允许这样做,您必须对身份(用户、用户组或角色)授予 iam:PassRole 的权限。在带有 NotResource 元素的策略中使用 iam:PassRole 可以允许您的主体访问比您预期更多的服务或功能。AWS 会建议您在 Resource 元素中指定允许的 ARN。此外,您可以通过使用 iam:PassedToService 条件键减少对单个服务的权限。

安全警告 — 使用带有星号的操作和 NotResource 传递角色

在 AWS Management Console 中,此检查的结果包括以下消息:

Pass role with star in action and NotResource: Using an action with a wildcard (*) and NotResource can be overly permissive because it can allow iam:PassRole permissions on multiple resources. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using an action with a wildcard (*) and NotResource can be overly permissive because it can allow iam:PassRole permissions on multiple resources. We recommend that you specify resource ARNs instead."

解决安全警告

要配置多项 AWS 服务,您必须将 IAM 角色传递 给相应服务。要允许这样做,您必须对身份(用户、用户组或角色)授予 iam:PassRole 的权限。在 Action 中带有通配符 (*) 且包含 NotResource 元素的策略可以允许您的主体访问比您预期更多的服务或功能。AWS 会建议您在 Resource 元素中指定允许的 ARN。此外,您可以通过使用 iam:PassedToService 条件键减少对单个服务的权限。

安全警告 — 使用 NotAction 和 NotResource 传递角色

在 AWS Management Console 中,此检查的结果包括以下消息:

Pass role with NotAction and NotResource: Using NotAction with NotResource can be overly permissive because it can allow iam:PassRole permissions on multiple resources.. We recommend that you specify resource ARNs instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using NotAction with NotResource can be overly permissive because it can allow iam:PassRole permissions on multiple resources.. We recommend that you specify resource ARNs instead."

解决安全警告

要配置多项 AWS 服务,您必须将 IAM 角色传递 给相应服务。要允许这样做,您必须对身份(用户、用户组或角色)授予 iam:PassRole 的权限。使用 NotAction 元素并列出 NotResource 元素中的一些资源可以允许您的主体访问比您预期更多的服务或功能。AWS 会建议您在 Resource 元素中指定允许的 ARN。此外,您可以通过使用 iam:PassedToService 条件键减少对单个服务的权限。

安全警告 — 使用带有星号的资源传递角色

在 AWS Management Console 中,此检查的结果包括以下消息:

Pass role with star in resource: Using the iam:PassRole action with wildcards (*) in the resource can be overly permissive because it allows iam:PassRole permissions on multiple resources. We recommend that you specify resource ARNs or add the iam:PassedToService condition key to your statement.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the iam:PassRole action with wildcards (*) in the resource can be overly permissive because it allows iam:PassRole permissions on multiple resources. We recommend that you specify resource ARNs or add the iam:PassedToService condition key to your statement."

解决安全警告

要配置多项 AWS 服务,您必须将 IAM 角色传递 给相应服务。要允许这样做,您必须对身份(用户、用户组或角色)授予 iam:PassRole 的权限。允许 iam:PassRole 且在 Resource 元素中包含通配符 (*) 的策略可以允许您的主体访问比您预期更多的服务或功能。AWS 会建议您在 Resource 元素中指定允许的 ARN。此外,您可以通过使用 iam:PassedToService 条件键减少对单个服务的权限。

某些 AWS 服务在其角色名称中包含服务命名空间。此策略检查会在分析策略以生成结果时考虑到这些约定。例如,以下资源 ARN 可能不会生成结果:

arn:aws:iam::*:role/Service*

带有此安全警告的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

其中一个使用案例适用于您账户中的管理员。以下 AWS 托管策略提供管理员访问权限,并授予将任何 IAM 角色传递给任何服务的权限。AWS 会建议您仅将以下 AWS 托管策略附加到您认为是管理员的 IAM 身份。

以下 AWS 托管策略包括对 iam:PassRole 的权限,并在资源包含通配符 (*),且位于弃用路径。对于这每一个策略,我们都更新了权限指南,例如推荐一个新的 AWS 托管策略,以支持使用案例。要查看这些策略的替代方案,请参阅每项服务的指南。

  • AWSElasticBeanstalkFullAccess

  • AWSElasticBeanstalkService

  • AWSLambdaFullAccess

  • AWSLambdaReadOnlyAccess

  • AWSOpsWorksFullAccess

  • AWSOpsWorksRole

  • AWSDataPipelineRole

  • AmazonDynamoDBFullAccesswithDataPipeline

  • AmazonElasticMapReduceFullAccess

  • AmazonDynamoDBFullAccesswithDataPipeline

  • AmazonEC2ContainerServiceFullAccess

以下 AWS 托管策略仅向服务关联角色提供权限,它允许 AWS 服务代表您执行操作。您可以将策略附加得到 IAM 身份。

安全警告 — 使用带有星号的行动和资源传递角色

在 AWS Management Console 中,此检查的结果包括以下消息:

Pass role with star in action and resource: Using wildcards (*) in the action and the resource can be overly permissive because it allows iam:PassRole permissions on all resources. We recommend that you specify resource ARNs or add the iam:PassedToService condition key to your statement.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using wildcards (*) in the action and the resource can be overly permissive because it allows iam:PassRole permissions on all resources. We recommend that you specify resource ARNs or add the iam:PassedToService condition key to your statement."

解决安全警告

要配置多项 AWS 服务,您必须将 IAM 角色传递 给相应服务。要允许这样做,您必须对身份(用户、用户组或角色)授予 iam:PassRole 的权限。在 Action 中带有通配符 (*) 且包含 Resource 元素的策略可以允许您的主体访问比您预期更多的服务或功能。AWS 会建议您在 Resource 元素中指定允许的 ARN。此外,您可以通过使用 iam:PassedToService 条件键减少对单个服务的权限。

带有此安全警告的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

其中一些使用案例适用于您账户中的管理员。以下 AWS 托管策略提供管理员访问权限,并授予将任何 IAM 角色传递给任何 AWS 服务的权限。AWS 会建议您仅将以下 AWS 托管策略附加到您认为是管理员的 IAM 身份。

安全警告 — 使用带有星号的资源和 NotAction 传递角色

在 AWS Management Console 中,此检查的结果包括以下消息:

Pass role with star in resource and NotAction: Using a resource with wildcards (*) and NotAction can be overly permissive because it allows iam:PassRole permissions on all resources. We recommend that you specify resource ARNs or add the iam:PassedToService condition key to your statement.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using a resource with wildcards (*) and NotAction can be overly permissive because it allows iam:PassRole permissions on all resources. We recommend that you specify resource ARNs or add the iam:PassedToService condition key to your statement."

解决安全警告

要配置多项 AWS 服务,您必须将 IAM 角色传递 给相应服务。要允许这样做,您必须对身份(用户、用户组或角色)授予 iam:PassRole 的权限。在策略中使用 NotAction 元素且在 Resource 元素中包含通配符 (*)可以允许您的主体访问比您预期更多的服务或功能。AWS 会建议您在 Resource 元素中指定允许的 ARN。此外,您可以通过使用 iam:PassedToService 条件键减少对单个服务的权限。

安全警告 — 缺少配对条件键

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing paired condition keys: Using the condition key {{conditionKeyName}} can be overly permissive without also using the following condition keys: {{recommendedKeys}}. Condition keys like this one are more secure when paired with a related key. We recommend that you add the related condition keys to the same condition block.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the condition key {{conditionKeyName}} can be overly permissive without also using the following condition keys: {{recommendedKeys}}. Condition keys like this one are more secure when paired with a related key. We recommend that you add the related condition keys to the same condition block."

解决安全警告

当与其他相关条件键配对时,某些条件键会更加安全。AWS 建议您将相关条件键包含在与现有条件键相同的条件数据块中。这会使得通过策略授予的权限更加安全。

例如,您可以使用 aws:VpcSourceIp 条件键将发出请求的 IP 地址与您在策略中指定的 IP 地址进行比较。AWS 会建议您添加相关 aws:SourceVPC 条件键。这将检查请求是否来自您在策略中指定的 VPC 以及您指定的 IP 地址。

相关术语

安全警告 — 使用不支持的标签条件键拒绝服务

在 AWS Management Console 中,此检查的结果包括以下消息:

Deny with unsupported tag condition key for service: Using the effect Deny with the tag condition key {{conditionKeyName}} and actions for services with the following prefixes can be overly permissive: {{serviceNames}}. Actions for the listed services are not denied by this statement. We recommend that you move these actions to a different statement without this condition key.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the effect Deny with the tag condition key {{conditionKeyName}} and actions for services with the following prefixes can be overly permissive: {{serviceNames}}. Actions for the listed services are not denied by this statement. We recommend that you move these actions to a different statement without this condition key."

解决安全警告

在带有 "Effect": "Deny" 的政策的 Condition 元素中使用不受支持的标签条件键可能会过于宽松,因为该服务的条件将被忽略。AWS 会建议您删除不支持条件键的服务操作,并创建另一个语句来拒绝对这些操作的特定资源的访问。

如果您使用 aws:ResourceTag 条件键,并且服务操作不支持该键,则该键不会包含在请求上下文中。在本例中,Deny 语句中的条件总是返回 false,并且该行动从来没有被拒绝。即使资源被正确标记,也会发生这种情况。

当服务支持 aws:ResourceTag 条件键时,您可以使用标签来控制对该服务资源的访问。这称为基于属性的访问控制 (ABAC)。不支持这些密钥的服务需要您使用基于资源的访问控制 (RBAC) 来控制对资源的访问。

注意

某些服务允许支持其资源和操作子集的 aws:ResourceTag 条件键。IAM Access Analyzer 将返回不受支持的服务操作结果。例如,Amazon S3 支持其资源子集的 aws:ResourceTag。要查看 Amazon S3 中支持 aws:ResourceTag 条件键的所有资源类型,请参阅服务授权参考中的 Amazon S3 定义的资源类型

例如,假设您想拒绝访问,以将被删除但使用了键值对 status=Confidential 进行标记的特定资源解除标记。同时假设 AWS Lambda 允许您标记和取消标记资源,但不支持 aws:ResourceTag 条件键。要在此标签存在的情况下拒绝 AWS App Mesh 和 AWS Backup 的删除操作,请使用 aws:ResourceTag 条件键。对于 Lambda,请使用包含 "Confidential" 前缀的资源命名约定。然后包含一个单独的语句,以防止使用该命名约定删除资源。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyDeleteSupported", "Effect": "Deny", "Action": [ "appmesh:DeleteMesh", "backup:DeleteBackupPlan" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/status": "Confidential" } } }, { "Sid": "DenyDeleteUnsupported", "Effect": "Deny", "Action": "lambda:DeleteFunction", "Resource": "arn:aws:lambda:*:123456789012:function:status-Confidential*" } ] }
警告

请勿将...IfExists版本的条件运算符用作此结果的解决方法。这表示“当键存在于请求上下文中且值匹配时,拒绝操作。否则,拒绝操作。” 在前面的示例中,在带有 StringEqualsIfExists 运算符的 DenyDeleteSupported 语句中包含 lambda:DeleteFunction 操作将始终拒绝该操作。对于该操作,密钥不存在于上下文中,并且每次尝试删除该资源类型时都会被拒绝,无论资源是否被标记。

相关术语

安全警告 — 使用不支持的标签条件键拒绝服务的 NotAction

在 AWS Management Console 中,此检查的结果包括以下消息:

Deny NotAction with unsupported tag condition key for service: Using the effect Deny with NotAction and the tag condition key {{conditionKeyName}} can be overly permissive because some service actions are not denied by this statement. This is because the condition key doesn't apply to some service actions. We recommend that you use Action instead of NotAction.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the effect Deny with NotAction and the tag condition key {{conditionKeyName}} can be overly permissive because some service actions are not denied by this statement. This is because the condition key doesn't apply to some service actions. We recommend that you use Action instead of NotAction."

解决安全警告

在带有元素 NotAction"Effect": "Deny" 的策略的 Condition 元素中使用标签条件键可能会过于宽松。对于不支持条件键的服务操作,该条件将被忽略。AWS 会建议您重写逻辑以拒绝操作列表。

如果您将 aws:ResourceTag 条件键与 NotAction 搭配使用,则不会拒绝任何不支持密钥的新或现有服务操作。AWS 会建议您明确列出要拒绝的操作。IAM Access Analyzer 为列出的不支持 aws:ResourceTag 条件键的操作返回单独的结果。有关更多信息,请参阅 安全警告 — 使用不支持的标签条件键拒绝服务

当服务支持 aws:ResourceTag 条件键时,您可以使用标签来控制对该服务资源的访问。这称为基于属性的访问控制 (ABAC)。不支持这些密钥的服务需要您使用基于资源的访问控制 (RBAC) 来控制对资源的访问。

相关术语

安全警告 — 限制对服务主体的访问

在 AWS Management Console 中,此检查的结果包括以下消息:

Restrict access to service principal: Granting access to a service principal without specifying a source is overly permissive. Use aws:SourceArn, aws:SourceAccount, aws:SourceOrgID, or aws:SourceOrgPaths condition key to grant fine-grained access.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Granting access to a service principal without specifying a source is overly permissive. Use aws:SourceArn, aws:SourceAccount, aws:SourceOrgID, or aws:SourceOrgPaths condition key to grant fine-grained access."

解决安全警告

您可以使用服务主体指定基于资源策略的 Principal 元素中的 AWS 服务,即服务的标识符。授予服务主体的访问权限以代表您行事时,请限制访问权限。您可以通过 aws:SourceArnaws:SourceAccountaws:SourceOrgIDaws:SourceOrgPaths 条件键来限制特定资源 ARN、AWS 账户、组织 ID 或组织路径等特定来源的访问,从而避免过于宽松的策略。限制访问可以帮助您防止称为混淆代理问题的安全问题。

相关术语

安全警告 - 缺少 oidc 主体的条件键

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing condition key for oidc principal: Using an Open ID Connect principal without a condition can be overly permissive. Add condition keys with a prefix that matches your federated OIDC principals to ensure that only the intended identity provider assumes the role.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using an Open ID Connect principal without a condition can be overly permissive. Add condition keys with a prefix that matches your federated OIDC principals to ensure that only the intended identity provider assumes the role."

解决安全警告

无条件地使用 Open ID Connect 主体可能过于宽容。添加前缀与联合 OIDC 主体匹配的条件键,以确保只有预期的身份提供商能够代入角色。

相关术语

安全警告 - 缺少 github 存储库条件键

在 AWS Management Console 中,此检查的结果包括以下消息:

Missing github repo condition key: Granting a federated GitHub principal permissions without a condition key can allow more sources to assume the role than you intended. Add the token.actions.githubusercontent.com:sub condition key and specify the branch and repository name in the value.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Granting a federated GitHub principal permissions without a condition key can allow more sources to assume the role than you intended. Add the token.actions.githubusercontent.com:sub condition key and specify the branch and repository name in the value."

解决安全警告

如果您将 GitHub 用作 OIDC IdP,则最佳实践是限制可以代入与 IAM IdP 关联的角色的实体。如果信任策略中包含 Condition 语句,则可将角色限制为特定的 GitHub 组织、存储库或分支。您可以使用条件键 token.actions.githubusercontent.com:sub 限制访问。我们建议您将条件限制为一组特定的存储库或分支。如果您未包含此条件,则来自您控制范围之外的组织或存储库的 GitHub 操作可代入与您 AWS 账户中的 GitHub IAM IdP 关联的角色。

相关术语

建议 — 空数组操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty array action: This statement includes no actions and does not affect the policy. Specify actions.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "This statement includes no actions and does not affect the policy. Specify actions."

解决建议

语句必须包含 Action 或者 NotAction 元素,其中包含一组操作。当元素为空时,策略语句不提供任何权限。在 Action 元素中指定操作。

建议 — 空数组条件

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty array condition: There are no values for the condition key {{key}} and it does not affect the policy. Specify conditions.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "There are no values for the condition key {{key}} and it does not affect the policy. Specify conditions."

解决建议

可选 Condition 元素结构要求您使用条件运算符和键值对。当条件值为空时,条件返回 true 并且策略语句不再提供任何权限。指定条件值。

建议 — 空数组条件 ForAllValues

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty array condition ForAllValues: The ForAllValues prefix with an empty condition key matches only if the key {{key}} is missing from the request context. To determine if the request context is empty, we recommend that you use the Null condition operator with the value of true instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The ForAllValues prefix with an empty condition key matches only if the key {{key}} is missing from the request context. To determine if the request context is empty, we recommend that you use the Null condition operator with the value of true instead."

解决建议

Condition 元素结构要求您使用条件运算符和键值对。ForAllValues 集合运算符测试请求集的每个成员的值是否为条件键集的子集。

当您将 ForAllValues 用于空数组条件键时,则只有在请求中没有密钥时,条件才匹配。AWS 会建议如果要测试请求上下文是否为空,请使用 Null 条件运算符。

建议 — 空数组条件 ForAnyValue

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty array condition ForAnyValue: The ForAnyValue prefix with an empty condition key {{key}} never matches the request context and it does not affect the policy. Specify conditions.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The ForAnyValue prefix with an empty condition key {{key}} never matches the request context and it does not affect the policy. Specify conditions."

解决建议

Condition 元素结构要求您使用条件运算符和键值对。ForAnyValues 集合运算符测试请求值集的至少一个成员是否与条件键值集的至少一个成员匹配。

当您使用带有空条件键的 ForAnyValues 时,条件永远不会匹配。这表示语句对策略没有影响。AWS 会建议您重写条件。

建议 — 空数组条件 IfExists

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty array condition IfExists: The IfExists suffix with an empty condition key matches only if the key {{key}} is missing from the request context. To determine if the request context is empty, we recommend that you use the Null condition operator with the value of true instead.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The IfExists suffix with an empty condition key matches only if the key {{key}} is missing from the request context. To determine if the request context is empty, we recommend that you use the Null condition operator with the value of true instead."

解决建议

...IfExists 后缀编辑条件运算符。这意味着如果请求的内容中存在策略键,则依照策略所述来处理键。如果该键不存在,则条件元素的计算结果将为 true。

当您将 ...IfExists 用于空数组条件键时,则只有在请求中没有密钥时,条件才匹配。AWS 会建议如果要测试请求上下文是否为空,请使用 Null 条件运算符。

建议 — 空数组主体

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty array principal: This statement includes no principals and does not affect the policy. Specify principals.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "This statement includes no principals and does not affect the policy. Specify principals."

解决建议

您必在 IAM 角色的信任策略和基于资源的策略中使用 PrincipalNotPrincipal 元素。基于资源的策略是直接嵌入资源中的策略。

当您在语句的 Principal 元素中提供空数组时,语句对策略没有影响。AWS 会建议您指定应有权访问资源的主体。

建议 — 空数组资源

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty array resource: This statement includes no resources and does not affect the policy. Specify resources.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "This statement includes no resources and does not affect the policy. Specify resources."

解决建议

语句必须包含 ResourceNotResource 元素。

当您在语句的资源元素中提供空数组时,该语句对策略没有影响。AWS 会建议您为资源指定 Amazon Resource Names (ARN)。

建议 — 空对象条件

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty object condition: This condition block is empty and it does not affect the policy. Specify conditions.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "This condition block is empty and it does not affect the policy. Specify conditions."

解决建议

Condition 元素结构要求您使用条件运算符和键值对。

当您在语句的条件元素中提供空对象时,该语句对策略没有影响。请删除可选元素或指定条件。

建议 — 空对象主体

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty object principal: This statement includes no principals and does not affect the policy. Specify principals.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "This statement includes no principals and does not affect the policy. Specify principals."

解决建议

您必在 IAM 角色的信任策略和基于资源的策略中使用 PrincipalNotPrincipal 元素。基于资源的策略是直接嵌入资源中的策略。

当您在语句的 Principal 元素中提供空对象时,语句对策略没有影响。AWS 会建议您指定应有权访问资源的主体。

建议 — 空 Sid 值

在 AWS Management Console 中,此检查的结果包括以下消息:

Empty Sid value: Add a value to the empty string in the Sid element.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Add a value to the empty string in the Sid element."

解决建议

Sid(声明 ID)元素允许您针对策略语句输入标识符。您可以为语句数组中的每个语句指定 Sid 值。如果您选择使用 Sid 元素,则您必须提供字符串值。

相关术语

建议 — 改善 IP 范围

在 AWS Management Console 中,此检查的结果包括以下消息:

Improve IP range: The non-zero bits in the IP address after the masked bits are ignored. Replace address with {{addr}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The non-zero bits in the IP address after the masked bits are ignored. Replace address with {{addr}}."

解决建议

IP 地址条件必须采用标准的 CIDR 格式,例如 203.0.113.0/24 或 2001:DB8:1234:5678::/64。如果在屏蔽位之后包含非零位,则不考虑这些位作为条件。AWS 会建议您使用消息中包含的新地址。

建议 — 带限定符的空值

在 AWS Management Console 中,此检查的结果包括以下消息:

Null with qualifier: Avoid using the Null condition operator with the ForAllValues or ForAnyValue qualifiers because they always return a true or false respectively.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Avoid using the Null condition operator with the ForAllValues or ForAnyValue qualifiers because they always return a true or false respectively."

解决建议

Condition 元素中,您可构建表达式并使用条件运算符(等于、小于等)将策略中的条件键和值与请求上下文中的键和值进行匹配。对单个条件键包含多个值的请求而言,必须使用 ForAllValuesForAnyValue 集合运算符。

当您使用带有 ForAllValuesNull 条件运算符时,则该语句将始终返回 true。当您使用带有 ForAnyValueNull 条件运算符时,则该语句始终返回 false。AWS 会建议您将 StringLike 条件运算符与这些集合运算符搭配使用。

相关术语

建议 — 私有 IP 地址子集

在 AWS Management Console 中,此检查的结果包括以下消息:

Private IP address subset: The values for condition key aws:SourceIp include a mix of private and public IP addresses. The private addresses will not have the desired effect. aws:SourceIp works only for public IP address ranges. To define permissions for private IP ranges, use aws:VpcSourceIp.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The values for condition key aws:SourceIp include a mix of private and public IP addresses. The private addresses will not have the desired effect. aws:SourceIp works only for public IP address ranges. To define permissions for private IP ranges, use aws:VpcSourceIp."

解决建议

全局条件键 aws:SourceIp 仅适用于公有 IP 地址范围。

当您的 Condition 元素同时包含私有 IP 地址和公有 IP 地址时,语句可能不会产生所需的效果。您不能使用 aws:VpcSourceIP 指定私有 IP 地址。

注意

全局条件键 aws:VpcSourceIP 仅在请求来自指定的 IP 地址并经过 VPC 终端节点时进行匹配。

建议 — 私有 NotIpAddress 子集

在 AWS Management Console 中,此检查的结果包括以下消息:

Private NotIpAddress subset: The values for condition key aws:SourceIp include a mix of private and public IP addresses. The private addresses have no effect. aws:SourceIp works only for public IP address ranges. To define permissions for private IP ranges, use aws:VpcSourceIp.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The values for condition key aws:SourceIp include a mix of private and public IP addresses. The private addresses have no effect. aws:SourceIp works only for public IP address ranges. To define permissions for private IP ranges, use aws:VpcSourceIp."

解决建议

全局条件键 aws:SourceIp 仅适用于公有 IP 地址范围。

当您的 Condition 元素包含 NotIpAddress 条件运算符以及同时包括私有 IP 地址和公有 IP 地址的时,语句可能不会产生所需的效果。策略中未指定的每个公有 IP 地址都将匹配。任何私有 IP 地址都不会匹配。为了达到这个效果,您可以使用带有 aws:VpcSourceIPNotIpAddress 并指定不应匹配的私有 IP 地址。

建议 — 冗余操作

在 AWS Management Console 中,此检查的结果包括以下消息:

Redundant action: The {{redundantActionCount}} action(s) are redundant because they provide similar permissions. Update the policy to remove the redundant action such as: {{redundantAction}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The {{redundantActionCount}} action(s) are redundant because they provide similar permissions. Update the policy to remove the redundant action such as: {{redundantAction}}."

解决建议

当在 Action 元素中使用通配符 (*) 时,您可以包含冗余权限。AWS 会建议您查看策略并仅包含所需权限。这可以帮助您删除冗余操作。

例如,以下操作包括两次 iam:GetCredentialReport 操作。

"Action": [ "iam:Get*", "iam:List*", "iam:GetCredentialReport" ],

在此示例中,为以 GetList 开头的每个 IAM 操作均定义了权限。当 IAM 添加额外的获取或列示操作时,此策略将允许这些操作。您可能希望允许所有这些只读操作。iam:GetCredentialReport 操作已作为 iam:Get* 的一部分纳入。要删除重复的权限,您可以删除 iam:GetCredentialReport

当操作的所有内容都是冗余时,您会收到此策略检查的结果。在此示例中,如果元素包含 iam:*CredentialReport,则不被认为是冗余的。这包括冗余的 iam:GetCredentialReport 和非冗余的 iam:GenerateCredentialReport。删除 iam:Get*iam:*CredentialReport 将更改策略的权限。

带有此建议的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

冗余操作不影响策略所授予的权限。使用 AWS 托管策略作为创建客户托管策略的参考时,AWS 会建议您从策略中删除冗余操作。

建议 — 冗余条件值编号

在 AWS Management Console 中,此检查的结果包括以下消息:

Redundant condition value num: Multiple values in {{operator}} are redundant. Replace with the {{greatest/least}} single value for {{key}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Multiple values in {{operator}} are redundant. Replace with the {{greatest/least}} single value for {{key}}."

解决建议

对条件键中的类似值使用数字条件运算符时,您可以创建重叠,从而会导致冗余权限。

例如,以下 Condition 元素包含多个具有 1200 秒年龄重叠的 aws:MultiFactorAuthAge 条件。

"Condition": { "NumericLessThan": { "aws:MultiFactorAuthAge": [ "2700", "3600" ] } }

在此示例中,如果在不到 3600 秒(1 小时)之前完成多重身份验证 (MFA),则定义权限。您可以删除冗余 2700 值。

建议 — 冗余资源

在 AWS Management Console 中,此检查的结果包括以下消息:

Redundant resource: The {{redundantResourceCount}} resource ARN(s) are redundant because they reference the same resource. Review the use of wildcards (*)

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The {{redundantResourceCount}} resource ARN(s) are redundant because they reference the same resource. Review the use of wildcards (*)"

解决建议

当您在 Amazon Resource Names (ARN) 中使用通配符 (*) 时,您可以创建冗余资源权限。

例如,以下 Resource 元素包含多个具有冗余权限的 ARN。

"Resource": [ "arn:aws:iam::111122223333:role/jane-admin", "arn:aws:iam::111122223333:role/jane-s3only", "arn:aws:iam::111122223333:role/jane*" ],

在此示例中,为名称以 jane 开头的任何角色定义了权限。您可以删除冗余 jane-adminjane-s3only ARN,而不更改生成的权限。这确实会使策略变得动态化。它将为未来的任何以 jane 开头的角色定义权限。如果策略的目的是允许访问静态数量的角色,则删除最后一个 ARN 并仅列出应定义的 ARN。

带有此建议的 AWS 托管策略

AWS 托管策略将根据一般 AWS 使用案例分配权限,从而使您能开始使用 AWS。

冗余资源不影响策略所授予的权限。使用 AWS 托管策略作为创建客户托管策略的参考时,AWS 会建议您从策略中删除冗余资源。

建议 — 冗余语句

在 AWS Management Console 中,此检查的结果包括以下消息:

Redundant statement: The statements are redundant because they provide identical permissions. Update the policy to remove the redundant statement.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The statements are redundant because they provide identical permissions. Update the policy to remove the redundant statement."

解决建议

Statement 元素为策略的主要元素。该元素为必填项。Statement 元素可以包含一条语句或由单独语句组成的数组。

如果在长策略中多次包含相同的语句,则为冗余语句。您可以删除其中一个语句,不会影响策略授予的权限。当某人编辑策略时,他们可能会更改其中一个语句而不更新副本。这可能会导致超出预期的权限。

建议 — 服务名称中的通配符

在 AWS Management Console 中,此检查的结果包括以下消息:

Wildcard in service name: Avoid using wildcards (*, ?) in the service name because it might grant unintended access to other AWS services with similar names.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Avoid using wildcards (*, ?) in the service name because it might grant unintended access to other AWS services with similar names."

解决建议

当您在策略中包含 AWS 服务的名称时,AWS 建议您不要包括通配符 (*, ?)。这可能会为您意料之外的未来服务添加权限。例如,有数十个 AWS 服务在其名称中包含 *code*

"Resource": "arn:aws:*code*::111122223333:*"

建议 — 使用不支持的标签条件键允许服务

在 AWS Management Console 中,此检查的结果包括以下消息:

Allow with unsupported tag condition key for service: Using the effect Allow with the tag condition key {{conditionKeyName}} and actions for services with the following prefixes does not affect the policy: {{serviceNames}}. Actions for the listed service are not allowed by this statement. We recommend that you move these actions to a different statement without this condition key.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the effect Allow with the tag condition key {{conditionKeyName}} and actions for services with the following prefixes does not affect the policy: {{serviceNames}}. Actions for the listed service are not allowed by this statement. We recommend that you move these actions to a different statement without this condition key."

解决建议

在带有 "Effect": "Allow" 的策略的 Condition 元素中使用不受支持的标签条件键不会影响策略授予的权限,因为该服务操作将忽略该条件。AWS 会建议您删除将不支持条件键的服务的操作删除,并创建另一个语句以允许访问该服务中的特定资源。

如果您使用 aws:ResourceTag 条件键,并且服务操作不支持该键,则该键不会包含在请求上下文中。在本例中,Allow 语句中的条件总是返回 false 并且该操作将永远不被允许。即使资源被正确标记,也会发生这种情况。

当服务支持 aws:ResourceTag 条件键时,您可以使用标签来控制对该服务资源的访问。这称为基于属性的访问控制 (ABAC)。不支持这些密钥的服务需要您使用基于资源的访问控制 (RBAC) 来控制对资源的访问。

注意

某些服务允许支持其资源和操作子集的 aws:ResourceTag 条件键。IAM Access Analyzer 将返回不受支持的服务操作结果。例如,Amazon S3 支持其资源子集的 aws:ResourceTag。要查看 Amazon S3 中支持 aws:ResourceTag 条件键的所有资源类型,请参阅服务授权参考中的 Amazon S3 定义的资源类型

例如,假设您希望允许团队成员查看使用键值对 team=BumbleBee 标记的特定资源的详细信息。同时假设 AWS Lambda 允许您标记资源,但不支持 aws:ResourceTag 条件键。要在此标签存在的情况下允许查看 AWS App Mesh 和 AWS Backup 的操作,请使用 aws:ResourceTag 条件键。对于 Lambda,请使用资源命名约定,其中包含团队名称作为前缀。然后包含一个单独的语句,以允许查看具有该命名约定的资源。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "AllowViewSupported", "Effect": "Allow", "Action": [ "appmesh:DescribeMesh", "backup:GetBackupPlan" ], "Resource": "*", "Condition": { "StringEquals": { "aws:ResourceTag/team": "BumbleBee" } } }, { "Sid": "AllowViewUnsupported", "Effect": "Allow", "Action": "lambda:GetFunction", "Resource": "arn:aws:lambda:*:123456789012:function:team-BumbleBee*" } ] }
警告

请勿将带有 "Effect": "Allow"Not 版本条件运算符用为此结果的解决方法。这些条件运算符提供否定匹配。这意味着在评估条件后,结果将被否定。在前面的示例中,在带有 StringNotEquals 运算符的 AllowViewSupported 语句中包括 lambda:GetFunction 操作将始终允许操作,无论资源是否被标记。

请勿将...IfExists版本的条件运算符用作此结果的解决方法。这表示“当键存在于请求上下文中且值匹配时,允许操作。否则,允许操作。” 在前面的示例中,在带有 StringEqualsIfExists 运算符的 AllowViewSupported 语句中包含 lambda:GetFunction 操作将始终允许该操作。对于该操作,密钥不存在于上下文中,并且每次尝试查看该资源类型时都会被允许,无论资源是否被标记。

相关术语

建议 — 使用不支持的标签条件键允许服务的 NotAction

在 AWS Management Console 中,则此检查的结果包括以下消息:

Allow NotAction with unsupported tag condition key for service: Using the effect Allow with NotAction and the tag condition key {{conditionKeyName}} allows only service actions that support the condition key. The condition key doesn't apply to some service actions. We recommend that you use Action instead of NotAction.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "Using the effect Allow with NotAction and the tag condition key {{conditionKeyName}} allows only service actions that support the condition key. The condition key doesn't apply to some service actions. We recommend that you use Action instead of NotAction."

解决建议

在带有 NotAction"Effect": "Allow" 元素的策略的 Condition 元素使用不受支持的标签条件键不会影响策略授予的权限。对于不支持条件键的服务操作,该条件将被忽略。AWS 会建议您重写逻辑以允许操作列表。

如果您将 aws:ResourceTag 条件键与 NotAction 搭配使用,则不会允许任何不支持密钥的新或现有服务操作。AWS 会建议您明确列出要允许的操作。IAM Access Analyzer 为列出的不支持 aws:ResourceTag 条件键的操作返回单独的结果。有关更多信息,请参阅 建议 — 使用不支持的标签条件键允许服务

当服务支持 aws:ResourceTag 条件键时,您可以使用标签来控制对该服务资源的访问。这称为基于属性的访问控制 (ABAC)。不支持这些密钥的服务需要您使用基于资源的访问控制 (RBAC) 来控制对资源的访问。

相关术语

在 AWS Management Console 中,此检查的结果包括以下消息:

Recommended condition key for service principal: To restrict access to the service principal {{servicePrincipalPrefix}} operating on your behalf, we recommend aws:SourceArn, aws:SourceAccount, aws:SourceOrgID, or aws:SourceOrgPaths instead of {{key}}.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "To restrict access to the service principal {{servicePrincipalPrefix}} operating on your behalf, we recommend aws:SourceArn, aws:SourceAccount, aws:SourceOrgID, or aws:SourceOrgPaths instead of {{key}}."

解决建议

您可以使用服务主体指定基于资源策略的 Principal 元素中的 AWS 服务,这是服务的标识符。授予服务主体访问权限时,您应该使用 aws:SourceArnaws:SourceAccountaws:SourceOrgIDaws:SourceOrgPaths 条件键,而不是 aws:Referer 等其他条件键。这样可以帮助您防止称为混淆代理问题的安全问题。

相关术语

建议 — 策略中的条件密钥无关

在 AWS Management Console 中,此检查的结果包括以下消息:

Irrelevant condition key in policy: The condition key {{condition-key}} is not relevant for the {{resource-type}} policy. Use this key in an identity-based policy to govern access to this resource.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The condition key {{condition-key}} is not relevant for the {{resource-type}} policy. Use this key in an identity-based policy to govern access to this resource."

解决建议

与基于资源的策略不相关的条件密钥。例如,s3:ResourceAccount 条件密钥与附加到 Amazon S3 存储桶或 Amazon S3 访问点资源类型的基于资源的策略无关。

您可以在基于身份的策略中使用条件,以便控制对资源的访问。

相关术语

建议 - 角色信任政策中的冗余主体

在 AWS Management Console 中,此检查的结果包括以下消息:

Redundant principal in role trust policy: The assumed-role principal {{redundant_principal}} is redundant with its parent role {{parent_role}}. Remove the assumed-role principal.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The assumed-role principal {{redundant_principal}} is redundant with its parent role {{parent_role}}. Remove the assumed-role principal."

解决建议

如果在策略的 Principal 元素中同时指定代入角色的主体及其父角色,则不会允许或拒绝任何不同的权限。例如,使用以下格式指定 Principal 元素是多余的:

"Principal": { "AWS": [ "arn:aws:iam::AWS-account-ID:role/rolename", "arn:aws:iam::AWS-account-ID:assumed-role/rolename/rolesessionname" ]

我们建议删除代入角色的主体。

相关术语

建议 - 确认受众声明类型

在 AWS Management Console 中,此检查的结果包括以下消息:

Confirm audience claim type: The 'aud' (audience) claim key identifies the recipients that the JSON web token is intended for. Audience claims can be multivalued or single-valued. If the claim is multivalued, use a ForAllValues or ForAnyValue qualifier. If the claim is single-valued, do not use a qualifier.

在对 AWS CLI 或者 AWS API 的编程调用中,此检查的结果包括以下消息:

"findingDetails": "The 'aud' (audience) claim key identifies the recipients that the JSON web token is intended for. Audience claims can be multivalued or single-valued. If the claim is multivalued, use a ForAllValues or ForAnyValue qualifier. If the claim is single-valued, do not use a qualifier."

解决建议

aud(受众)声明键是应用程序的唯一标识符,该键在您向 IdP 注册应用程序时颁发给您,并标识 JSON Web 令牌的预期接收者。受众声明可以是多值的,也可以是单值的。如果声明是多值的,请使用 ForAllValuesForAnyValue 条件集运算符。如果声明是单值的,请不要使用条件集运算符。

相关术语