GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Separate use-cases for generating signed object references · Issue #106 · googleapis/google-cloud-java

Separate use-cases for generating signed object references #106

New issue
Copy link
New issue
Copy link
Closed
Closed
Separate use-cases for generating signed object references#106
Copy link
Assignees
aozarov
Labels
🚨 criticalP0 critical issue. Requires immediate fixapi: storageIssues related to the Cloud Storage API.status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.triage meI really want to be triaged.

Description

@jboynes
jboynes
opened on Jun 10, 2015
Issue body actions

There's currently one method for generating signed references:

URL signUrl(BlobInfo blobInfo, long expirationTimeInSeconds, SignUrlOption... options);

There are a number of SignUrlOption types but its not clear from the interface which ones can be used in combination. For example:

  • specifying md5 and contentType should not be allowed for a GET, HEAD or DELETE
  • for PUT, md5 and contentType take their values from BlobInfo but the object hasn't been created yet

I also don't see how extension headers or the base URL would be specified.

Instead, can we use a method chain for this:

  URI get = datastore.signedReference(bucketName, objectName, expiration).toURI();
  String put = datastore.signedReference(bucketName, objectName, expiration)
      .forPut().ofContentType("text/plain").toString();

Activity

Next
  1. aozarov commented on Jun 10, 2015

    @aozarov
    aozarov
    on Jun 10, 2015
    Contributor
    More actions

    I would prefer not to introduce a new method invocation style (so API is simple to learn/use).

    Current styles are:

    • standard invocation with options as optional varargs.
    • When invocation settings is to complex for the above pass an immutable XXXRequest constructed
      by its associated XXXRequset.Builder

    Canonicalized_Extension_Headers option was not added as I found it confusing and I saw that also other clients such as gsutil were selective in what options they expose. However, it should be simple to add as another SignUrlOption if desired.

    I am not sure where it is specified that md5 and contentType are not allowed for GET, HEAD,..
    My understanding was that GCS mandates that any HTTP request for signed URL with MD5
    and/or CONTENT_TYPE must supply a matching header as well. Are you saying the the HTTP
    spec does not allow specifying these headers in some of the request types?

    In general, after I got that as a feedback from the Datastore review, in the API am a trying to force
    a valid request construct but without applying any client-side validation of options that are enforced by the server (and might change one day).

  2. jboynes commented on Jun 10, 2015

    @jboynes
    jboynes
    on Jun 10, 2015
    Author
    More actions

    Content-MD5 and Content-Type both refer to the entity contained in the message. For GET, HEAD and DELETE there is no entity allowed in the request so these would not apply.

    They make sense if the user wants to constrain a PUT request so that the client can only upload data of a certain type or specific data. Use-case would be:

    1. Client picks file it wants to upload
    2. Client makes request to get PUT URI passing media type and md5 of file
    3. Server returns signed URI which only allows that media type and file
    4. Client uploads data; if content-type or md5 don't match server rejects the upload

    That's assuming the client isn't doing a resumable upload.

  3. aozarov commented on Jun 10, 2015

    @aozarov
    aozarov
    on Jun 10, 2015
    Contributor
    More actions

    @Capstan can you confirm?

  4. jboynes
    added
    api: storageIssues related to the Cloud Storage API.
    on Jun 10, 2015
  5. Capstan commented on Jun 11, 2015

    @Capstan
    Capstan
    on Jun 11, 2015
    Contributor
    More actions

    @jboynes is correct. For those HTTP verbs, there'd be no body for which those headers apply. You could specify them, but they'd be at best a no-op (Content-Type: whatever, Content-MD5: 1B2M2Y8AsgTpgAmY7PhCfg==) or worse an error for a MD5 mismatch presuming we check, which I'm not sure we do.

  6. aozarov commented on Jun 11, 2015

    @aozarov
    aozarov
    on Jun 11, 2015
    Contributor
    More actions

    Ok, good to know.

    I don't think this is clear in this documentation and therefore assumed it would be used to verify header matching regardless of the request type.

    I assumed it could be used, for example, to provide a signed URL to get a content of specific/version-of blob only if it was not modified (by using the MD5 header).

  7. Capstan commented on Jun 11, 2015

    @Capstan
    Capstan
    on Jun 11, 2015
    Contributor
    More actions

    Happy to take docs suggestions. Both of them are marked optional in the table in the docs you pointed to, and talk about the request not the response.

    Canonical Extension Headers refer to those extension headers that you may want to allow the user to specify. e.g.,

    • x-goog-acl if you wanted the user to override the default object acl with something specific
    • x-goog-generation if you wanted to pin the request to a specific version
    • x-goog-hash to validate CRC32c (or MD5)
    • x-goog-meta-* to ensure that specific custom metadata is attached to the object
    • x-goog-project-id if listing or creating new buckets

    POST policies even allow more specific conditions.

  8. aozarov commented on Oct 23, 2015

    @aozarov
    aozarov
    on Oct 23, 2015
    Contributor
    More actions

    @mziccard My preference is to keep the library method dispatching style consistent, and minimize on client side validation.

    I agree, that we could be more "user-friendly" using the suggestion above for some use-cases.
    What do you think?

  9. mziccard commented on Oct 23, 2015

    @mziccard
    mziccard
    on Oct 23, 2015
    Contributor
    More actions

    I would keep this as simple as possible. I agree that we should not change the library style. I don't think that having a method chain like:

    storage.signedReference(bucketName, objectName, expiration)
      .forPut().ofContentType("text/plain").toString();
    

    helps a lot.

    AWS APIs use a GeneratePresignedUrlRequest class to set all signed url options, and then a method generatePresignedUrl to generate the URL object. This last method throws exceptions if something goes wrong with signing and I assume it includes some kind of input validation.
    We could do something similar, and the style fits with the one of BatchRequest and ComposeRequest. But this clashes with your preference of minimizing client side validation.

  10. aozarov
    added
    status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.
    on Nov 19, 2015
  11. aozarov commented on Nov 19, 2015

    @aozarov
    aozarov
    on Nov 19, 2015
    Contributor
    More actions

    Yes, I doubt that adding another XXXRequest style call is going to help (unless we use subclasses to support the different combination) as I would not want to have runtime validation done by the client (we could actually do that now if we wanted to).

    Looks like we both think we can leave it as is, so I am closing it for now.

  12. aozarov
    closed this as completedon Nov 19, 2015
  13. yoshi-automation
    added
    🚨 criticalP0 critical issue. Requires immediate fix
    triage meI really want to be triaged.
    on Apr 6, 2020
  14. JustinBeckwith
    assigned
    aozarov
    on Feb 1, 2021
  15. 4 remaining items

  16. github-actions
    added a commit that references this issue on Jul 1, 2022

    chore(main): release 1.2.0 (googleapis#109)

    0a29469
  17. github-actions
    added a commit that references this issue on Aug 9, 2022

    chore(main): release 0.3.2 (#106)

    00ad895
  18. github-actions
    added a commit that references this issue on Sep 15, 2022

    chore(bazel): Update WORKSPACE files for rules_gapic, gax_java, gener…

    7678687
  19. github-actions
    added 3 commits that reference this issue on Oct 4, 2022

    chore(main): release 0.3.7 (#106)

    e10fa0c

    chore(main): release 0.3.6-SNAPSHOT (#106)

    f671a19

    chore(main): release 1.1.3 (#123)

    42a8413
  20. meltsufin
    added a commit that references this issue on Dec 22, 2025

    chore: release 1.101.0 (#106)

    a531870
  21. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore: release 0.118.0 (#106)

    2e8c3b6
  22. chingor13
    added a commit that references this issue on Jan 22, 2026

    chore: update common templates (#106)

    d431ed1
  23. chingor13
    added a commit that references this issue on Feb 24, 2026

    Merge pull request #106 from tcoffee-google/master

    4870755
  24. suztomo
    added a commit that references this issue on Mar 11, 2026

    chore: release 1.101.0 (googleapis#106)

    1911b9c
  25. chingor13
    added a commit that references this issue on Mar 12, 2026

    Merge pull request #106 from tcoffee-google/master

    39d4de1
  26. suztomo
    added a commit that references this issue on Mar 23, 2026

    chore(deps): update dependency com.google.cloud.samples:shared-config…

    5985608
  27. suztomo
    added a commit that references this issue on Mar 30, 2026

    chore: release 0.120.1 (#106)

    004c019
  28. lqiu96
    added a commit that references this issue on Apr 1, 2026

    chore: release 0.120.1 (#106)

    9f2b001
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @aozarov
    aozarov

Labels

🚨 criticalP0 critical issue. Requires immediate fixapi: storageIssues related to the Cloud Storage API.status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.triage meI really want to be triaged.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.