2 ms·
I don't know how I feel about other headers, but I don't like using a Content-Type header since it can disagree with the binary stream, and this has historicall
by geocar 2y ago
I don't know how I feel about other headers, but I don't like using a Content-Type header since it can disagree with the binary stream, and this has historically been a place to hide bugs.
- teddyh 2y agoA binary stream can be multiple formats at once. An out-of-band content-type is the only workable solution; auto-detection of file formats (a.k.a. ”sniffing”) has has a terrible security record.
- geocar 2y ago> A binary stream can be multiple formats at once So what? If Spartan doesn't do anything with them, it can save them to the disk: It doesn't need to know the difference between a zipfile and an xlsx sheet in order to do so. > An out-of-band content-type is the only workable solution Solution to what? I don't think "more metadata" solves anything, let alone security problems. An "out-of-band content type" declaration is just that: an unsubstantiated claim as to a valid interpretation of the bytes-in-question. Using a buggy png parser just because some other layer said it was "image/png" is where the security problems are. > auto-detection of file formats (a.k.a. ”sniffing”) has has a terrible security record. The single biggest source of security problems is code you don't need: Fix whatever program you've got that can't tolerate random bytes from the Internet, or don't give those programs random bytes you get from the Internet.
- immibis 2y agoDo you never want to see a file in the browser?
- teddyh 2y ago> Using a buggy png parser just because some other layer said it was "image/png" is where the security problems are. If your PNG parser is buggy, you have bigger problems. > Fix whatever program you've got that can't tolerate random bytes from the Internet Like your PNG parser?
- thephyber 2y agoThe underlying problem you are describing is the spirit of the web browser. It has been designed to be extremely resilient to sloppy / wrong coding. This is the reason JavaScript has weird features like Automatic Semicolon Insertion and why every browser tolerates sloppy HTML markup (even though they don’t clean it up in the same ways).