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

SPARQL response code for invalid queries #190

Open
piotr-gawron opened this issue Jan 17, 2022 · 2 comments
Open

SPARQL response code for invalid queries #190

piotr-gawron opened this issue Jan 17, 2022 · 2 comments
Assignees

Comments

@piotr-gawron
Copy link

Currently when I submit invalid query I get response code 500 (Internal server error). I think it's more appropriate to return 400 (Bad request). Here is an example:

curl -o /dev/null -s -w "%{http_code}\n"  "https://id.nlm.nih.gov/mesh/sparql?query=blablabla&format=JSON&inference=true&offset=0&limit=1000"
@danizen danizen self-assigned this Jan 18, 2022
@danizen
Copy link
Contributor

danizen commented Jan 18, 2022

@piotr-gawron, hard to discuss that with federal government security - SPARQL editor is a place where SPARQL injection is actually the point, and is not far removed from SQL injection. Feel my pain :)

I have to mark this an enhancement because of the very real risks of breaking something. Submitting an invalid query containing JavaScript (e.g. <script>fubar</script> in a string literal) may not be fully detectable to Apache Jena. Since the query is then reflected back to the query editor, a bad query could run JavaScript in your editor. In recent fixes, I was barely able to continue to use a GET method to submit a query to the query editor, but we like to share queries that way :)

Of course, that doesn't mean the SPARQL endpoint couldn't return 400, but the code path in the editor is important to avoid that JavaScript reflection error.

@danizen
Copy link
Contributor

danizen commented Jan 18, 2022

And ... mentioning this is important in case I ever have to hand over this issue to someone else.

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

No branches or pull requests

2 participants