-
-
Notifications
You must be signed in to change notification settings - Fork 225
Closed
Description
mode.conf
[request_definition]
r = sub, obj, act
[policy_definition]
p = sub, obj, act
[role_definition]
g = _, _
[policy_effect]
e = some(where (p.eft == allow))
[matchers]
m = g(r.sub, p.sub) && r.obj == p.obj && regexMatch(r.act, p.act)p, book_admin , /book/1, GET
p, pen_admin , /pen/1, GET
g, *, book_admin
g, *, pen_admin
patten matching func:
keyMatch
error: e.getImplicitRolesForUser("alice") will cause stackoverflow
What's happening
Step1: Since we have pattern matching function and alice match *, then when we createRole alice will add * in her role list. While calling e.getImplicitRolesForUser("alice").
The first loop, we will get alice's direct role list:
["*"]
Step2: Then we call e.getImplicitRolesForUser("*"), and in its first iteration we get the following role list:
["book_admin", "pen_admin"]
Step3: Then we call e.getImplicitRolesForUser("book_admin") and e.getImplicitRolesForUser("pen_admin"), it founds book_admin matches * then it returns also * and the next call will return to our step1.
Metadata
Metadata
Assignees
Labels
No labels