Closed otchilin closed 2 days ago
@otchilin why? we just forked the original expression-eval lib and @casbin/expression-eval 5.2.0 should have the same codebase with the original lib. Why are their behaviors different? You can check the commits
@otchilin Could you please provide more information? Specifically, it would be helpful if you could share your test code or indicate the exact step in your debugging process where you utilized @casbin/expression-eval. Thank you!
In fact, there is a difference in the new expression-eval libs for the CallExpression implementation. In the previous version the regexMatchFunc was called without waiting for evaluateArrayAsync promise and thus it never raised an error on my '*' wildcard usage.
I was using some policies like this one: await this._enforcer.addPolicy('superadmin', '*', '*');
with a matcher declaration like this
m = (r.sub == p.sub) && (r.obj == p.obj || p.obj == '*' ) && (p.act == '*' || regexMatch(r.act, p.act))
It was working, but it was a side effect of previous expression-eval version :/ I'll rework my policies to be compliant with matcher. In conclusion this was not a bug but rather a fix that raised an issue on my side ;)
Thanks for your quick reply. Regards.
Closed as resolved
Hello,
With the new 5.34.0 release which replaced the expression-eval lib by @casbin/expression-eval 5.2.0,
my regexMatch(r.act, p.act) doesn't work anymore.
It produces this kind of exception : isAccessGranted: Exception occurred, error= SyntaxError: Invalid regular expression: /*/: Nothing to repeat
If we debug it, we can notice that the key2 parameter of regexMatch function doesn't contain the good value during call and thus produce this error.
Hope it will help... Regards