Skip to content

Version 0.17 breaks GCS blob signing #1964

@dguaraglia

Description

@dguaraglia

When trying to update our project to use gcloud 0.17, we found one of our tests which uses the generate_signed_url for GCS blobs started failing with the following error:

project/tests/common.py:302:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
project/gcs.py:159: in get_signed_url
    return self._content.generate_signed_url(delta, method=method, content_type=content_type)
../../../../.virtualenvs/project/lib/python2.7/site-packages/gcloud/storage/blob.py:239: in generate_signed_url
    generation=generation)
../../../../.virtualenvs/project/lib/python2.7/site-packages/gcloud/credentials.py:223: in generate_signed_url
    string_to_sign)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

credentials = <oauth2client.client.GoogleCredentials object at 0x10f435690>, expiration = 1467937858
string_to_sign = 'GET\n\napplication/json\n1467937858\n/project-test-hcpc74v437kuc-ops/file7jcwv4v437kuc'

    def _get_signed_query_params(credentials, expiration, string_to_sign):
        """Gets query parameters for creating a signed URL.

        :type credentials: :class:`oauth2client.client.AssertionCredentials`
        :param credentials: The credentials used to create a private key
                            for signing text.

        :type expiration: int or long
        :param expiration: When the signed URL should expire.

        :type string_to_sign: string
        :param string_to_sign: The string to be signed by the credentials.

        :rtype: dict
        :returns: Query parameters matching the signing credentials with a
                  signed payload.
        """
>       _, signature_bytes = credentials.sign_blob(string_to_sign)
E       AttributeError: 'GoogleCredentials' object has no attribute 'sign_blob'

Metadata

Metadata

Assignees

Labels

api: storageIssues related to the Cloud Storage API.authtype: 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