Jbansal2 opened a new pull request, #1739:
URL: https://github.com/apache/casbin/pull/1739

   This fixes an issue where policies with commas in quoted fields (e.g., ABAC 
conditions) were not being deleted correctly in batch operations.
   
   Root Cause:
   - Policy hash keys were generated using comma as separator via 
strings.Join(rule, ',')
   - This created hash collisions when policy fields contained commas
   - Example: ['alice', 'data,file', 'read'] and ['alice', 'data', 'file', 
'read'] produced the same hash key 'alice,data,file,read'
   
   Solution:
   - Introduced policyKey() helper function that uses ASCII Unit Separator 
(\x1f)
   - This character is designed for field separation and won't appear in policy 
data
   - Updated all policy operations to use policyKey() instead of strings.Join()
   
   Changes:
   - model/policy.go: Added policyKey() and replaced all hash key generation
   - Added comprehensive tests demonstrating the fix
   - All existing tests pass (216 tests)
   
   Fixes #1733


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