Skip to content

escape of '.' or just using '.' in regexMatch fails #71

Description

@SimonX200
[request_definition]
r = sub, obj, role, act

[policy_definition]
p = sub, obj, act

[policy_effect]
e = some(where (p.eft == allow))

[matchers]
m = permitted(r.sub, r.obj, r.role, r.act) && (created(r.sub, r.obj) || owned(r.sub, r.obj) || (isGlobal(r.obj) && regexMatch(r.act, '.*get$') && !regexMatch(r.act, '.user.')))

regexMatch(r.act, '.user.') translate to .user_ which is passed to:

function regexMatch(key1, key2) {
    return new RegExp(key2).test(key1);
}

as key2

Trying to use one of:

regexMatch(r.act, '\.user') 
regexMatch(r.act, '\\.user') 
regexMatch(r.act, '\\\.user') 
regexMatch(r.act, '\\\\.user') 

Leads to an TypeError.

const expString = this.model.model.get('m').get('m').value
TypeError: Cannot read property 'get' of undefined
    at Enforcer.<anonymous> (node_modules\casbin\lib\coreEnforcer.js:254:56)
    at Generator.next (<anonymous>)
    at node_modules\casbin\lib\coreEnforcer.js:20:71
    at new Promise (<anonymous>)
    at __awaiter (node_modules\casbin\lib\coreEnforcer.js:16:12)
    at Enforcer.enforce (s:\workspace\vsts\boge-connect\server\node_modules\casbin\lib\coreEnforcer.js:239:16)

Any suggestions?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions