Understand Your Application’s Data Flow

Before you can protect user information stored in your application, you have to know what kind of data you even have and then figure out which data needs protecting. The illustration shows the main components involved in data transfer from the user to your server.

images/data-flow.png

The data flow begins with the client application asking the user to provide some data. Once the user enters something (or does something in the application), the browser sends the collected information over the network to the server. The server validates the data it received, performs some magic, and pushes it into storage for later use.

Very straightforward, right? But attackers can target several points in the data flow to intercept some of that information flowing between the user and the server. The illustration shows some of the possible ways attackers target the data flow.

images/data-flow-attack.png

First, attackers can use XSS (cross-site scripting) attacks against the client application. Attackers who can access the user’s system can also target the browser’s caching system. Be wary of XSS attacks, which we covered back in Chapter 11, Fight Cross-Site Scripts.

Next, look at how data is being transferred from the client to the server, because it can be attacked just like any other data transfer. Here’s where our HTTPS setup, which we covered in Use TLS and SSL to Secure Your Connections pays off. There are also some nuances to be aware of when the data reaches the server.

Finally, think about storage. You’ve already learned how to protect the application from injection attacks. But it takes only one mistake to cost you the whole database holding all the information. You can’t hash user data the way you hash passwords because the application needs to be able to work with the data. So you encrypt the data while it’s in storage and decrypt the information when you need it.

Keep in mind where the weak spots can be found in your data flow while we look at how you can add layers of protection around each point.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.140.206