Does Forked Copy of SQLX require in house string sanitization #4149
-
|
Hi! I recently forked a copy of SQLx (using sqlite) so that I could build SQLCipher for my project on Android/IOS. After forking so I could change around a few feature flags in libsqlite3, the entire SQLx API seemed to change, and now normal strings are no long accepted in the macroless Querry API. I must stick them in a AsserSqlSafe struct, the documentation of which informs me I should be doing sanitization myself. Can someone explain what happened here? Does SQLx not provide sanitization in the way I think? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Yes, the api has changed in the 0.9 version (which has not been officially released yet). This has basically everything to do with sql injections. (If you don't know what this is, I'd recommend reading about it here.) Before and after this change SQLx doesn't sanitize your query, it does not look at the structure, does not parse/inspect the query, it never has and still doesn't. So if users can influence your queries (by using With the changes, SQLx makes it possible for the user to give an owned query as input (a If you are using string literals for queries with query parameters there is basically no change and you don't have to worry about anything. If you're upgrading and need to change code to make you queries work again, there is a chance that you code was/is vulnerable to sql injections. |
Beta Was this translation helpful? Give feedback.
Yes, the api has changed in the 0.9 version (which has not been officially released yet). This has basically everything to do with sql injections. (If you don't know what this is, I'd recommend reading about it here.) Before and after this change SQLx doesn't sanitize your query, it does not look at the structure, does not parse/inspect the query, it never has and still doesn't. So if users can influence your queries (by using
format!(...)to generate queries for example), sqlx doesn't help you against sql injections.With the changes, SQLx makes it possible for the user to give an owned query as input (a
Stringfor example), this was not possible before. Now having aStringas an argumen…