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: option.WithScopes has no effect unless it's ScopeFullControl #1756

Closed
eliben opened this issue Jan 28, 2020 · 1 comment
Closed
Assignees
Labels
api: storage Issues related to the Cloud Storage API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@eliben
Copy link
Contributor

eliben commented Jan 28, 2020

Client

storage

Environment

any

Code

e.g.

client, err := storage.NewClient(ctx, option.WithScopes(storage.ScopeReadOnly))

Expected behavior

I expect this to set a read-only scope on client operations. For example, listing a bucket will not return ACLs.

Actual behavior

ACLs are returned.

Additional context

This code appends ScopeFullControl unconditionally, which may override whatever the user provided.

@eliben eliben added the triage me I really want to be triaged. label Jan 28, 2020
@tbpg tbpg added api: storage Issues related to the Cloud Storage API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. and removed triage me I really want to be triaged. labels Jan 29, 2020
@tritone
Copy link
Contributor

tritone commented Jan 29, 2020

Some additional context from research that I did:

Looking at the code here and here, it seems clear that 1. dial settings are applied in order left-to-right and 2. scopes that are applied later in the list will override those that came before. We think that users haven't noticed the issue because the default setting is FullControl which allows everything. Also, it's not clear whether this is a common override.

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 Cloud Storage API. priority: p1 Important issue which blocks shipping the next release. Will be fixed prior to next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants