3 ms·
Can someone explain me one thing? >When accepting untrusted input from the user, we should escape it before it is added to thedatabase so that we can later u
by tester756 7y ago
Can someone explain me one thing?
>When accepting untrusted input from the user, we should escape it before it is added to thedatabase so that we can later use it without worrying about escaping.
I tend to believe that despite very popular saying `escape everything!!!` it isn't so practical
Let's say I have ASP.NET Core WebAPI which is using EF Core + Vuejs on frontend
I'm accepting user input which is being binded to model (class) without escaping and saving it straight to db (ofcs after basic validation like strings length and business logic)
I'm using parametrized queries, so I don't have to worry about about SQLi, then I'm returning that data as json and the client (frontend, vuejs) escapes it and renders as text.
If I escaped that data before e.g `Germany / Berlin / 15B` after escape it'd be `Germany \/ Berlin \/ 15B`
then it'd less practical to use thing kind of data because whenever you'd want to use it, then you'd have to take into account that there may be some "weird" characters.
So how it is? I tend to believe that sql parameters and escaping on client side should be done instead of escaping at the beginning
Also I tend to believe that SQLi should be non-existent problem nowadays(and before tbh) because it's always possible to compare ASTs. SQLi will always? modify AST, yea?