#8415 Ignore case when evaluating attributes and objectclasses in config plugin
Closed: fixed by rcritten. Opened by rcritten.

Issue

When setting the user or group objectclasses a verification is done to ensure that the possible attributes are all allowed by the available set of objectclasses. This comparison is done in a case-sensitive way and it shouldn't need to be.

Steps to Reproduce

  1. This repo at this commit https://github.com/Brandeis-CS-Systems/idm-unet-id-plugin/commit/0219efd70da1b30bb18a67038f3f969bb3fd29f7
  2. unetuser_attributes = ["unetID"]
  3. ipa config-mod --userobjectclasses={top,person,organizationalperson,inetorgperson,inetuser,posixaccount,krbprincipalaux,krbticketpolicyaux,ipaobject,ipasshuser,unetuser}

Actual behavior

error: invalid 'ipauserobjectclasses': user default attribute unetID would not be allowed!

Expected behavior

case shouldn't matter

Making unetuser_attributes lower-case will fix it showing that it is a case-sensitivity issue

This patch allows this particular situation to pass, there could be others:

--- ipaserver/plugins/config.py 2020-06-23 16:42:11.940562212 -0400
+++ /usr/lib/python3.7/site-packages/ipaserver/plugins/config.py        2020-07-15 15:03:43.218477394 -0400
@@ -535,7 +535,7 @@
                       self.api.Object[obj].params[obj_attr].flags:
                         # skip virtual attributes
                         continue
-                    if obj_attr not in new_allowed_attrs:
+                    if obj_attr.lower() not in new_allowed_attrs:
                         raise errors.ValidationError(name=attr,
                                 error=_('%(obj)s default attribute %(attr)s would not be allowed!') \
                                 % dict(obj=obj, attr=obj_attr))

Metadata Update from @rcritten:
- Issue assigned to rcritten

https://github.com/freeipa/freeipa/pull/5935

master:

  • 4932a9c98264d177b5811caa618c04e7490b249b Don't assume that plugin attributes and objectclasses are lowercase
  • 7b77fef75a5010aa9ae37be6a1355885fb73692c ipatests: add suite for testing custom plugins
  • e3304ff3aab20001ec8c0dafcdd57ac5053b102f pr-ci definitions: add custom plugin-related jobs

ipa-4-9:

  • 97a2a925348d3bd732e582108feb02d644ba011a Don't assume that plugin attributes and objectclasses are lowercase
  • e28e45402c7edb007e356a59cf09ed8e10cd14d9 ipatests: add suite for testing custom plugins
  • 78c48199782743e619463cefa7411817f4fe4a14 pr-ci definitions: add custom plugin-related jobs

Metadata Update from @rcritten:
- Issue close_status updated to: fixed
- Issue status updated to: Closed (was: Open)

Metadata