久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<i id='f9wRe'><tr id='f9wRe'><dt id='f9wRe'><q id='f9wRe'><span id='f9wRe'><b id='f9wRe'><form id='f9wRe'><ins id='f9wRe'></ins><ul id='f9wRe'></ul><sub id='f9wRe'></sub></form><legend id='f9wRe'></legend><bdo id='f9wRe'><pre id='f9wRe'><center id='f9wRe'></center></pre></bdo></b><th id='f9wRe'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='f9wRe'><tfoot id='f9wRe'></tfoot><dl id='f9wRe'><fieldset id='f9wRe'></fieldset></dl></div>
  • <tfoot id='f9wRe'></tfoot>
  • <small id='f9wRe'></small><noframes id='f9wRe'>

        <bdo id='f9wRe'></bdo><ul id='f9wRe'></ul>

      1. <legend id='f9wRe'><style id='f9wRe'><dir id='f9wRe'><q id='f9wRe'></q></dir></style></legend>
      2. 防止 Node.js 中的 SQL 注入

        Preventing SQL injection in Node.js(防止 Node.js 中的 SQL 注入)

          <small id='n0o4X'></small><noframes id='n0o4X'>

          <tfoot id='n0o4X'></tfoot>
            <tbody id='n0o4X'></tbody>
            <bdo id='n0o4X'></bdo><ul id='n0o4X'></ul>
          • <legend id='n0o4X'><style id='n0o4X'><dir id='n0o4X'><q id='n0o4X'></q></dir></style></legend>

                <i id='n0o4X'><tr id='n0o4X'><dt id='n0o4X'><q id='n0o4X'><span id='n0o4X'><b id='n0o4X'><form id='n0o4X'><ins id='n0o4X'></ins><ul id='n0o4X'></ul><sub id='n0o4X'></sub></form><legend id='n0o4X'></legend><bdo id='n0o4X'><pre id='n0o4X'><center id='n0o4X'></center></pre></bdo></b><th id='n0o4X'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='n0o4X'><tfoot id='n0o4X'></tfoot><dl id='n0o4X'><fieldset id='n0o4X'></fieldset></dl></div>
                • 本文介紹了防止 Node.js 中的 SQL 注入的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  是否有可能像 PHP 具有防止 SQL 注入的預(yù)處理語句那樣防止 Node.js 中的 SQL 注入(最好使用模塊).

                  Is it possible to prevent SQL injections in Node.js (preferably with a module) in the same way that PHP had Prepared Statements that protected against them.

                  如果是這樣,怎么辦?如果沒有,有哪些示例可以繞過我提供的代碼(見下文).

                  If so, how? If not, what are some examples that might bypass the code I've provided (see below).

                  一些背景:

                  我正在使用 制作一個(gè)包含 Node.js + MySql 的后端堆棧的 Web 應(yīng)用程序node-mysql 模塊.從可用性的角度來看,該模塊很棒,但它還沒有實(shí)現(xiàn)類似于 PHP 的 準(zhǔn)備好的聲明(雖然我知道它在todo).

                  I'm making a web application with a back-end stack consisting of Node.js + MySql using the node-mysql module. From a usability perspective, the module is great, but it has not yet implemented something akin to PHP's Prepared Statements (though I'm aware it is on the todo).

                  據(jù)我了解,PHP 對(duì)準(zhǔn)備好的語句的實(shí)現(xiàn),除其他外,在防止 SQL 注入方面有很大幫助.不過,我擔(dān)心我的 node.js 應(yīng)用程序可能會(huì)受到類似的攻擊,即使使用默認(rèn)提供的字符串轉(zhuǎn)義(如下面的代碼片段所示).

                  From my understanding, PHP's implementation of prepared statements, among other things, helped greatly in the prevention of SQL injections. I'm worried, though, that my node.js app may be open to similar attacks, even with the string escaping provided by default (as in the code snippet below).

                  node-mysql 似乎是最流行的 node.js mysql 連接器,所以我想知道其他人可能會(huì)做什么(如果有的話)來解決這個(gè)問題——或者它是否甚至是 node.js 的問題首先(不知道怎么會(huì)不會(huì),因?yàn)樯婕暗接脩?客戶端輸入).

                  node-mysql seems to be the most popular mysql connector for node.js, so I was wondering what other people might be doing (if anything) to account for this issue - or if it is even an issue with node.js to begin with (not sure how this wouldn't be, since user/client-side input is involved).

                  我是否應(yīng)該暫時(shí)切換到node-mysql-native,因?yàn)樗_實(shí)提供了準(zhǔn)備好的語句?我很猶豫要不要這樣做,因?yàn)樗坪醪幌?node-mysql 那樣活躍(盡管這可能只是意味著它是完整的).

                  Should I switch to node-mysql-native for the time being, since it does provide prepared statements? I'm hesitant to do this, because it does not seem to be as active as node-mysql (though that may just mean that it is complete).

                  這是一段用戶注冊(cè)代碼,它使用了 sanitizer 模塊,以及使用 node-mysql 準(zhǔn)備好的類似語句的語法(正如我上面提到的,進(jìn)行字符轉(zhuǎn)義),分別防止跨站點(diǎn)腳本和 sql 注入:

                  Here is a snippet of user registration code, which uses the sanitizer module, along with node-mysql's prepared statement-like syntax (which, as I mentioned above, does character escaping), to prevent cross site scripting and sql injections, respectively:

                  // Prevent xss
                  var clean_user = sanitizer.sanitize(username);
                  
                  // assume password is hashed already
                  var post = {Username: clean_user, Password: hash};
                  
                  // This just uses connection.escape() underneath
                  var query = connection.query('INSERT INTO users SET ?', post,
                     function(err, results)
                     {
                         // Can a Sql injection happen here?
                     });
                  

                  推薦答案

                  node-mysql 庫在使用時(shí)會(huì)自動(dòng)執(zhí)行轉(zhuǎn)義,就像您已經(jīng)在做的那樣.見 https://github.com/felixge/node-mysql#escaping-query-值

                  The node-mysql library automatically performs escaping when used as you are already doing. See https://github.com/felixge/node-mysql#escaping-query-values

                  這篇關(guān)于防止 Node.js 中的 SQL 注入的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

                  相關(guān)文檔推薦

                  How to use windowing functions efficiently to decide next N number of rows based on N number of previous values(如何有效地使用窗口函數(shù)根據(jù) N 個(gè)先前值來決定接下來的 N 個(gè)行)
                  reuse the result of a select expression in the quot;GROUP BYquot; clause?(在“GROUP BY中重用選擇表達(dá)式的結(jié)果;條款?)
                  Does ignore option of Pyspark DataFrameWriter jdbc function ignore entire transaction or just offending rows?(Pyspark DataFrameWriter jdbc 函數(shù)的 ignore 選項(xiàng)是忽略整個(gè)事務(wù)還是只是有問題的行?) - IT屋-程序員軟件開發(fā)技
                  Error while using INSERT INTO table ON DUPLICATE KEY, using a for loop array(使用 INSERT INTO table ON DUPLICATE KEY 時(shí)出錯(cuò),使用 for 循環(huán)數(shù)組)
                  pyspark mysql jdbc load An error occurred while calling o23.load No suitable driver(pyspark mysql jdbc load 調(diào)用 o23.load 時(shí)發(fā)生錯(cuò)誤 沒有合適的驅(qū)動(dòng)程序)
                  How to integrate Apache Spark with MySQL for reading database tables as a spark dataframe?(如何將 Apache Spark 與 MySQL 集成以將數(shù)據(jù)庫表作為 Spark 數(shù)據(jù)幀讀取?)

                      <small id='pIcID'></small><noframes id='pIcID'>

                        <tbody id='pIcID'></tbody>
                      <i id='pIcID'><tr id='pIcID'><dt id='pIcID'><q id='pIcID'><span id='pIcID'><b id='pIcID'><form id='pIcID'><ins id='pIcID'></ins><ul id='pIcID'></ul><sub id='pIcID'></sub></form><legend id='pIcID'></legend><bdo id='pIcID'><pre id='pIcID'><center id='pIcID'></center></pre></bdo></b><th id='pIcID'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='pIcID'><tfoot id='pIcID'></tfoot><dl id='pIcID'><fieldset id='pIcID'></fieldset></dl></div>

                      <legend id='pIcID'><style id='pIcID'><dir id='pIcID'><q id='pIcID'></q></dir></style></legend>
                          <bdo id='pIcID'></bdo><ul id='pIcID'></ul>
                          • <tfoot id='pIcID'></tfoot>
                            主站蜘蛛池模板: 亚洲精品综合一区二区 | 久久久久久久一区 | 一区二区三区在线播放 | 精品一区二区三区免费视频 | www国产精| 天天草天天 | 欧美999 | 精品国产乱码久久久久久88av | 国产精品入口麻豆www | 成人毛片一区二区三区 | 精品久久电影 | 在线观看亚洲一区二区 | 精品国产一区二区国模嫣然 | 色综合色综合色综合 | 午夜91| 国产一区二区三区四区五区加勒比 | 久久国产精品99久久久久久丝袜 | 国产欧美精品一区二区三区 | 欧美日韩免费视频 | 影视一区| 成人高清在线视频 | www.久久 | 97人人澡人人爽91综合色 | 国产成人精品视频在线观看 | 久久国产精品精品国产色婷婷 | www.xxxx欧美 | 国产亚洲成av人在线观看导航 | 天天干天天想 | 国产高清在线精品一区二区三区 | 一区二区三区视频在线观看 | 黄网站在线播放 | 久久久久久久久久久丰满 | h视频在线看 | 国产高清精品在线 | 久久99视频| 亚洲毛片在线 | 天天操夜夜艹 | 天天综合永久入口 | 亚洲区一区二 | 国产午夜精品久久久 | 欧美黄色一区 |