4 ms·
Or treat your database as a user and don't blindly accept what it gives you without validating it. At a previous job I implanted a user record that would have
by SahAssar 7y ago
Or treat your database as a user and don't blindly accept what it gives you without validating it.
At a previous job I implanted a user record that would have given me admin credentials on the next db migration (which happened pretty regularly) because the developer of the migration tool said "Why should I not trust this data, it came from the database". It was "sanitized" by the app for it's intended use, but not for the ETL tool.
If you sanitize your inputs you automatically create the assumption that the database is "safe", but you also have to sanitize it for every potential future usecase that the data might be used for, which is not clear when you are writing the sanitization code. Can you foresee every type of use the data will have in the future? can you know every ETL step that will be written 5, 10 years down the line? If not, it's safer to treat the data as untrusted, and if you are going to do that anyway it's a whole lot easier to just not sanitize since you will otherwise deal with double-sanitization or double-escaping.
- rossdavidh 7y ago"...what it gives you..." Right there is the flaw. It's not "you", it's "any programmer who ever works with this system, now or any time in the future.
- SahAssar 7y agoProgrammers generally agree that user input is untrusted, right? My point is that should just be extended to the database, and even where it isn't, it sorta already is for attacks.