使用xpath有什么安全风险?
我正在尝试将 XML 列添加到我的一个关键表中,以保存敏感数据。我无法使用实体框架查询这些 xml 记录,因此我的计划是使用包含 xpath 查询的存储过程来查询它们,然后通过实体框架调用 SP。
我不知道 xpath 和 xpath 注入的安全风险。有这方面的经验吗?
I'm trying to add an XML column to one of my critical tables in order to save sensitive data. I can't query over these xml records using Entity Framework, so my plan is to query over them using Stored Procedures contains xpath queries, then call SPs by Entity Framework.
I don't know about security risks of xpath and xpath injection. Any experience about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您不信任用户提供任意 XPath 表达式,那么也不信任他们提供您使用字符串连接替换为 XPath 表达式的字符串。使用包含外部变量(参数)的 XPath 表达式,并允许它们提供参数值。 (并非所有 XPath API 都允许这样做,而且我恐怕不知道实体框架是什么)。
If you don't trust the user to supply an arbitrary XPath expression, then don't trust them to supply a string that you substitute into an XPath expression using string concatenation. Use an XPath expression containing external variables (parameters), and allow them to supply the parameter values. (Not all XPath APIs allow this, and I'm afraid I have no idea what Entity Framework is).