简体   繁体   English

禁止在 sns:ListTopics 上使用通配符资源

[英]Forbidden on sns:ListTopics with wildcard resources

My team has an account with full permission on SNS as long as we act on resources based on a certain prefix只要我们根据某个前缀对资源进行操作,我的团队就有一个对 SNS 具有完全权限的帐户

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
          "sns:CreateTopic",
          // ...
          "sns:ListTopics",
          // ...
      ],
      "Resource": "arn:aws:sns:eu-west-1:{redacted}:team-prefix-*"
    },

We can do most operations just fine, at least the ones we most need, but if we try to list the topics we get a forbidden error我们可以很好地完成大多数操作,至少是我们最需要的那些,但是如果我们尝试列出主题,我们会得到一个禁止的错误

SNS: ListTopics, AuthorizationError: User xxx is not authorized to perform: SNS:ListTopics on resource: arn:aws:sns:eu-west-1:{redacted}:*

We are using the new go SDK v2, and we cannot find a way to query only for our topics, is there a way to list them or do we need list permissions on all the account topics?我们正在使用新的 go SDK v2,我们找不到只查询我们的主题的方法,有没有办法列出它们,还是我们需要所有帐户主题的列表权限?

sns:ListTopics does not have a resource filter per ( https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html ) its an all or nothing operation. sns:ListTopics 没有资源过滤器( https://docs.aws.amazon.com/sns/latest/api/API_ListTopics.html )它是全有或全无操作。
Except from amazon docs: if you specify a resource type in a statement with an action that does not support that resource type, then the statement doesn't allow access.亚马逊文档除外: if you specify a resource type in a statement with an action that does not support that resource type, then the statement doesn't allow access. link 关联

Typically, this is what the IAM document should look like if you want to be able to list.通常,如果您希望能够列出,则 IAM 文档应该是这样的。

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
          "sns:CreateTopic"
      ],
      "Resource": "arn:aws:sns:eu-west-1:{redacted}:team-prefix-*"
    },
    {
      "Effect": "Allow",
      "Action": [
          "sns:ListTopics",
      ],
      "Resource": "*"
    },
...

If separation at the granular level is really that big of a concern, separate AWS accounts should be used.如果粒度级别的分离确实是一个大问题,则应使用单独的 AWS 账户。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM