Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google cloud platform GCS对象的云IAM条件_Google Cloud Platform_Google Cloud Storage - Fatal编程技术网

Google cloud platform GCS对象的云IAM条件

Google cloud platform GCS对象的云IAM条件,google-cloud-platform,google-cloud-storage,Google Cloud Platform,Google Cloud Storage,我在使用时遇到问题,无法将我的服务帐户限制为仅具有读取GCS存储桶中某些文件的权限 我尝试使用以下条件: resource.name.startsWith("projects/_/buckets/some-bucket/objects/fooItems%2f12345") 其中,我希望允许服务帐户仅对bucket中前缀为footems/12345的文件具有读取权限some bucket 即,不应授权以下文件: gs://some-bucket/fooItems/555/f.

我在使用时遇到问题,无法将我的服务帐户限制为仅具有读取GCS存储桶中某些文件的权限

我尝试使用以下条件:

resource.name.startsWith("projects/_/buckets/some-bucket/objects/fooItems%2f12345")
其中,我希望允许服务帐户仅对bucket中前缀为
footems/12345
的文件具有读取权限
some bucket

即,不应授权以下文件:

gs://some-bucket/fooItems/555/f.txt
gs://some-bucket/fooItems/555/foo/s.log
gs://some-bucket/fooItems/1234/f.txt
gs://some-bucket/fooItems/1234/foo/s.log
但应授权以下文件:

gs://some-bucket/fooItems/555/f.txt
gs://some-bucket/fooItems/555/foo/s.log
gs://some-bucket/fooItems/1234/f.txt
gs://some-bucket/fooItems/1234/foo/s.log
我遇到的问题是,甚至像
gs://some bucket/footItems/555/*
这样的文件都是可读的

我尝试了使用和不使用编码的
/
,即:

resource.name.startsWith(“projects/\uu/bucket/some bucket/objects/footItems/12345”)

resource.name.startsWith(“projects/\uu/bucket/some bucket/objects/fooItems%2f12345”)

如果只想对bucket中的某些文件授予权限,则应使用而不是IAM权限。这叫做


为了实现这一点,您应该将bucket的策略更改为细粒度,然后您可以导航到要授予服务帐户权限的对象,并将其添加为

谢谢。这是否意味着我需要为每个对象指定此参数?即,如果上载了新对象,我需要设置ACL吗?或者仍然可以定义ACL,类似于使用IAM条件(a la
name.startsWith()
),您也可以使用ACL设置。我将尝试这样做。然而,通过阅读更多的内容和答案,例如,我真的得到了这样的印象:这应该是通过IAM条件实现的?您是否检查了此
云IAM条件
的接收者是否具有原始角色
角色/所有者
角色/编辑器
角色/查看器
。如果是,则不会检查该条件。请同时检查是否激活了统一存储桶级别访问,这是使用云IAM条件所必需的]@Juancki,收件人没有原始角色,并且统一存储桶级别访问确实已激活Hi@simen andresen,这似乎可能是云IAM的问题,请尝试使用
resource.name==“projects/u/bucket/some bucket”| | resource.name.startsWith(“projects/u/bucket/some bucket/objects/footems/12345”)
@Juancki,我现在要测试它了。有了你的建议,它就行了!但是,现在它似乎在没有第一个条件(`resource.name==“projects/\uu/bucket/some bucket”)的情况下也能工作。是否可能是云IAM条件存在问题,现在已修复?