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

Attribute names are case sensitive #7

Closed
winstonbond opened this issue Jun 28, 2022 · 1 comment · Fixed by #14
Closed

Attribute names are case sensitive #7

winstonbond opened this issue Jun 28, 2022 · 1 comment · Fixed by #14
Labels
bug Something isn't working
Milestone

Comments

@winstonbond
Copy link

Nice library. Thanks. I've been using it to build a simple SCIM demo app.

One problem: the filter matching works using a simple JS attribute lookup & compare (eg. return value[attr] === expected;), which means the attribute names are case sensitive. SCIM attribute names are meant to be case insensitive (RFC 7643, section 2.1 ... "Attribute names are case insensitive").

Unfortunately, the system I'm connecting to uses lower case names. It searches for 'username eq reddog123' and nothing comes back from the SCIMMY match function, because the attribute is called userName not username.

I guess the schema check would also fail if the ingress function got a JSON with unexpected cases for the attribute names.

@sleelin sleelin added this to the 1.0.0 milestone Jun 29, 2022
@sleelin sleelin added the bug Something isn't working label Jun 29, 2022
@sleelin
Copy link
Collaborator

sleelin commented Jun 29, 2022

Hi Winston, thanks for the positive feedback!
This does appear to be a bug in the filter matching logic which I will aim to resolve for release 1.0.0.
Fortunately it only applies when using the built-in filter class to compare resources.

When creating/modifying/retrieving resources via the resource class's read/write/patch methods, they are always instantiated against the resource type's schema, and will use whichever casing was used in the schema definition (in this case, userName instead of username). This means that a client POSTing a user with "userName" or "username" will always result in a user resource instance with casing matching the schema ("userName" by default).

As the ingress/egress(/degress) methods of a resource are left up to you to implement in your ServiceProvider/client, the way you match resources is also flexible. Specifically speaking, when the ingress/egress method is called on resource read/write, the first argument is always the resource instance it was called on - which in this case would include a "filter" property that is an instance of the SCIMMY Filter class, which itself includes the property "expression" that is the raw filter expression string. This means that in cases where SCIMMY's filter matching functionality is lacking, it should be easy to temporarily substitute a more bespoke SCIM filtering package like scim2-parse-filter.

In any case, this is a bug I will aim to fix!
I've implemented the spec as best I can, so if you run into any other issues please do let me know.

Thanks,
Sam

@sleelin sleelin linked a pull request Nov 15, 2023 that will close this issue
@sleelin sleelin mentioned this issue Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

Successfully merging a pull request may close this issue.

2 participants