13.09.2016 Views

PHP and MySQL Web Development 4th Ed-tqw-_darksiderg

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

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

362 Chapter 16 <strong>Web</strong> Application Security<br />

with the appropriate balance between the need to protect ourselves <strong>and</strong> the need to<br />

actually do business <strong>and</strong> have a working application.<br />

Start with the Right Mindset<br />

Security is not a feature.When you are writing a web application <strong>and</strong> deciding the list of<br />

features that you want to include, security is not something that you casually include in<br />

the list <strong>and</strong> assign a developer to work on for a couple of days. It must be constantly part<br />

of the core design of the application, <strong>and</strong> it is a never-ending effort, even after the application<br />

is deployed <strong>and</strong> development has slowed, if not outright ceased.<br />

By thinking of <strong>and</strong> planning for, right from the beginning, the various ways in which<br />

our system could be abused or through which attackers might try to compromise it, we<br />

can design our code to reduce the likelihood of these problems occurring.This also saves<br />

us having to try to retrofit everything later on when we finally do turn our attention to<br />

the problem (when we are almost certain to miss many more potential problems).<br />

Balancing Security <strong>and</strong> Usability<br />

One of the greatest concerns we have when designing a user system is the users’ passwords.<br />

Users will often choose passwords that are not particularly difficult to crack with<br />

software, especially when they use words readily available in dictionaries.We would like a<br />

way to reduce the risk of a user’s password being guessed <strong>and</strong> our system being compromised<br />

through this.<br />

One possible solution is to require each user to go through four login dialogs, each<br />

with a separate password.We can also require that the user change these four passwords<br />

at least once a month <strong>and</strong> make sure they never use a password they have used in the<br />

past.This would make our system much more secure, <strong>and</strong> crackers would have to spend<br />

significantly more time getting through the login process <strong>and</strong> into the compromised system.<br />

Unfortunately, our system would be so secure that nobody would bother to use it—at<br />

some point they would decide that it was simply not worth it.This illustrates the point<br />

that just as it is important to worry about security, it is also important to worry about<br />

how this affects usability. An easy-to-use system with little security might prove attractive<br />

to users, but will also result in a higher probability of security related problems <strong>and</strong> possible<br />

business interruptions. Similarly, a system with security that is so robust as to be<br />

borderline unusable will attract few users <strong>and</strong> also very negatively affect our business.<br />

As web application designers, we must look for ways to improve our security without<br />

disproportionately affecting the usability of the system. As with all things related to the<br />

user interface, there are no hard <strong>and</strong> fast rules to follow, so instead we must rely on some<br />

personal judgment, usability testing, <strong>and</strong> focus groups to see how users react to our prototypes<br />

<strong>and</strong> designs.

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

Saved successfully!

Ooh no, something went wrong!