Skip to content

[Bug]Node.js and Python Casbin Do Not Behave The Same with Glob Matching ** #403

@minoic

Description

@minoic

Want to prioritize this issue? Try:

issuehunt-to-marktext


Describe the bug

Same problem with casbin/casbin#1422 , Python Casbin does not support ** glob match.

To Reproduce
Steps to reproduce the behavior:

  1. Go to casbin online editor https://casbin.org/editor/
  2. Paste codes below:

Model

[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) && globMatch(r.obj, p.obj) && globMatch(r.act, p.act)

Policy

p, alice, /**, *

Request

alice, /alice_data/hello, GET

Expected behavior

true Reason: ["alice","/**","*"]

true expected in enforcement result, as Node-Casbin does

switch to PyCasbin:

false

Meanwhile, rust casbin, c# casbin raises an exception.

// 🟢 dotnet Engine Result

// ========================

// ⚪️ node Engine Result
true Reason: ["alice","/**","*"]
// ----------------------------------------

// ⚪️ java Engine Result
true Reason: ["alice","/**","*"]
// ----------------------------------------

// ⚪️ go Engine Result
true Reason: ["alice","/**","*"]
// ----------------------------------------

// ⚪️ rust Engine Result

// ----------------------------------------

// ⚪️ python Engine Result
false
// ----------------------------------------

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Edge
  • Version 140.0.3485.81

Additional context

Versions in online editor

Node-Casbin (NodeJs)5.37.0
jCasbin (ava) v1.79.0|(CLl v1.17.0)
Casbin (Go) v2.116.0|(CLl v1.12.0)
Casbin-rs (Rust) v2.10.1|(CLl v1.3.0)
PyCasbin (Python) v1.17.0 |(CLl v1.0.0)
Casbin.NET (C#) v1.4.0.0|(CLI v1.0.0)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions