tlyyxjz commented on issue #162: URL: https://github.com/apache/casbin-editor/issues/162#issuecomment-5537162094
Hi @hsluoyz, this is exactly the problem space I've been working on with [casbin-config-doctor](https://github.com/tlyyxjz/casbin-config-doctor) — an offline diagnostics tool for Casbin configs. I ran its `validate-model` command on the exact broken model from this issue's description: ```ini [matchers] m = r.sub == p.sub22222 && r.obj11111 == ppppppp && r..act == p.act,,,,,,,,,, ``` Real CLI output (v0.1, no casbin runtime needed): ``` 5 issue(s): 5 error(s), 0 warning(s) [ERROR] matcher 'm' uses p.sub22222 but policy_definition does not define it [ERROR] matcher 'm' uses r.obj11111 but request_definition does not define it [ERROR] matcher 'm' has a malformed member access near 'r..act == p.' (expected r.xxx or p.xxx) [ERROR] matcher 'm' has a comma outside a function call (commas are only valid inside g(...)/keyMatch(...) style calls) [ERROR] matcher 'm' uses unrecognized identifier 'ppppppp' (not defined in request/policy definitions, not a built-in function) ``` So each of the four garbage tokens in your example is caught, plus the trailing commas. It also handles ABAC nested access (`r.obj.Owner`) without false positives, and warns (not errors) on unknown function calls since they may be legitimately registered via `AddFunction`. There's also an [online demo](https://tlyyxjz.github.io/casbin-doctor-demo/) where you can paste a model/policy and get the same diagnostics with near-miss explanations for denied requests. **Question:** for the editor's error panel, would you prefer this implemented as a JS/TS port inside the editor frontend, or as a backend check (like the Go enforcer approach you mentioned in casbin-dashboard#61)? I'm asking because I'd like to align Doctor's rule set with what you'd actually accept upstream — happy to contribute the port or just keep the rule list as a reference. Any feedback on which diagnostics matter most for the editor UX would be really valuable for me. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
