© Ben Edmunds 2016

Ben Edmunds, Securing PHP Apps, 10.1007/978-1-4842-2120-4_5

5. Safe Defaults, Cross-Site Scripting, and Other Popular Hacks

Ben Edmunds

(1)Brooklyn, New York, USA

No story this time. This chapter is a catch-all for a couple other attacks you need to protect against, so there isn’t an overarching narrative. Try to contain your disappointment.

Never Trust Yourself: Use Safe Defaults

One of the core concepts of a secure system is safe defaults. Whenever possible (and it’s usually possible), you should define variables, properties, and so forth early with a safe default.

A safe default usually means a NULL, empty, or FALSE state. When determining logic flow, the default should always be a failure. For example, in the authentication ...

Get Securing PHP Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.