So join me on this fine Sunday evening as I wax lyrical about writing code that is easy to audit.
The goal of security driven design is to minimize the impact of mistakes.
* Fail fast, Fail often
* Never assume good intentions
* Don't over decompose security sensitive code.
Even if the isolated code is perfect, the potential for integration misuse is high.
Code can be secure, and also fragile.
That is a vital thing to remember.
To many systems try to recover from errors, I've seen some systems dedicate entire packages to making bad input safe, when the correct thing to do would be to shutdown that entire flow.
Most if statements in a security sensitive function should default "return false"
Anyone can engineer a bug bounty that demonstrates minimal exploitable flaws.
Not to mention the verbosity of java math.
If your auditor is spending time trying to work out ground layer things like "what cryptographic parameters are you using" things are bad.
And by well-tested I don't mean "we tested it works", I mean "here is our library of bad inputs"
github.com/dalek-cryptogr…
The latter is far easier to audit.