15five / scim2-filter-parser

A customizable parser/transpiler for SCIM2.0 filters
Other
23 stars 8 forks source link

Grammar of attribute names #25

Closed mohankumaru closed 3 years ago

mohankumaru commented 3 years ago

Hi @logston , There are some attributes in RFC 7643, for example "manager.$ref", "groups.$ref", which uses "$". The section 2.1 in RFC (https://datatracker.ietf.org/doc/html/rfc7643#section-2.1) speaks about the grammar for attribute name.

Attribute names MUST conform to the following ABNF rules:

               ATTRNAME   = ALPHA *(nameChar)
               nameChar   = "$" / "-" / "_" / DIGIT / ALPHA

When we parse such attributes, lexer will throw "Illegal character in filter query" value error. Is it possible to handle these attribute naming's?

Using the following filter will reproduce the issue.

filter = "urn:ietf:params:scim:schemas:extension:enterprise:2.0:User:manager.$ref eq \"abc\""
token_stream = SCIMLexer().tokenize(filter)
ast = SCIMParser().parse(token_stream)

Regards, Mohan

logston commented 3 years ago

You're right! I missed that. Looks like we can change that here: https://github.com/15five/scim2-filter-parser/blob/master/src/scim2_filter_parser/lexer.py#L203

Do you want to issue the PR with tests? If not I should be able to get to it in the next week or so.

mohankumaru commented 3 years ago

Sure, I will issue PR in a day or two, thank you.

mohankumaru commented 3 years ago

https://github.com/15five/scim2-filter-parser/pull/26

mohankumaru commented 3 years ago

Hey @logston , can you please make this change available soon.

logston commented 3 years ago

Should be available at https://pypi.org/project/scim2-filter-parser/0.3.9/ now. Thanks for the ping.