Skip to content

Commit 7f6b343

Browse files
authored
Switch string concatenation to placeholders.
The current method is open to SQL injection attacks, see: TryGhost/node-sqlite3#57
1 parent 8d61bea commit 7f6b343

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

app/db/user.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ var UserManager = {
88
});
99
},
1010
createUser: function(user){
11-
var stmt = db.prepare("INSERT INTO users(name, email) VALUES ('"+user.name+"','"+user.email+"')");
11+
var stmt = db.prepare("INSERT INTO users(name, email) VALUES (?, ?)", [user.name, user.email]);
1212
stmt.run();
1313
stmt.finalize();
1414
}

0 commit comments

Comments
 (0)