hsluoyz commented on PR #1770:
URL: https://github.com/apache/casbin/pull/1770#issuecomment-6577672467

   Thanks for the report and the clear write-up, the bug is real. It's fixed in 
https://github.com/apache/casbin/commit/6a018f2 with a slightly different 
approach, so I'm closing this PR.
   
   The difference is how a backslash inside a quoted string is treated. In 
matchers it is not an escape character: `EscapeStringLiterals` doubles every 
backslash so that matchers behave like CSV policies, which means `"a\"` is the 
string `a\` and `\"` can never keep a literal open. This PR (and the existing 
`EscapeAssertion`) treated `\"` as an escaped quote, so `r.act == "a\"#w"` went 
from a truncated but valid matcher to `Invalid token: '#'`. The commit uses one 
rule everywhere, a literal ends at the next matching quote, which also lets the 
scanner shrink to a single `IndexByte` and drops the special case for 
unterminated literals (the expression parser already reports those).


-- 
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]

Reply via email to