-
Notifications
You must be signed in to change notification settings - Fork 18
Description
So I've been using accesscontrol to do filtering of objects based on roles and what attributes they have access to and I came across an issue that seems to track down to the normalize function of notation.
Given I have the following:
// allow access to all except password and password_reset_code
const globs = [
'*',
'!password',
'!password_reset_code'
];
// normalize them (called as part of filter but the issue remains in normalize)
const normalizedGlobs = normalize(globs);
// prints out ['*', '!password']
console.log(normalizedGlobs);It seems normalize is stripping out all negated globs that start with another negated attirbute.
It seems to be caused by https://github.com/onury/notation/blob/master/src/core/notation.glob.js#L383 as it does a regex check, in my case, like below:
/^password/.test('password_reset_code')So any globs with the same beginning as a previous glob will be 'normalized' out.
Is this intended?
I've tried changing the ordering of the globs in the array and nothing seems to help short of changing the way I structure my data to ensure there is no repeated names.