Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Storage: When moving a file, allow keeping old ACL #21

Closed
lukesneeringer opened this issue Sep 21, 2017 · 4 comments
Closed

Storage: When moving a file, allow keeping old ACL #21

lukesneeringer opened this issue Sep 21, 2017 · 4 comments
Assignees
Labels
api: storage Issues related to the googleapis/nodejs-storage API. help wanted We'd love to have community involvement on this issue. 🚨 This issue needs some love. triage me I really want to be triaged.

Comments

@lukesneeringer
Copy link
Contributor

From @SimenB on May 3, 2017 13:59

Environment details

  • OS: macOS
  • Node.js version: 6.10.2
  • npm version: yarn 0.23.3
  • google-cloud-node version: @google-cloud/storage@1.1.0

Steps to reproduce

  1. require @google-cloud/storage
  2. Instantiate it, and get a bucket
  3. call const file = await bucket.upload(filePath, { public: true })
  4. Verify file is publicly available from https://storage.googleapis.com/
  5. call file.move(somewhere)
  6. Try to access file from https://storage.googleapis.com/, get 403

What I want is either:

Copied from original issue: googleapis/google-cloud-node#2274

@lukesneeringer
Copy link
Contributor Author

From @SimenB on May 3, 2017 14:8

I suppose a workaround is to change the ACL after moving the file. The code doing the rename lives in a project which tries to just pass through options to the storage api though. So passing some custom predefined ACL (which defeats the purpose of the nice public: true option) is something I'd really like to avoid. It also adds the extra ACL step to that lib.

The thing we do to avoid it is setting the default ACL of the entire bucket public. Which is fine (in our case), but not ideal.

@lukesneeringer
Copy link
Contributor Author

From @stephenplusplus on May 3, 2017 14:8

Adding the keepAcl option sounds good to me. For a quick fix, something like this should work:

file.interceptors.push({
  request: function(reqOpts) {
    if (reqOpts.uri.includes('rewriteTo')) {
      reqOpts.qs.destinationPredefinedAcl = '{{predefined acl value}}'
    }
    return reqOpts
  }
})

The incoming reqOpts that you'd be modifying are defined here in the this.request() call.

@stephenplusplus stephenplusplus added priority: p2 Moderately-important priority. Fix may not be included in next release. and removed priority: p2 Moderately-important priority. Fix may not be included in next release. labels Feb 20, 2018
@stephenplusplus
Copy link
Contributor

Could anyone suggest how we should implement this? After the file is copied, do we call https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/list and then make as many calls as necessary to https://cloud.google.com/storage/docs/json_api/v1/objectAccessControls/insert on the new file?

Or is there a way to determine the correct value for destinationPredefinedAcl on the new file?

@stephenplusplus stephenplusplus added the help wanted We'd love to have community involvement on this issue. label Mar 28, 2018
@frankyn
Copy link
Member

frankyn commented Jun 27, 2018

This came up in Python GCS client library and after speaking with a GCS team member. I decided to close the feature request for the following two reasons: (ref)

  • Operation isn't supported by the API and follow-up operations to reset ACL may fail in between leaving the object in a bad state. No guarantees.
  • It's recommended that developers should use bucket-level IAM policies over ACL to prevent inadvertent data exposures. Bad states may cause inadvertent exposures.

@ghost ghost removed the type: enhancement label Jun 27, 2018
@google-cloud-label-sync google-cloud-label-sync bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Jan 31, 2020
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. help wanted We'd love to have community involvement on this issue. 🚨 This issue needs some love. triage me I really want to be triaged.
Projects
None yet
Development

No branches or pull requests

4 participants