scim2 icon indicating copy to clipboard operation
scim2 copied to clipboard

ReplaceOperation with an empty-array value is rejected unnecessarily

Open dtreskunov opened this issue 6 years ago • 1 comments

Problem behavior The library rejects payloads that are valid according to RFC 7644, Sec. 3.5.2.3. Replace Operation. Specifically, it rejects Operations whose value is the empty array []:

      if(value == null || value.isNull() ||
           ((value.isArray() || value.isObject()) && value.size() == 0))
       {
         throw BadRequestException.invalidSyntax(
             "value field must not be null or an empty container");
       }

PatchOperation.java#L305

Why this is important Okta sends the following payload which fails to be deserialized:

{
    "schemas": [
        "urn:ietf:params:scim:api:messages:2.0:PatchOp"
    ],
    "Operations": [
        {
            "op": "replace",
            "path": "members",
            "value": []
        }
    ]
}

Historical context The code doing this validation was merged in #26.

Suggested resolution Change the check in PatchOperation.java to:

      if(value == null || value.isNull() ||
           (value.isObject() && value.size() == 0))
       {
         throw BadRequestException.invalidSyntax(
             "value field must not be null or an empty object");
       }

dtreskunov avatar Oct 26 '18 23:10 dtreskunov

Any chances of this being done anytime in the future?

pnowicki-egnyte avatar Jul 29 '19 08:07 pnowicki-egnyte