Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PATCH incorrectly replaces entire complex object #725

Closed
jasonfagerberg-toast opened this issue Jan 17, 2025 · 2 comments
Closed

PATCH incorrectly replaces entire complex object #725

jasonfagerberg-toast opened this issue Jan 17, 2025 · 2 comments

Comments

@jasonfagerberg-toast
Copy link
Contributor

jasonfagerberg-toast commented Jan 17, 2025

The DefaultPatchHandler incorrectly replaces omitted fields with null for complex objects such as name.

For the given request

{
  "schemas": [
    "urn:ietf:params:scim:api:messages:2.0:PatchOp"
  ],
  "Operations": [
    {
      "op": "replace",
      "path": "name",
      "value": {
          "givenName": "New Given Name"
      }
    }
  ]
}

the expected output should be

{
    "givenName": "New Given Name",
    "familyName": "Existing Family Name"
}

However, DefaultPatchHandler replaces familyName with null

{
    "givenName": "New Given Name",
    "familyName": null
}

I believe this is because DefaultPatchHandler.applySingleValue is replacing User.name with the entirety of the request instead of merging the existing with the request

Image

According to the SCIM RFC

o If the target location specifies a complex attribute, a set of
sub-attributes SHALL be specified in the "value" parameter, which
replaces any existing values or adds where an attribute did not
previously exist. Sub-attributes that are not specified in the
"value" parameter are left unchanged.

@jasonfagerberg-toast
Copy link
Contributor Author

Took a stab at fixing this #726

@bdemers
Copy link
Member

bdemers commented Jan 31, 2025

Fixed in: #726

@bdemers bdemers closed this as completed Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants