waterthetrees/wtt_server

Check queries for prepared statements

开放

#136 创建于 2023年3月20日

 (1 条评论) (0 个反应) (1 位负责人)JavaScript (4 个派生)auto 404
backendenhancementgood first issue

仓库指标

星标
 (0 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

Use prepared statements to guard against sql injection. Good call @tzinckgraf, thanks for bringing this up! I assigned you but feel free to unassign yourself if you'd rather have someone else work on it.

TODO for this issue: check queries to make sure they are PreparedStatements

https://vitaly-t.github.io/pg-promise/PreparedStatement.html

In our code prepared statements can be formatted like this. Note, name must be unique.

const query = {
    name: 'find-source',
    text: 'SELECT * FROM sources WHERE id_source_name =  $1',
    values: idSourceName,
  };

贡献者指南