Skip to content

SQL injection #23

@eliasmalik

Description

@eliasmalik

the recommended way to avoid SQL injection using pg is to use parameterised queries.

You are making a parameterised query here, that's good:

{
text: 'SELECT * FROM blogs WHERE id =$1',
values: [id]
}, (err, blog) => {

But most of the other queries are like this one:

dbConnec.query(`SELECT * FROM admins WHERE name=${req.body.name}`, (err, admin) => {

Where the values are just substituted directly into the string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions