News for hackers. Stuff that matters.
Re:Don’t try to sanitize input, escape output (2020) by ehutch79 on Thursday January 13, 2022 @12:19PM (#29923523)
If you're storing "Bob'; drop tables students --" in the database, you had to have sanitized your inputs, or there would be no students table.

The article title says NOT to sanitize inputs. perhaps it's that nuance doesn't fit in a headline, but eh...

Re:Don’t try to sanitize input, escape output (2020) by wvenable on Thursday January 13, 2022 @12:30PM (#29923711)
The confusion is what is input and what is output. The string "Bob'; drop tables students --" should not be sanitized/encoded on *input* to the application. However, if you're not using parameterized queries, it should be encoded on *output* to the database.

Data should only be sanitized in transit and not stored in an sanitized form. That's what the article is really saying.

Re:Don’t try to sanitize input, escape output (2020) by IshKebab on Thursday January 13, 2022 @01:59PM (#29925060)
No you don't. You use a parameterized query: execute("INSERT INTO foo VALUES (?)", user_input)