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

Validation Failure For PATCH #178

Open
Avinash-Kamath opened this issue Sep 26, 2024 · 2 comments
Open

Validation Failure For PATCH #178

Avinash-Kamath opened this issue Sep 26, 2024 · 2 comments

Comments

@Avinash-Kamath
Copy link

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"
    ]
}
@ivixvi
Copy link

ivixvi commented Dec 30, 2024

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.

@ivixvi
Copy link

ivixvi commented Dec 30, 2024

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 Rule

The 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.

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