Uploaded image for project: 'OpenDJ'
  1. OpenDJ
  2. OPENDJ-7928

JSON normalization cannot handle nested arrays

    XMLWordPrintable

    Details

      Description

      A customer is using the idmRepo profile. One user in his DIT looks like this:

      dn: uid=some-uuid-not-important,ou=user,ou=managed,dc=openidm,dc=forgerock,dc=com
      objectClass: uidObject
      objectClass: fr-idm-managed-user
      objectClass: top
      fr-idm-managed-user-authzroles-internal-role: { "donot": "care" }
      fr-idm-managed-user-manager:  { "donot": "care" }
      fr-idm-managed-user-meta:  { "donot": "care" }
      fr-idm-managed-user-notifications:  { "donot": "care" }
      fr-idm-managed-user-json: {  "userName": "bug",
        "lastSync": {
          "managedUser_SomethingAccount": {
            "effectiveAssignments": [
              {
                "attributes": [
                  {
                    "assignmentOperation": "mergeWithTarget"
                  }
                ],
                "hello": "world"
              }
            ],
            "timestamp": "2021-04-09T18:21:10.477439"
          }
        }
      }
      

      I used ldapmodify and fr-idm-managed-user-json:< file:///tmp/value.json to get the interesting value into the entry. I'm showing it expanded in the above example for illustration purposes.

      The following search fails:

      bin/ldapsearch -h localhost -p 636 -X -Z -D uid=admin -w password -b dc=openidm,dc=forgerock,dc=com -s sub --sortOrder +fr-idm-managed-user-json:extensibleJsonOrderingMatch:false:true:/personalTitle "(&(objectClass=uidObject)(objectClass=fr-idm-managed-user)(objectClass=top))" 1.1
      # Server-side sort failed:  Other
      # The LDAP search request failed: 80 (Other)
      # Additional Information:  Unable to examine the entry with ID 37911 for sorting purposes: IllegalStateException(Utils.java:333 Utils.java:355 Utils.java:312 Utils.java:355 Utils.java:312 Utils.java:301 Utils.java:275 JsonOrderingMatchingRuleImpl.java:40 MatchingRule.java:517 VLVIndex.java:705 VLVIndex.java:690 VLVIndex.java:682 EntryContainer.java:2611 EntryContainer.java:833 EntryContainer.java:722 JEStorage.java:1095 TracedStorage.java:414 EntryContainer.java:722 BackendImpl.java:485 SearchOperation.java:840 SearchOperation.java:795 SearchOperation.java:734 TraditionalWorkQueue.java:347)
      

      Stepping through Schema/Utils.java I can see the selectAndNormalizeValue0 method moving directly from currentKey=/lastSync/managedUser_SomethingAccount/effectiveAssignments to currentKey=/lastSync/managedUser_SomethingAccount/effectiveAssignments/hello, and (it looks like) this is due to the method trying to skip complete arrays and getting confused by an array with a subarray.

        Attachments

          Issue Links

            Activity

              People

              ondrej.fuchsik Ondrej Fuchsik
              cjr Chris Ridd
              Chris Ridd Chris Ridd
              Ondrej Fuchsik Ondrej Fuchsik
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: