-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
oauth: boost::spirit::qi::expectation_failure #146
Comments
Yup, you're right. That should be a parse fail rather than a crash. Digging into the cause of the failure, it seems to be that The string looks a bit weird to me: s = "<dummy id='-1'/>"
k, v = s.split('=')
print "%s=\"%s\"" % (k, v)
# writes: <dummy id="'-1'/>" I don't understand why there'd be some random XML in the OAuth header. But regardless - the parse fail should be only a fail, not a crash. |
Don't propagate exceptions during OAuth header parsing and validation. Instead, treat it as a validation failure. Fixes #146.
Thanks a lot for the quick fix. I'm using the following test client https://github.com/mmd-osm/osm-auth/blob/debug_client/index.html, based on osm-auth, which is also used in iD editor. The relevant call is here (https://github.com/mmd-osm/osm-auth/blob/debug_client/index.html#L93-L96) - so I'm guessing this must be triggered by the library somehow. Test payload:
I think I will also open an issue for that library. It could be that I'm missing something how this library is supposed to be used. For the iD editor, this issue doesn't seem relevant, as they're using double quotes instead of single quotes when uploading changesets. |
Adding |
I was testing some use cases according to the osm website changeset_controller_test.rb file, and noticed an issue with OAuth header parsing. Somehow all test cases use an apostrophe for XML attributes (like in
<node id='#{node.id}'
), and parts of this gets included in the OAuth Auth header.Unfortunately, using
'
instead of"
triggers an HTTP 500 Internal Server error along with an Exception: boost::spirit::qi::expectation_failure. I'm suspecting that this case isn't covered in the parser implementation in oauth.cpp.(mod_fastcgi.c.3021) backend died; we'll disable it for 1 seconds and send the request to another backend instead: reconnects: 0 load: 1
curl statement to reproduce from command line:
BTW: the request was generated by https://github.com/osmlab/osm-auth, maybe there's some issue in that library as well. It shouldn't trigger a crash on cgimap side though.
The text was updated successfully, but these errors were encountered: