Issue
Patch validation errors get swallowed up to ScimErrorInvalidValue here:
|
value, err := validator.Validate() |
|
if err != nil { |
|
return nil, &errors.ScimErrorInvalidValue |
Example
Hence, the ScimType for errors upon patch validation is not always respected, for example:
{ "schemas":
["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations":[
{
"op":"remove",
"path":"",
"value":"newusername"
}]
}
In this example, a remove path must be provided and as per the RFC and we should return a scimType of noTarget:
If "path" is unspecified, the operation fails with HTTP status code 400 and a "scimType" error code of "noTarget".
Although the code does actually do this validation here
|
if v.Path == nil { |
|
return nil, &errors.ScimError{ |
|
ScimType: errors.ScimTypeNoTarget, |
|
Status: http.StatusBadRequest, |
|
} |
|
} |
, it gets swallowed in
validatePatch.
The same issue is seen for other validations (e.g. sometimes a SyntaxError is swallowed).
Issue
Patch validation errors get swallowed up to
ScimErrorInvalidValuehere:scim/resource_type.go
Lines 158 to 160 in 172bf2a
Example
Hence, the
ScimTypefor errors upon patch validation is not always respected, for example:In this example, a
removepath must be provided and as per the RFC and we should return ascimTypeof noTarget:Although the code does actually do this validation here
scim/internal/patch/remove.go
Lines 15 to 20 in 172bf2a
validatePatch.The same issue is seen for other validations (e.g. sometimes a SyntaxError is swallowed).