Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible SQL Injection #11

Open
WithMathICan opened this issue Mar 17, 2023 · 0 comments
Open

Possible SQL Injection #11

WithMathICan opened this issue Mar 17, 2023 · 0 comments

Comments

@WithMathICan
Copy link

В файле db.js присутствует следующий код

async read(id, fields = ['*']) {
    const names = fields.join(', ');
    const sql = `SELECT ${names} FROM ${table}`;
    if (!id) return pool.query(sql);
    return pool.query(`${sql} WHERE id = $1`, [id]);
}

Здесь может быть уязвимость связанная с SQL инъекцией. Поскольку запрос в базу данных использует конкатенацию строк, которые ни как не валидируются. Конечно уязвимость зависит от того, как этим методом пользоваться. Но вдруг кто то вызовет его не так, как нам хочется.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant