It's always good to write tests with the "The Enterprise Developer from Hell" in mind: https://fsharpforfunandprofit.com/posts/property-based-testi...
Property-Based Testing Caught a Security Bug I Never Would Have Found
31–40 of 40 posts
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#32TL;DR: obj[key] with user-controlled key == "__proto__" is a gift that keeps on giving; buy our AI tool that will write subtle vulnerabilities like that which you yourself won’t catch in review but then it will also write some property-based tests that maybe will
My take away is “don’t write your own input tests, use a library”. The rest is AI-slip
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#33Earlier quoted context omitted.
The original claim for TDD is your write tests for all your edge cases. It doesn't matter about inputs you didn't consider because they are covered in the edge. If you can only accept inputs from 2-7 (inclusive) you check 1,2,7,8 - if those pass you assume the rest work.
You forgot 0, -1, null, "1".
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#34TL;DR: obj[key] with user-controlled key == "__proto__" is a gift that keeps on giving; buy our AI tool that will write subtle vulnerabilities like that which you yourself won’t catch in review but then it will also write some property-based tests that maybe will
It also talks about using PBT and Randomness for some reason. This is clearly just a test value of a non-AI library written by a human. My take away is “don’t write your own input tests, use a library”. The rest is AI-slip
[1] https://www.exploringbinary.com/php-hangs-on-numeric-value-2...
[2] https://www.exploringbinary.com/java-hangs-when-converting-2...
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#35TL;DR: obj[key] with user-controlled key == "__proto__" is a gift that keeps on giving; buy our AI tool that will write subtle vulnerabilities like that which you yourself won’t catch in review but then it will also write some property-based tests that maybe will
Didn't react just have basically the same vuln
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#36Earlier quoted context omitted.
To be fair, this particular issue wouldn't have happened in C, Python, Forth, Zig, or a host of other languages. String-based weirdness is something of a JS issue.
This particular issue looks to be pretty uniquely a javascript problem. I don't even think hyper flexible languages like Ruby would ultimately experience this sort of problem.
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#37Earlier quoted context omitted.
This is like some kind of psy-op to get people to hate rust.
Sure. Then good companies will be able to filter out people by only hiring those who know Rust.
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#38Earlier quoted context omitted.
Sure. Then good companies will be able to filter out people by only hiring those who know Rust.
I don’t think this kind of sanctimoniousness has much of a success rate as a marketing approach.
Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#39Re: Property-Based Testing Caught a Security Bug I Never Would Have Found
#40Earlier quoted context omitted.
You forgot 0, -1, null, "1".
Since I work in a strongly typed languages the last two will fail to compile and are thus not worth the bother - those who don't have that luxury of course need to test the edge cases that apply to them. The first are maybe, in my experience they are rarely a problem, but we need to go from the abstract to the particular algorithm before we can have a discussion on if they are potentially a problem or not.
More than that and you'll need nightly for now: https://docs.rs/ranged_integers/latest/ranged_integers/