Skip to content

error parsing regexp: missing argument to repetition operator: * #330

Description

@goapifirst

Just started using this.. and man this library is amazing in what it provides.

I have followed the example on setting up a REST auth. I have auth.conf and auth.csv. They load, and from the example csv whenever I access a path that has the * in it in the .csv, I get the panic and the error message in the subject.

I am using the REST conf as linked to from here: https://casbin.org/docs/en/supported-models

My csv looks like:

p, admin, /*, *
p, anonymous, /login, *
p, p, /logout, *
p, p, /p/*, *
p, n, /logout, *
p, n, /n, *

I am using Chi, and have followed the example of the chi-authz from here: https://github.com/casbin/chi-authz

When I change the path to /p (removing the /* after it), for example, and try to access via Postman /p, /p/, /p/test, etc.. I either get Forbidden or see a panic output with the error message.

I have verified in my code that the role, path and method types passed to the Enforcer match what is found in the csv.

I am not clear what the first p is on each line though.

Is the regex call in the auth.conf file (e.g. this: [matchers]
m = r.sub == p.sub && keyMatch(r.obj, p.obj) && regexMatch(r.act, p.act) ) wrong??

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions