본문 바로가기
MySql

MySQL nodejs에서 sql-injection을 방지하고 sequelize하는 방법은 무엇입니까?

by 베이스 공부 2020. 11. 11.
반응형

Sequelize를 사용하여 사용자 지정 쿼리를 작성하고 가능한 한 SQL 주입의 잠재적 인 문제를 피하고 싶습니다. 따라서 내 질문은 Sequelize를 사용하여 삽입 된 변수로 사용자 지정 쿼리를 작성하는 안전한 방법이 있는지 여부입니다.

 

해결 방법

 


바인드 매개 변수는 대체물과 같습니다. 교체를 제외하고는 이스케이프됩니다. and inserted into the query by sequelize before the query is sent to the database, while bind parameters are sent to the database outside the SQL query text. A query can have either bind parameters or 교체.

SQLite 및 PostgreSQL 만 바인드 매개 변수를 지원합니다. 다른 방언 will insert them into the SQL query in the same way it is done for replacements. Bind parameters are referred to by either $1, $2, ... (숫자) 또는 $ key (영숫자). 이것은 방언과 무관합니다.

 

참조 페이지 https://stackoverflow.com/questions/35668651

 

 

반응형

댓글