Skip to content

Blob IAM support apparently invalid #4087

Closed

Description

@tseaver

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

Traceback (most recent call last):
  File "/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/tests/system.py", line 372, in test_blob_acl_iam_w_user_project
    blob.set_iam_policy(policy)
  File "/home/tseaver/projects/agendaless/Google/src/google-cloud-python/storage/google/cloud/storage/blob.py", line 1148, in set_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", line 293, in api_request
    raise exceptions.from_http_response(response)
google.api.core.exceptions.BadRequest: 400 PUT https://www.googleapis.com/storage/v1/b/new_1506705016579/o/SmallFile/iam?userProject=citric-celerity-697: roles/storage.objectViewer is not a valid role for projects/_/buckets/new_1506705016579/objects/SmallFile#0.

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

(Pdb) pp policy.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?

Activity

  1. added
    api: storageIssues related to the Cloud Storage API.
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Sep 29, 2017
  2. tseaver commented on Sep 29, 2017

    @tseaver
    ContributorAuthor

    @frankyn confirmed to me offline:

    There is no Object level IAM only Object Level ACL.

  3. tseaver commented on Sep 29, 2017

    @tseaver
    ContributorAuthor

    It turns out that Blob.set_iam_policy can only assign the following "legacy" roles:

    • roles/storage.legacyObjectReader
    • roles/storage.legacyObjectOwner
  4. frankyn commented on Oct 18, 2017

    @frankyn
    Contributor

    IAM object-level methods should not be deprecated. We should document how to use these methods to assign legacy roles instead.

  5. tseaver commented on Oct 20, 2017

    @tseaver
    ContributorAuthor

    @frankyn ISTM that the back-end docs need to be updated correspondingly (and first, so that we track them without guesswork).

  6. frankyn commented on Oct 23, 2017

    @frankyn
    Contributor

    Good point. I'm working on resolving this in Storage docs. I'll update this issue.

  7. added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Nov 2, 2017
  8. tseaver commented on Jan 4, 2018

    @tseaver
    ContributorAuthor

    @frankyn ping?

  9. frankyn commented on Jan 5, 2018

    @frankyn
    Contributor
  10. added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Jan 9, 2018
  11. frankyn commented on Jan 10, 2018

    @frankyn
    Contributor

    @tseaver docs were blocked by an internal bug and I will check-in again this week. Apologies for the delay.

  12. tseaver commented on Feb 20, 2018

    @tseaver
    ContributorAuthor

    @frankyn I still don't see API documentation for objects.getIamPermissions et. al.

  13. frankyn commented on Feb 20, 2018

    @frankyn
    Contributor

    Will update soon. I need to sync with a few stakeholders on the GCS team before continuing there exist additional open questions before introducing the docs back into the world. Setting up meeting for mid-next week given some are OOO. I will have a better update then. Thank you for patience.

  14. frankyn commented on Feb 22, 2018

    @frankyn
    Contributor

    Sent a document for GCS team review to determine consensus for what to do here.

  15. tseaver commented on Apr 11, 2018

    @tseaver
    ContributorAuthor

    @frankyn ping?

  16. frankyn commented on Apr 11, 2018

    @frankyn
    Contributor

    Hey @tseaver, responding through hangouts.

  17. added a commit that references this issue on Apr 11, 2018
    f7107ef
  18. added a commit that references this issue on Mar 9, 2026
    015d0c6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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