2 ms·
I have a much simpler idea that does not provide so much functionality but it prevents sql injections. We should have datatype for SQL, and special literal for
by scotty79 16y ago
I have a much simpler idea that does not provide so much functionality but it prevents sql injections.
We should have datatype for SQL, and special literal for it. Functions that execute queries should take only parameters of type SQL (never strings). There should be almost no way to construct SQL from string. There should be 'formatting' operator that allows you to put values in SQL and it should do default escaping on them.
As for XSS attack I'd suggest HTML datatype with its own literals. Output functions should only accept HTML (not strings). Similarly there should be almost no way to convert string (or any value) to HTML without escaping it.
- chromatic 16y agoThat's essentially the same idea. See also "working with Unicode strings in different encodings" or "working with values of different (but compatible units)".