Improve behaviour with restricted application keys #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is now possible to create application keys with restrictions. These keys only have one access to one bucket, and to a subset of possible API calls.
Most importantly, these restricted keys cannot freely call
b2_list_buckets
, which renders them unusable with b2blaze. This PR makes a minimal change to make these keys work: when using such a restricted key, only try listing the one permitted bucket.This is an incomplete solution: a key could theoretically not have the ability to call
b2_list_buckets
even for its single permitted bucket, and b2blaze has little reason to require that they can. However, it solves the most common case where the keys are created via the web UI, which always grants access tob2_list_buckets
.I've tested this using the subset of the integration tests that don't involve creating/destroying buckets, but by the nature of the problem and the current testing setup, I can't really include these tests in the repo usefully.