Skip to content

Blob IAM support apparently invalid #4087

Description

@tseaver

While writing system tests for the requester_pays feature, I triggered the following:

Traceback (mostrecentcalllast):
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/tests/system.py", line372, intest_blob_acl_iam_w_user_projectblob.set_iam_policy(policy)
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/google/cloud/storage/blob.py", line1148, inset_iam_policy_target_object=None)
File"/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/.nox/sys-3-6/lib/python3.6/site-packages/google/cloud/_http.py", line293, inapi_requestraiseexceptions.from_http_response(response)
google.api.core.exceptions.BadRequest: 400PUThttps://www.googleapis.com/storage/v1/b/new_1506705016579/o/SmallFile/iam?userProject=citric-celerity-697: roles/storage.objectViewerisnotavalidroleforprojects/_/buckets/new_1506705016579/objects/SmallFile#0.

Note that the earlier call to Blob.get_iam_policy does succeed, returning:

(Pdb) pppolicy.to_api_repr()
{'bindings': [{'members': ['projectEditor:some-project-742',
'projectOwner:some-project-742',
'serviceAccount:1065521786570-19reuv03qbdp37du41inh9gtd1s35g1j@developer.gserviceaccount.com'],
'role': 'roles/storage.legacyObjectOwner'},
{'members': ['projectViewer:some-project-742'],
'role': 'roles/storage.legacyObjectReader'},
{'members': ['allUsers'], 'role': 'roles/storage.objectViewer'}],
'etag': 'CAM='}

We don't have existing system tests for Blob.set_iam_policy, but the Storage IAM docs don't define any IAM operations for blobs, only for buckets and projects. Indeed, they say:

To learn about controlling access to individual objects in your buckets, see Access Control Lists.

The API documentation for Objects also doesn't (any longer?) show getIamPolicy, setIamPolicy, or testIamPermissions.

@lukesneeringer can you loop somebody in to clarify?

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.backendpriority: p2Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions