Edgewall Software

Opened 12 years ago

Last modified 12 years ago

#10683 closed defect

AuthzPolicy does not handle non-ASCII encoded usernames — at Initial Version

Reported by: pushkinsv@… Owned by:
Priority: normal Milestone: 1.0
Component: general Version: 1.0dev
Severity: normal Keywords: authzpolicy username encoding unicode
Cc: ryano@… Branch:
Release Notes:
API Changes:
Internal Changes:

Description

Permissions defined in authzpolicy.conf are ignored if username contains non-ASCII characters.

TracFineGrainedPermissions says that in this case authzpolicy.conf should be in UTF8 encoding, but actually there is no encoding specification on ConfigObj invokation thus leading to mismatch when comparing usernames with following warning:

/usr/lib/python2.7/dist-packages/tracopt/perm/authz_policy.py:240: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
  if who in valid_users or \

to fix this issue I suggest following change to be made on trunk/tracopt/perm/authz_policy.py

--- authz_policy.py.orig        2012-05-03 10:55:36.000000000 +0800
+++ authz_policy.py     2012-05-03 10:56:30.000000000 +0800
@@ -174,7 +174,7 @@
     def parse_authz(self):
         self.log.debug('Parsing authz security policy %s',
                        self.get_authz_file())
-        self.authz = ConfigObj(self.get_authz_file())
+        self.authz = ConfigObj(self.get_authz_file(),encoding='utf8')
         groups = {}
         for group, users in self.authz.get('groups', {}).iteritems():
             if isinstance(users, basestring):

Change History (1)

by pushkinsv@…, 12 years ago

Attachment: authz_policy.py.diff added

diff file which fixes #10683

Note: See TracTickets for help on using tickets.