Skip to content
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

Latest release 5.34.0 The matcher no longer short-circuit evaluation if it comes across a truthy expression #493

Open
tomfriedhof opened this issue Nov 15, 2024 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@tomfriedhof
Copy link

If you have a matcher that has multiple conditions such as the one below:

m = (r.user == p.user && r.path == p.resource && r.action == p.action) || \
    (r.input.service == p.svc && r.input.region == p.region && r.action == p.method)

The new evaluator will still attempt to evaluate the second expression even if the first express was truthy. This is an issue because in same cause a prop in the input object is not passed to enforce sometimes.

In version 5.32.0 and earlier the matcher will short-circuit once it finds a match.

@hsluoyz
Copy link
Member

hsluoyz commented Nov 15, 2024

@tomfriedhof this is because we switched the evaluator from the official expression-eval v5.0.0 to our own fork @casbin/expression-eval v5.2.0 (which is yet the same code as the official package v5.0.1, we only changed the CI code in next versions) in the PR: #489 .

So I suspect the changes happen between v5.0.0 and v5.0.1 in the official package.

@tomfriedhof can you test it by switching to v5.0.1 to see if it is also wrong?

@hsluoyz hsluoyz self-assigned this Nov 15, 2024
@hsluoyz hsluoyz added the question Further information is requested label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants