Restrict eval() to standard Casbin expressions for cross-platform compatibility#468
Open
Restrict eval() to standard Casbin expressions for cross-platform compatibility#468
Conversation
|
|
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
…alidation Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
…n level Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix issues with inconsistent eval() function in jcasbin
Restrict eval() to standard Casbin expressions for cross-platform compatibility
Dec 19, 2025
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #468 +/- ##
==========================================
+ Coverage 67.31% 67.39% +0.08%
==========================================
Files 60 61 +1
Lines 3004 3024 +20
Branches 559 562 +3
==========================================
+ Hits 2022 2038 +16
- Misses 802 806 +4
Partials 180 180 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
d4aa61e to
53d9a5f
Compare
0c8d4c7 to
6504a9e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The eval() function was directly executing aviatorscript, allowing platform-specific syntax (
seq.list(),string.startsWith(),math.abs()) that breaks portability across Casbin implementations and exposes operations beyond specification.Changes
Core Validation
ExpressionEvaluatorwith regex-based validation blocking aviatorscript-specific featuresSEQ.list,String.StartsWith)EvalFunc.call()with sanitized error loggingAllowed Operations
r.sub.age,r.obj.owner==,&&,||,>,<,+,-,*,/keyMatch(),regexMatch(), custom functionsBlocked Operations
seq.*,string.*,math.*fn,lambda,let,for,whilenew,importMigration Example
Testing
EvalCrossPlatformTestvalidates exact issue scenariosDocumentation
Added
docs/ExpressionEvaluator.mdcovering allowed syntax, security improvements, and migration patterns.Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.