logoalt Hacker News

When parameterization fails: SQL injection in Nim using parameterized queries

13 pointsby xx_nsyesterday at 4:17 PM3 commentsview on HN

Comments

jiggawattsyesterday at 8:53 PM

That’s… not parameterization the way most people understand it. It’s text templating, which is different and fraught with risk as the OP discovered.

For comparison: the Microsoft SQL client code will not substitute an escaped version of the query parameters into the query text! It sends the query with the named placeholders first, and then the parameter values encoded separately so that there’s zero risk of this kind of thing happening.

Also, this makes it trivial for the database engine to cache each query independently of the specific query parameter values.

show 1 reply