Validation Failure For PATCH
Patch request validation fails for below request body even though its a valid request
{
"Operations": [
{
"op": "add",
"value": {
"urn:ietf:params:scim:schemas:extension:enterprise:2.0:User": {
"employeeNumber": "123",
"costCenter" :"AU"
}
}
}
],
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
]
}
I was curious, so I investigated on my end as well.
Check this behavior by adding the following test case to TestOperationValidator_ValidateUpdate in internal/patch/update_test.go:
{valid: map[string]interface{}{"op": "add", "value": map[string]interface{}{"test:PatchExtension": []interface{}{map[string]interface{}{"attr1": "value"}}}}},
This error seems to be caused by github.com/scim2/filter-parser/v2 .
The URIPrefix is resolved to urn:ietf:params:scim:schemas:extension:enterprise:2.0, but :Users is dropped.
Since the process designed for resolve filters is used, the resolution position of : seems to be misaligned.
~I was able to confirm the RFC specification regarding this.~ As outlined in the Filtering section, a path consisting only of the specified URI does not seem to be a valid path.
The "path" attribute is described by the following ABNF syntax rule:
PATH = attrPath / valuePath [subAttr] Figure 7: SCIM PATCH PATH RuleThe ABNF rules "attrPath", "valuePath", and "subAttr" are defined in Section 3.4.2.2. The "valuePath" rule allows specific values of a complex multi-valued attribute to be selected.
https://datatracker.ietf.org/doc/html/rfc7644#section-3.5.2
P.S.
It seems I forgot about the original request during my investigation. This request does not specify a path, so it's unclear whether it falls under the restrictions for path.