Repository navigation
Fix acl.resolvePermission not working with wildcard request - #3293
Conversation
|
Can one of the admins verify this patch? |
3 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Thanks @alFReD-NSH for your pull request. I'll further comment asap, but after some investigations to understand the method you're willing to change was implemented this way, i can at least say that this looks as a breaking change to me, more than a bug. As i commented in the original issue you should not implement the access-control in lb this way. |
I am afraid this is beyond my current understanding of our ACL system. @raymondfeng @ritch you are the authors of the original design for prioritisation of ACL entries, what's you opinion on this proposal? |
|
@slnode ok to test |
|
Given that comment The implementation matches the intention and there's no missing break. Question remains: why this behavior? and what was the intention with wildcards in access requests? (@ritch, @raymondfeng) I cannot find any instance in the code base where an access request does not represent exactly one specific request: targeting one model, one method, one accessType. I cannot find either any excerpts of former docs where the checkPermission was used directly by developers: shouldn't it be a private method instead as the standard behavior would be to use the built-in access control system? |
|
In this particular case: The 2nd rule is stronger than the 1st one as it's more specific about the principal. The score is calculated by (model, property, accessType, principal, permission). The current code seems to assume that all wildcard rules have the same score. As a result, it continues to search for stronger permission. If two rules cannot produce the same score, adding |
|
thx @raymondfeng for your time. 🖐 AFAIK AccessRequests created by LB's access control system have no wildcards ATM if My main point is actually to argue that it has currently no meaning to call If a fix was to be worked out, i wanted to understand what was your idea with the following piece of code: if (!req.isWildcard()) {
// ...
} else {
// ...
// For wildcard match, find the strongest permission
var candidateOrder = AccessContext.permissionOrder[candidate.permission];
var permissionOrder = AccessContext.permissionOrder[permission];
if (candidateOrder > permissionOrder) {
permission = candidate.permission;
}
}which is equivalent to write: if (accessRequest.isWildcard()) {
// pick the strongest permissions, according to the following ranking:
/*
AccessContext.permissionOrder = {
DEFAULT: 0,
ALLOW: 1,
ALARM: 2,
AUDIT: 3,
DENY: 4,
};
*/
}👉 Other way round: the methods from ACL model should be used only internally. |
|
I appreciate the comments guys. @raymondfeng basically said in other words why I think this is bug and should be fixed. @ebarault Basically I use checkPermission to see if user has access to a certain screen and if it could match wildcard requests, it would make coding it simpler. Since there is |
|
@alFReD-NSH : by screens do you mean MVC views served by the template engine? |
|
@ebarault Technically the check is for the navigation menu. If the user doesn't have access to an item in it, it shouldn't be there. |
|
I see. I'm not confident with the current behavior which consist in dealing with any wildcard in an AccessRequest the same way (see |
|
@ebarault Same thing happens. |
|
Ping, what's the status of this pull request? How to move it forward? |
|
@bajtos, @alFReD-NSH : i validate an improvement can be made here, and the overall idea in this PR makes sense to me now (especially now that the issue is confirmed in I'd just would like to take some time to review the whole authorization sequence once more to understand the potential impact of treating any wildcard access request the same way. |
|
Any news on this one? |
|
IMO the rationale described in this PR is valid. The implementation remains to be reviewed. |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
2 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
Hello, I have re-read the discussion above and as I understand it, the changes are going in the right direction and there are no known problems. In that light, I am proposing to move forward and land this pull request as it is now. Any objections? @alFReD-NSH would you mind rebasing the patch on top of the latest master? |
When acl.resolvePermission was called with a request containing a wildcard, it would return the matching acl with lowest score instead of higher. Fixes #2153
|
Can one of the admins verify this patch? |
2 similar comments
|
Can one of the admins verify this patch? |
|
Can one of the admins verify this patch? |
|
I have rebased this against the latest master. |
|
I checked few of the downstream builds, they are failing because |
|
Landed, thank you @alFReD-NSH for your contribution! |
Description
When acl.resolvePermission was called with a request containing a wildcard, it would return the matching acl with lowest score instead of higher.
Related issues
Checklist
guide