errbot icon indicating copy to clipboard operation
errbot copied to clipboard

ACL check fails for HipChat chat rooms

Open nulfox opened this issue 10 years ago • 4 comments

With new version, seeing ACL checks failing for MUC rooms. Seems to be due to aclattr being added to xmpp backend and being used in get_acl_usr method. XMPPIdentifier.person that is used for aclattr doesn't match the "msg.frm.person" object used later. Not exactly sure how to fix this without potentially breaking things. Can take a look at it again in more depth if no one gets to issue.

aclattr is getting set in backend/xmpp.py: class XMPPPerson(XMPPIdentifier, Person): aclattr = XMPPIdentifier.person

And used in core_plugins/acls.py: def get_acl_usr(msg): if hasattr(msg.frm, u'aclattr'): # if the identity requires a special field to be used for acl return msg.frm.aclattr return msg.frm.person # default

016-05-26 05:52:12,846 DEBUG errbot.errBot *** frm = [email protected]/Test User 2016-05-26 05:52:12,846 DEBUG errbot.errBot *** username = [email protected]/Test User 2016-05-26 05:52:12,846 DEBUG errbot.errBot *** text = !test command host 2016-05-26 05:52:12,846 DEBUG errbot.plugins.ACLS Check test_command for ACLs. 2016-05-26 05:52:12,846 DEBUG errbot.plugins.ACLS ACL frm: [email protected]/Roman Forkosh 2016-05-26 05:52:12,849 INFO errbot.plugins.ACLS Matching ACL {'allowusers': ('[email protected]/Test User')} against username [email protected] for command test_client:test_command

nulfox avatar May 26 '16 06:05 nulfox

I've run into the same issue myself. Have you found a good workaround yet?

poiriermike avatar Jul 12 '16 21:07 poiriermike

Did someone find a workaround for the issue? The issue is open for almost a year now.

Jochen2584 avatar May 08 '17 08:05 Jochen2584

Wondering about this as well. How does one extract a room occupant's real JID?

pirxthepilot avatar Jun 09 '17 21:06 pirxthepilot

I believe the proper fix is to create a HipChatPerson instead of relying on XMPPIdentifier for HipChat, this way, the proper approach can be used without impacting XMPP module. The issue appears to be that XMPPPerson sets aclattr to XMPPIdentifier.person, which does'nt return a JID, so when ACL comparison is made, it's comparing JID == .person.

Quick fix is to remove the aclattrb = XMPPIdentity.person definition in the class. But not sure what impact it will have on XMPP module. Hack for me (using hipchat only) was to just remove the check in acls.py for aclattrib, so it always defaults to JID.

nulfox avatar Jun 21 '17 14:06 nulfox