SimpleIdServer icon indicating copy to clipboard operation
SimpleIdServer copied to clipboard

[SCIM] add names with PATCH has wrong hierarchy

Open danflomin opened this issue 2 years ago • 3 comments

Hello, how are you?

Steps to reproduce:

  1. POST a user with no name.* attributes.
  2. PATCH the user with the following body
{
  "Operations": [
    {
      "op": "add",
      "value": {
        "name.givenName": "Sabina",
        "name.familyName": "Priscilla",
        "name.formatted": "Cristopher",
        "name.middleName": "Fannie",
        "name.honorificPrefix": "Wilbert",
        "name.honorificSuffix": "Wilber"
      }
    }
  ],
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ]
}

Now, when you GET the user, you don't get a hierarchy of name, you just get the flattened attributes like this:

{
    "id": "afcb616a-42ac-4d8f-a1cd-74e5eff6e62e",
    "userName": "dschrute222",
    "honorificSuffix": "Wilber",
    "honorificPrefix": "Wilbert",
    "middleName": "Fannie",
    "givenName": "Sabina",
    "familyName": "Priscilla",
    "formatted": "Cristopher",
    "emails": [
        {
            "value": "[email protected]",
            "primary": true,
            "type": "work"
        }
    ],
    "groups": [],
    "externalId": "dschrute",
    "schemas": [
        "urn:ietf:params:scim:schemas:core:2.0:User"
    ]
}

I think this is an issue, right?

Kind regards Dan

danflomin avatar May 01 '23 08:05 danflomin

Hello,

Indeed there is an issue. The HTTP PATCH request shouldn't be processed by the SCIM endpoint, because the value property contains a list of path for example : 'name.givenName'. In fact, According to the RFC https://www.rfc-editor.org/rfc/rfc7644#section-3.5.2.1, the value MAY be a quoted value, or it may be a JSON object containing the sub-attributes of the complex attribute.

I'm going to fix this issue and ignore the path properties.

simpleidserver avatar May 02 '23 09:05 simpleidserver

The issue is fixed in the branch release/v3.0.4. Finally, It will be possible to pass path into the value property.

Request like this will be supported:

{
  "Operations": [
    {
      "op": "add",
      "value": {
        "name.givenName": "Sabina",
        "name.familyName": "Priscilla",
        "name.formatted": "Cristopher",
        "name.middleName": "Fannie",
        "name.honorificPrefix": "Wilbert",
        "name.honorificSuffix": "Wilber"
      }
    }
  ],
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ]
}

simpleidserver avatar May 02 '23 21:05 simpleidserver

Amazing ! Thank you

danflomin avatar May 03 '23 08:05 danflomin