You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 1, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Jul 1, 2026. It is now read-only.
Thanks. I hoped so. I did not want to assume that "prepare" in
node-sqlite3 means thevsamw thing as sqlite3_prepare in the sqlite libs. I
should stop being lazy and just look at the source. :) Thanks!
On Jan 21, 2012 3:08 AM, "Konstantin Kfer" < reply@reply.github.com>
wrote:
SQLite protects you against SQL injections if you specify user-supplied
data as part of the params rather than stringing together an SQL query:
BAD: db.prepare("INSERT INTO foo VALUES(" + variable + ")");
GOOD: `db.prepare("INSERT INTO foo VALUES (?)", variable);
By using the placeholder ?, SQLite automatically treats the data as
input data and it does not interfere with parsing the actual SQL statement.
Reply to this email directly or view it on GitHub:
Activity
kkaefer commentedon Jan 21, 2012
SQLite protects you against SQL injections if you specify user-supplied data as part of the params rather than stringing together an SQL query:
BAD:
db.prepare("INSERT INTO foo VALUES(" + variable + ")");GOOD:
db.prepare("INSERT INTO foo VALUES (?)", variable);By using the placeholder
?, SQLite automatically treats the data as input data and it does not interfere with parsing the actual SQL statement.cmundi commentedon Jan 21, 2012
Thanks. I hoped so. I did not want to assume that "prepare" in
node-sqlite3 means thevsamw thing as sqlite3_prepare in the sqlite libs. I
should stop being lazy and just look at the source. :) Thanks!
On Jan 21, 2012 3:08 AM, "Konstantin Kfer" <
reply@reply.github.com>
wrote:
Sanitize SQL
Switch string concatenation to placeholders.
cleanup