{"action":"created","issue":{"url":"https://api.github.com/repos/moonbingbing/openresty-best-practices/issues/184","repository_url":"https://api.github.com/repos/moonbingbing/openresty-best-practices","labels_url":"https://api.github.com/repos/moonbingbing/openresty-best-practices/issues/184/labels{/name}","comments_url":"https://api.github.com/repos/moonbingbing/openresty-best-practices/issues/184/comments","events_url":"https://api.github.com/repos/moonbingbing/openresty-best-practices/issues/184/events","html_url":"https://github.com/moonbingbing/openresty-best-practices/issues/184","id":194489047,"number":184,"title":"防止SQL注入的%s应该不需要用单引号，不确定是否还有其他情况需要考虑？","user":{"login":"hanxi","id":1185757,"avatar_url":"https://avatars.githubusercontent.com/u/1185757?v=3","gravatar_id":"","url":"https://api.github.com/users/hanxi","html_url":"https://github.com/hanxi","followers_url":"https://api.github.com/users/hanxi/followers","following_url":"https://api.github.com/users/hanxi/following{/other_user}","gists_url":"https://api.github.com/users/hanxi/gists{/gist_id}","starred_url":"https://api.github.com/users/hanxi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hanxi/subscriptions","organizations_url":"https://api.github.com/users/hanxi/orgs","repos_url":"https://api.github.com/users/hanxi/repos","events_url":"https://api.github.com/users/hanxi/events{/privacy}","received_events_url":"https://api.github.com/users/hanxi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-09T01:15:07Z","updated_at":"2016-12-21T23:54:40Z","closed_at":null,"body":"https://moonbingbing.gitbooks.io/openresty-best-practices/content/openresty/safe_sql.html\r\n```\r\ndb:query(string.format([[select * from cats where id = '%s']],\r\n    ndk.set_var.set_quote_sql_str(req_id)))\r\n```\r\n跟下面的不一样，`set_quote_sql_str` 和 `quote_sql_str` 结果都会给参数加上单引号。\r\nhttps://github.com/openresty/lua-resty-mysql#sql-literal-quoting\r\n```\r\nlocal name = ngx.unescape_uri(ngx.var.arg_name)\r\nlocal quoted_name = ngx.quote_sql_str(name)\r\nlocal sql = \"select * from users where name = \" .. quoted_name\r\n```"},"comment":{"url":"https://api.github.com/repos/moonbingbing/openresty-best-practices/issues/comments/268677853","html_url":"https://github.com/moonbingbing/openresty-best-practices/issues/184#issuecomment-268677853","issue_url":"https://api.github.com/repos/moonbingbing/openresty-best-practices/issues/184","id":268677853,"user":{"login":"membphis","id":6814606,"avatar_url":"https://avatars.githubusercontent.com/u/6814606?v=3","gravatar_id":"","url":"https://api.github.com/users/membphis","html_url":"https://github.com/membphis","followers_url":"https://api.github.com/users/membphis/followers","following_url":"https://api.github.com/users/membphis/following{/other_user}","gists_url":"https://api.github.com/users/membphis/gists{/gist_id}","starred_url":"https://api.github.com/users/membphis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/membphis/subscriptions","organizations_url":"https://api.github.com/users/membphis/orgs","repos_url":"https://api.github.com/users/membphis/repos","events_url":"https://api.github.com/users/membphis/events{/privacy}","received_events_url":"https://api.github.com/users/membphis/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T23:54:40Z","updated_at":"2016-12-21T23:54:40Z","body":"非常感谢问题报告，已经修复"}}
{"actor":{"display_login":"membphis"}}