However, the underlying core problem of the vulnerability is absolutely independent of any specific component, vendor, product or policy. The core problem are developers not thinking their stuff out. Reading from a file is an absolutely non trivial task, million things can go wrong and the responsible developer has to foresee and handle them all in a generic sane way. Maybe do not read until EOF, if you never expect more than a few bytes? Read the file async with a timeout? Taint the input? Do not put the system in a dependent, unsecure state before success of the operation. Expect stuff to fail and code accordingly! Think like a hacker and try to hack your own code. And do this for any single line of your code.
I learned to introspect my code in this way as a byproduct of learning Rust. It began with Rust's strict type system, which forced me to carefully consider each and every value and variable and how I toss them around and how and where and how long I am going to access them in my code. It continued with the error handling policies of Rust in a similar way. The learning curve of Rust was steep for me and coding the first months was tedious. But once I got the hang of it, I started to love it. Fighting the compiler, I have to go through every aspect of my code in a super careful way over and over again and once the compiler gives the Go, I feel love and appreciation for my code - as if I crafted something special, that was approved by the master. Code no longer was for me something thrown into the editor as fast as possible with just the effort to make it run somehow reliably. I felt now, as if my code was a piece of art, well thought out and beautifully crafted, made to serve for many years, like a musical instrument. In other words, Rust was changing the appreciation of my own work and gently shoved me to a more careful approach of coding.
At some point in development I go through my code to do some manual formatting, you know, aesthetic stuff like indenting to make the code look more beautiful (in a human way, not a linter's way). Like a last polish. And on this run, I look at my code as a hacker. How would I crack it? How would it handle that and that exception? I try to think really evil. I think many programmers shy away of this step, because it can mean a lot, a lot of new work. And this is where Zero Days as the one described in the thread originate.