lenamonj opened a new pull request, #1753: URL: https://github.com/apache/casbin/pull/1753
Fixes #1752. `SetEquals`, `SetEqualsInt` and `Set2DEquals` sorted their arguments in place. Because `GetPermissionsForUser` returns the model's live policy rows, using `Set2DEquals` on its result reordered each stored rule's fields (`p, zoe, data1, read` became `data1, read, zoe`) and flipped subsequent `Enforce` calls from allow to deny. Full reproduction and output are in the issue. This change sorts copies instead: the outer slices in all three helpers, and in `Set2DEquals` the inner rows as well, since reordering a row's fields is the mutation that corrupts a policy rule. Comparison semantics are unchanged. `TestSetComparisonsDoNotModifyArguments` covers all three helpers and fails on master before this change. `go test -count=1 ./...` is green with it applied. -- 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]
