Hacker News new | ask | show | jobs
by larssorenson 2119 days ago
Unfortunately short of forcing everyone to use an ORM I don't see how we can block the unsafe API, which I'm assuming to be the string-based query interface e.g. `conn.query("SELECT * FROM users")` since any interface that accepts a string will allow a dynamically constructed string which lets developers open themselves to injection attacks. Only ORMs AFAIK can prevent this, e.g. db().users.all() or db().users.select(name="bob").

Maybe there's a clever trick I'm missing here.

1 comments

It'd be nice if the languages offered a way for the query-compiling function to require that the query strings given to it are static, compile-time strings.