3 ms·
Tainting is best used for detecting cases where the string in question is both dangerous (e.g. being `eval`ed) and derived from external inputs. I remember bei
by yellowapple 10y ago
Tainting is best used for detecting cases where the string in question is both dangerous (e.g. being `eval`ed) and derived from external inputs.
I remember being scolded while working my first "real" programming job becaused I used `eval` in a Ruby on Rails codebase (I don't remember the specifics; I think I was trying to hack something together because the controller setup was weird and I was struggling with the "Rails Way™"). Using a quick `eval` to generate the intended code on-the-fly seemed reasonable to me, having previously been intimiately familiar with Perl (where the dangers of `eval` are mostly mitigated thanks to tainting).
I subsequently learned to embrace Ruby's more robust metaprogramming facilities, and have since come to appreciate the value (and danger) of macros in languages like Lisp and Elixir, but I still found it interesting that features like tainting aren't more widespread (or if they are, they're not advertised very well).