▲ | zdragnar 2 months ago | ||||||||||||||||
Don't forget that different clients or view formats (apps, export to CSV, etc) all have their own sanitization requirements. Sanitize at your boundaries. Data going to SQL? Apply SQL specific sanitization. Data going to Mongo? Same. HTML, JSON, markdown, CSV? Apply the view specific sanitizing on the way. The key difference is that, if you deploy a JSON API that is view agnostic, that the client now needs to apply the sanitization. That's a requirement of an agnostic API. | |||||||||||||||||
▲ | chrismorgan 2 months ago | parent [-] | ||||||||||||||||
Please don’t use the word sanitising for what you seem to be describing: it’s a term more commonly used to mean filtering out undesirable parts. Encoding for a particular serialised format is a completely different, and lossless, thing. You can call it escaping or encoding. | |||||||||||||||||
|