[英]Is the sqlsrv_query function enough to prevent DB injection?
我正在尝试防止在我的第一个Web api上进行数据库注入,并且不确定使用sqlsrv_query函数是否足够。
Yes, you should be safe , provided that you: 是的,你应该是 安全的 ,但前提是您:
?
?
参数化所有用户提供的值 placeholders $params
in the correct order $params
中为每个占位符提供值 Note however that this applies for values only - you cannot parameterize column names or table names in this way. 但是请注意,这仅适用于值-无法以这种方式参数化列名或表名。 In which case, you will need to perform validation such as whitelisting of permissible columns / tables etc.
在这种情况下,您将需要执行验证,例如将允许的列/表列入白名单等。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.