LiQL injection attacks and quotes in Rest API 2.0
I am sorry if this subject has already been covered, but I have searched forums, knowledge bases and Google for any answers and have come up empty handed.
I am wondering how LiQL is protected against:
- LiQL injection attacks (when query parameters contain user-entered data) like SQL Injection attacks.
- LiQL handling of query parameters that contain single quotes.
Example (made up):
<#assign replies = rest("2.0","/search?q=" + "SELECT id, body FROM messages WHERE topic.tag = '${topic_tag}' AND depth > 0"?url).data.items />
If the variable topic_tag comes from a user-entered value, and it itself contains a single quote ['], the rest query string will have unmatched quotes, and would probably cause the query to fail.
<#assign topic_tag = "don't_do_this" />
... would cause the query to be ...
"/search?q=SELECT id, body FROM messages WHERE topic.tag = 'don't_do_this' AND depth > 0"
The part of the query colored red would surely upset the query parser, right?
Shouldn't variables that are expanded into LiQL be escaped to prevent this from ever happening?