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

Client registration sends ct with invalid syntax #1020

Closed
weinholt opened this issue Jun 6, 2021 · 4 comments · Fixed by #1021
Closed

Client registration sends ct with invalid syntax #1020

weinholt opened this issue Jun 6, 2021 · 4 comments · Fixed by #1021
Labels
bug Dysfunctionnal behavior client Impact LWM2M client server Impact LWM2M server

Comments

@weinholt
Copy link

weinholt commented Jun 6, 2021

I tried the Leshan demo client towards a non-Leshan server and noticed that the client uses invalid syntax in the Register operation payload:

</>;ct=60 110 112 11542 11543;rt="oma.lwm2m",</1>;ver=1.1,</1/0>,</3>;ver=1.1,</3/0>,</6/0>,</3303>;ver=1.1,</3303/0>

The syntax for ct is given in RFC 7252 (CoAP) as follows:

ct-value =  cardinal
         /  DQUOTE cardinal *( 1*SP cardinal ) DQUOTE

Even in the absence of RFC 7252 there is an ABNF in RFC 6690 (CoRE link format) that does not allow space in unquoted values.

Leshan should quote the ct attribute if it contains spaces, like so:

</>;ct="60 110 112 11542 11543";rt="oma.lwm2m",</1>;ver=1.1,</1/0>,</3>;ver=1.1,</3/0>,</6/0>,</3303>;ver=1.1,</3303/0>

Leshan's own parser for this data is very forgiving (too forgiving, really) which is probably why this was not caught right away.

@sbernard31
Copy link
Contributor

@weinholt thx for reporting this 🙏

I will add quote for ct attribute very soon.

Leshan's own parser for this data is very forgiving (too forgiving, really) which is probably why this was not caught right away.

Probably true.
Link class is used to handle CoRE link format.
We already identify some issue about its too permissive parsing...

For now, nobody begin to work on it and I don''t plan to do it at short term.

I'm not sure which kind of rules should be handle in Link class, I mean which level of abstraction.
Currently the class doesn't know particular attribute (like "ct") and so can not detect this kind of error.
If you have idea about all of this, please share it 🙏.

@sbernard31 sbernard31 added bug Dysfunctionnal behavior client Impact LWM2M client server Impact LWM2M server labels Jun 7, 2021
@sbernard31
Copy link
Contributor

The bug is also at server side as Leshan does not parse correctly the ct part for :

</>;ct="60 110 112 11542 11543";rt="oma.lwm2m",</1>;ver=1.1,</1/0>,</3>;ver=1.1,</3/0>,</6/0>,</3303>;ver=1.1,</3303/0>

@sbernard31
Copy link
Contributor

sbernard31 commented Jun 7, 2021

#1021 should fix the issue.
If you want/can, please do not hesitate to review the PR and or test it. 🙏
If you don't plan to do that just let me know, this way integrate it in master without waiting your feedback.

@sbernard31
Copy link
Contributor

I created a dedicated issue about having a less permissive parser for CoRE link format : #1022.
Do not hesitate to participate to the discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Dysfunctionnal behavior client Impact LWM2M client server Impact LWM2M server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants