r/programming • u/sarciszewski • Nov 25 '15
Don't use the OWASP PHPSec Crypto Library
https://gist.github.com/paragonie-scott/91893fdb18ee4d1a1b95
38
Upvotes
r/programming • u/sarciszewski • Nov 25 '15
View all comments
Show parent comment
1
u/terrkerr Nov 25 '15
As I said:
I've seen them still. Ones written this year even.
The fact PHP has only really seen a drop in this problem thanks to external factors like 3rd party frameworks and trends is a negative thing for PHP anyway. The use of NAT and firewalled routers helped make it a lot harder to spread many kinds of infection. That's not a point in favour of the security creds of, say, SMB on Windows. That's a good system helping guard an inferior one.
PHP not only allows but is clearly designed to allow arbitrary HTML to be inlined. That's great for small snippets, but abysmal for anything non-trivial and the fact it's so easy and obviously there by design is why it's so easy for people to fail to include CSRF tokens or whatever.
In a language/framework that encourages modelling the HTML generation thing the same way as other programming problems it's so much easier to architect things such that the beginner or someone that hasn't enough coffee today can't readily muck up.
It's not a coincidence that, say, Laravel totally eschews a huge amount of the design of base PHP. It's namespaced, it uses exception, it uses a limited templating engine, it has helpers to generate things like CSRF tokens and it sanitizes most things without you needing to think too hard about it. It doesn't want you to touch a lot of the PHP stdlib and super-globals and it doesn't want you to do inline PHP.