(resource:*)
,或所有操作(action:*)
权限,则存在由于权限范围过大导致数据安全风险。{"version": "2.0","statement": [{"action": [//简单上传操作"name/cos:PutObject",//表单上传对象"name/cos:PostObject",//分块上传:初始化分块操作"name/cos:InitiateMultipartUpload",//分块上传:List 进行中的分块上传"name/cos:ListMultipartUploads",//分块上传:List 已上传分块操作"name/cos:ListParts",//分块上传:上传分块块操作"name/cos:UploadPart",//分块上传:完成所有分块上传操作"name/cos:CompleteMultipartUpload",//取消分块上传操作"name/cos:AbortMultipartUpload"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]},{"action": [//下载操作"name/cos:GetObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc2/*"]}]}
名称 | 描述 |
version | 策略语法版本,默认为2.0。 |
effect | 有 allow (允许)和 deny (显式拒绝)两种情况。 |
resource | 授权操作的具体数据,可以是任意资源、指定路径前缀的资源、指定绝对路径的资源或它们的组合。 注意: 若路径为中文,则保持中文输入即可。例如 examplebucket-1250000000/文件夹/文件名.txt 。 |
action | 此处是指 COS API,根据需求指定一个或者一序列操作的组合或所有操作( * ),例如 action 为 name/cos:GetService ,请注意区分英文大小写。 |
condition |
*
。{"version": "2.0","statement": [{"action": ["name/cos:GetService"],"effect": "allow","resource": ["*"]}]}
*
,该策略限定的资源范围,存在由于权限范围过大导致数据安全风险,请谨慎配置。qcs::cos:ap-beijing:uid/1250000000:*
。qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/*
。{"version": "2.0","statement": [{"action": ["name/cos:PutBucket"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:HeadBucket"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:GetBucket"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:DeleteBucket"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:PutBucketACL"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:GetBucketACL"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:PutBucketCORS"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:GetBucketCORS"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:DeleteBucketCORS"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:PutBucketLifecycle"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:GetBucketLifecycle"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:DeleteBucketLifecycle"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
*
。qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/*
。qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*
。doc/audio.mp3
的对象,则策略的 resource 为qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/audio.mp3
。{"version": "2.0","statement": [{"action": ["name/cos:PutObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
"name/cos:InitiateMultipartUpload","name/cos:ListMultipartUploads","name/cos:ListParts","name/cos:UploadPart","name/cos:CompleteMultipartUpload","name/cos:AbortMultipartUpload"
的集合。{"version": "2.0","statement": [{"action": ["name/cos:InitiateMultipartUpload","name/cos:ListMultipartUploads","name/cos:ListParts","name/cos:UploadPart","name/cos:CompleteMultipartUpload","name/cos:AbortMultipartUpload"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:ListMultipartUploads"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:PostObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:AppendObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:HeadObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:GetObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:PutObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]},{"action": ["name/cos:GetObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc2/*"]}]}
"qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc2/*"
为源对象。"name/cos:InitiateMultipartUpload","name/cos:ListMultipartUploads","name/cos:ListParts","name/cos:PutObject","name/cos:CompleteMultipartUpload","name/cos:AbortMultipartUpload"
集合, 和源对象的 action 为 name/cos:GetObject。{"version": "2.0","statement": [{"action": ["name/cos:InitiateMultipartUpload","name/cos:ListMultipartUploads","name/cos:ListParts","name/cos:PutObject","name/cos:CompleteMultipartUpload","name/cos:AbortMultipartUpload"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]},{"action": ["name/cos:GetObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc2/*"]}]}
"qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc2/*"
为源对象。{"version": "2.0","statement": [{"action": ["name/cos:PutObjectACL"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:GetObjectACL"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:OptionsObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:PostObjectRestore"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:DeleteObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/audio.mp3"]}]}
action
为name/cos:DeleteObject
。{"version": "2.0","statement": [{"action": ["name/cos:DeleteObject"],"effect": "allow","resource": ["qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/audio.mp3","qcs::cos:ap-beijing:uid/1250000000:examplebucket-1250000000/video.mp4"]}]}
{"version": "2.0","statement": [{"action": ["*"],"effect": "allow","resource": ["*"]}]}
{"version": "2.0","statement": [{"action": ["name/cos:HeadObject","name/cos:GetObject","name/cos:GetBucket","name/cos:OptionsObject"],"effect": "allow","resource": ["*"]}]}
{"version": "2.0","statement": [{"action": ["*"],"effect": "allow","resource": ["qcs::cos:ap-shanghai:uid/1250000000:examplebucket-1250000000/doc/*"]}]}
本页内容是否解决了您的问题?