// : ! function popup(msg: string): string { return "<p class=\"popup\">" + msg + "</p>"; }
// : ! function getName(login: string): string { return "SELECT name FROM users WHERE login = \"" + login + "\""; }
function f(userInput: A): A { const firstCommand: A = ...; const secondCommand: A = ...; return firstCommand.concat(userInput.concat(secondCommand)); }
"SELECT name FROM users WHERE login = \"" + login + "\""
query("SELECT name FROM users WHERE login = :login", {login})
SELECT name FROM users WHERE login =:login
command SELECT name FROM users WHERE login =:login
distinctly separated from the {login}
data. At the same time, internal mechanisms ensure that the data will be prepared for use in the SQL query. Screen quotes and embed malicious code will not work. { paramA: "the value of the A parameter", paramB: "the value of the A parameter", }
{ paramA: "the value of the A parameter", paramB: {$in: [ "the value of the B parameter", "the value of the C parameter", ]}, }
userInput
: { paramA: userInput.paramA, paramB: {$in: [ userInput.paramB[0], userInput.paramB[1], ]}, }
the value of the A parameter
, but also commands, for example {$in: ["B", "C"]}
. The user can send a request in various ways, after decrypting which an object is obtained (a form, JSON or XML), and therefore the code can be subjected to attacks by injection.userInput.paramA
is {$empty: false}
. Then the query looks like this: { paramA: {$empty: false}, paramB: {$in: [ userInput.paramB[0], userInput.paramB[1], ]}, }
Symbol
command so that it cannot be sent over the network.
LOOKING.HOUSE - the project collected more than 150 points looking glass in 40 countries. You can quickly execute the host, ping, traceroute, and mtr commands.
Source: https://habr.com/ru/post/422077/
All Articles