waterthetrees/wtt_server

Check queries for prepared statements

開放

#136 建立於 2023年3月20日

 (1 則留言) (0 個反應) (1 位負責人)JavaScript (4 個分叉)auto 404
backendenhancementgood first issue

倉庫指標

星標
 (0 顆星)
PR 合併指標
 (30 天內沒有已合併 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,
  };

貢獻者指南