18.10.2016 Views

Drupal 7 Module Development

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Security<br />

Throughout this book, we have repeatedly discussed the question of security.<br />

What makes good security practice? How do we make code more secure? How do<br />

we protect against common attacks? That's because security is not a feature to be<br />

bolted into a program. It is part and parcel of the development process itself.<br />

Nonetheless, because it is such an important subject this appendix will give an<br />

overview of the tools <strong>Drupal</strong> offers to help make code more secure, and the sorts<br />

of things to think about when writing code to ensure that our code is as secure as<br />

possible. It is by no means exhaustive; many books have been written exclusively on<br />

the subject of security. However, it should lay a strong foundation for approaching<br />

code writing in a secure fashion.<br />

Thinking securely<br />

Security is a process. Specifically, it is a development process. The most important<br />

aspect of security is how we approach the code that we are going to write. We need<br />

to "think securely" in order to write robust code. Although there are many aspects<br />

to thinking securely, it can be summed up as "think paranoid".<br />

The vast majority of input into our system is going to be sane and what we expect,<br />

not dangerous. However, there will always be that last 1% that is not at all what we<br />

expect. It could be someone deliberately trying to break into our website. It could be<br />

a spambot trying to find vulnerabilities so that it can turn our site into a billboard for<br />

fake proscription drugs. Alternatively, it could just be an honest user who entered<br />

input that we didn't anticipate and account for. All of these things will happen<br />

at some point during the life of a website or web application, and the best way to<br />

protect against them is to assume that any input is a suspected attack until we can<br />

verify otherwise.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!