-
Notifications
You must be signed in to change notification settings - Fork 9
Fix BYO custom access policy flow #97
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
Conversation
If custom policies are detected init will throw error reporting the same. Added policy prefix to easily detect policies created by aio-lib-files
lib/impl/AzureBlobFiles.js
Outdated
| const signedIdentifiers = aclObj.elements[0] | ||
| if (signedIdentifiers.elements) { | ||
| if (signedIdentifiers.elements.length > 1) { | ||
| this._hasCustomAccessPolicies = true // flag to mark presense of custom policies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we throw here already instead of keeping an extra field ?
|
also missing unit tests |
lib/impl/AzureBlobFiles.js
Outdated
| return false | ||
| } else { | ||
| // if its uuidv4 type of identifier then consider it as non custom, this is to support any already created policies by aio-lib-flies | ||
| const testUUIDv4 = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/gi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should only use that condition to avoid weird corner cases with old vs new ids
Meaning isCustom equals true only and only if it's not a uuidv4 and ditch the aio-lib-files prefix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it will be good if we add the prefix, that clearly helps to differentiate between any policy lib creates vs anything else. The current two conditions of prefix check and uuidv4 format should cover any cases relevant to our usecase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thought maybe since we are enforcing a single policy we won't really need a prefix to differenciate. Will remove the logic to add it.
Simplify custom policy check Add unit tests
Codecov Report
@@ Coverage Diff @@
## master #97 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 5 5
Lines 546 557 +11
Branches 95 98 +3
=========================================
+ Hits 546 557 +11
Continue to review full report at Codecov.
|
Fixes adobe/aio-tvm#46
Added check for presence of custom policies in case of BYO credentials.
If custom policies are detected init will throw error reporting the same.
Added policy prefix to easily detect policies created by aio-lib-files
TODO - add and fix existing unit tests
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: