“Injection” concerns for Cypher over REST

╄→尐↘猪︶ㄣ 提交于 2019-12-06 06:10:51

Here's a hypothetical situation, given that someone knows your query. If you take user input and concatenate it into a query, this might happen:

"MATCH (u:User) WHERE u.id = " + userId + " RETURN u"

Let's try a userId of:

"1 WITH count(1) AS dummy MATCH (u:User) OPTIONAL MATCH (u)-[r]-() DELETE u, r "

I'm sure some people could come up with worse examples...

This is instantly resolved with parameters. You can sanitize inputs as well, but I'd take the safe way if possible.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!