2 ms·
I'd go one further and say that if you use string interpolation with anything remotely related to user input at all in a web app, you probably just wrote a secu
by jerf 16y ago
I'd go one further and say that if you use string interpolation with anything remotely related to user input at all in a web app, you probably just wrote a security hole of some sort. I use "probably" in the frequentist sense of the term, because the odds of a given user-input string interpolation in an arbitrarily-chosen web app being in at least one of 1. an HTML string 2. a database string 3. a javascript string or 4. something else that is executable by something, without the context-relevant encoding function, are quite high. Same goes for any string concatenation involving anything from the environment or user without the conspicuous presence of an encoding function of some kind, since interpolation is just syntax sugar for concatenation.
"Don't let users interpolate, ever" is close to truth. It isn't quite truth, but it's a lot shorter than the truth.