Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Stray percent character in query parameter causes crash #1143

Open
ammoniak opened this issue Feb 3, 2018 · 4 comments
Open

Stray percent character in query parameter causes crash #1143

ammoniak opened this issue Feb 3, 2018 · 4 comments

Comments

@ammoniak
Copy link
Contributor

ammoniak commented Feb 3, 2018

Adding a stray percent character % somewhere in the query parameter of an API call crashes the api.
Example: http://staging.openki.net/api/0/json/venues?region=%
Actual output:

{
	"status": "error",
	"message": "Server error"
}

Expected output

{
	"status": "success",
	"data": []
}
@lu40 lu40 added the defect label Feb 3, 2018
@lu40 lu40 changed the title Stray percent character in query parameter crashes the api API: Stray percent character in query parameter causes crash Feb 3, 2018
@lu40 lu40 changed the title API: Stray percent character in query parameter causes crash JSON-API: Stray percent character in query parameter causes crash Feb 3, 2018
@sablonier
Copy link

sablonier commented Feb 7, 2018

Vote for "Defect", not "Defect (not urgent)". In my opinion this is a serious url encoding issue.

@sablonier
Copy link

sablonier commented Feb 9, 2018

https://openki.net/find?categories=%humanities
https://openki.net/course/ZH33zGn6nhjunoFjW/circling%
Maybe "JSON-API:" should be removed in the title.
a serious url encoding issue
Vote for "Defect", not "Defect (not urgent)".

I see that the issue might be how "URIError: malformed URI sequence" is handled with decodeURIComponent in url-tools.js. It has to be thrown and there is no url encodign/decoding issue. Maybe it is more a question about how the exception is handled and what is finally done (currently API gives back non-specific errors, client stopps rendering etc).

@sbalmer sbalmer changed the title JSON-API: Stray percent character in query parameter causes crash Stray percent character in query parameter causes crash Feb 26, 2018
@sbalmer
Copy link
Contributor

sbalmer commented Feb 26, 2018

If the client sends us a broken URL, they should get an error back. It would be good if we could send a proper 400 status code but other than that it is not an issue.

@sablonier
Copy link

Thank you for looking into this. Getting something back instead of a blank page is good anyway.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants