336. PII, Compliance, Privacy, and Data Collection - What Should I Do?
Read full transcript 17 segments
-
Have you heard the phrase personally identifiable information or PII? I hope so. As a developer, we work with sensitive data. Last week we talked about application security and how it's everyone's job. But part of securing an application is knowing what is sensitive, what needs to be protected. PII is a part of that. Regardless of where you operate in the world, there are laws that you need to comply with in regards to your data. What you collect, where you store it, how long you keep it, who you give it to, and more. What some people don't know is that often the laws of other countries apply to them as well. So in this episode of Dev Questions, we're going to talk about data collection and how to think about collecting secure sensitive data. Software development is more than just writing code. So let's talk about the rest of it. Specifically, let's talk about collecting and securing data.
-
Now I live and operate in a business in the US. That means I have to comply with the CAN-SPAM Act that says I cannot send unsolicited marketing emails to people. Then you sign up to receive them in some way, and when I do send those emails, I have to include an unsubscribe link so you can leave the list at any time. I also have to comply with the FTC's endorsement guides, which make sure I disclose affiliate partnerships, sponsorships, and more. If I experience a data breach, I also have to report that data in accordance with state privacy laws. But that's not all I have to comply with. Since I have customers in the EU, I have to collect VAT, which is a tax essentially if you're in the US and don't know what that is, uh or it's called a VAT. Um and I have to report that quarterly to every country where I collected it from their citizens. I also have to comply the GDPR, which governs what data I can collect, how I store the data, and how I have to delete that data when a person requests it. Of course, there's a lot more to all of these laws that I'm I'm mentioning here, but these are kind of the summaries. So, there are many other laws that I and other businesses have to comply with regardless of where we operate.
-
Now, instead of spending time mapping out what each law requires and who it applies to, let's focus on the basic common sense approach to data collection and retention. And this will kind of help with all these laws to an extent, but still, talk to a lawyer, talk to people, make sure you're fully in compliant with all laws and regulations of where you operate and who you operate with. Again, just because you're in one area doesn't mean other countries don't have laws that apply to you. Okay, so again, not a lawyer, right? Not legal advice. But okay, number one for a common sense approach is don't collect data you don't absolutely need. So, I actually had a a problem with this not that long ago, a few years ago. I can't cross issue where I use Teachable to store to have all my host all my courses. And they also do payments. So you can you can buy the course through Teachable and then have the course. It's it's a really simple system, right?
-
Teachable is kind of an all-in-one product. And it has been a really great course host for me. So I use their payment system. The problem was is their checkout process. First of all, their checkout process was already a a full page process. I like the pop-up, you know, very very quick checkout process. That wasn't it. But then they started insisting that you give me all your information, meaning all your address information. Well, it's a digital process, right? I don't need to know where you live. Now, there are some regulations that say I have to verify where you live, but even that is not you telling me where you live. It's about things like where's your IP address located, etc., because again, those VAT that I need to apply in certain areas, well, I need to know from two different sources where you actually live to to add that on, which by the way, if you ever see my pricing and it's different than what I say, it's because of VAT usually.
-
Okay, so going back to my story, I was using Teachable for the checkout process and they did collect VAT when necessary, etc., but they started insisting on capturing your full address, information that I didn't need to know. Information I didn't need to capture, they didn't need to capture. Now, if we had been, you know, sending out merch or sending out physical goods, absolutely we have to capture that, but I didn't need to capture your full address. And so I talked to Teachable, I said, hey, can I turn this off? And the answer was, no, we're going to capture it. It's it's good to have anyway. And my response was, no, it's not. And so I actually moved off of Teachable's payment processor over to FastSpring and I said, hey, I want to limit how much information I ask for. And they've been very good about only requiring what's absolutely necessary in order to capture the information I need to do the the purchase process. Sometimes credit cards might ask you for address information, in which case I have to capture it, but for the most part, if I don't, I won't because I don't want that information. I don't want my payment processor to have that information. Now, I think it's really cool to capture where everybody's located in order to create a map and says, hey, here's where all my students are, but that means capturing information that I really don't want to have access
-
to. So I don't collect it. And maybe at some point I will on a voluntary voluntary basis with some anonymity around it, but I don't love that. So, don' capture data you don't absolutely need. Too often, companies get into this pack-rat mode where like, well, we might need it, and so they capture the data. And sometimes that's fine. You know, um, what the date and time was might not always be necessary for when a person hit your website. That might not be really relevant information, but it doesn't hurt anything. But if you're starting to capture information about the user, like their email address and their cell phone number and other things that you don't absolutely need, be very careful of that, okay? Uh, try not to. Just don't capture it because you can't If you don't capture it, you can't lose it. That's number one. Uh, number two, limit the locations that have sensitive data.
-
Um, what I mean by this is that you don't want to, um, have data that is sensitive go into your your developer's database. We talked about this last week. We talked about the idea that, you know, if you're creating a developer database, don't leak sensitive information into that database. Well, this is the same thing essentially. Limit where that sensitive data goes. And this might also mean that you have different databases for different purposes. So, you might have a I think we'll talk about that later. We might have an authentication database versus a uh, a data database. And those might be separate databases so you have different permissions that really restrict who has access to what. So, you can have an admin rights to the data, but not admin rights to the sensitive data. Something like that. Uh, limit who has access, limit where that data goes. Um, number three, encrypt data during transmission and at rest.
-
There's tools to do this. Be very cognizant of where your data is, how it's moving through your systems, and if it is encrypted. Encrypt all your data. Don't just leave sensitive data laying around where it might be visible easily. Just encrypt it. Number four, don't pull um pull data a user doesn't have access to into their client. So this is a big one for for me. I see people saying, well, um I want to do like a you know a data grid and I want to have you know this list of of all the data and we'll just filter it based upon the user. Well, the problem is is if you bring all that data down to the client, well, they can read it, especially if you're using a front end framework. If you're using a like PHP or um MVC or thing like that where it's a server side, then sure all that data lives in the server not and nothing goes to the client except what the client needs. But if you're bringing down the the data to the client you're using like React or Vue or Angular or Blazor Web Assembly, like these are client side frameworks where all the data is accessible if you know how to get access to it. You can go to the console and start start typing JavaScript commands and pull the data out that your UI isn't showing.
-
And all of a sudden you're leaking data that shouldn't be leaked. And this might not be what you'd consider sensitive data, but probably is. Because okay, sure you're not you know having credit card numbers and social security numbers or other you know super sensitive data, but you are listing email addresses and names and and maybe phone numbers. Like that's still sensitive information. Um another thing is if you're storing that in session storage, well, guess what? Again, browser tools have full access to that. So don't do that. Don't pull data down to the client that the user doesn't have access to. Okay, [snorts] number five, restrict access to certain data um to limited logins. So [snorts] this is one that again we talked a little bit about last week when it came to connection string we're saying, hey, limit your connection string, login permissions. Um, but we want to take it even further here, which is you want to make sure that you have very limited access to certain things and uh make sure that they don't have access to go around those things.
-
I really like to use Dapper and stored procedures and people go, oh, they're so old and whatever. Here's the thing. I can limit my login to the SQL server to only have access to execute stored procedures. It can't list what tables are in the database. It can't access the tables. It can't access anything other than the stored procedures I tell it it can access. Which means that limited restriction means they can't get around my systems. Again, we talked last week about defense in depth. So restricting access to certain data to limited logins. This is why that separate database is so valuable for authentication data or for really sensitive data, maybe uh you know, phone numbers are are kind of sensitive. I mean, they're sensitive, but uh maybe, you know, social security numbers or credit card numbers, things you probably shouldn't be storing at all. But if you have to, separate database, which means that even if you give a person admin access to one database, they don't have access to that sensitive data.
-
So restricting data access to um means to certain data and making sure that only limited logins have access to the data is really important. Um we already talked about talked about this, but uh number six, keep a separate database. So uh authentication database, social security number, credit card info, other thing that, you know, other things that are really sensitive that you really shouldn't give anybody access to should be in a separate database. You might say, wow, that's a lot of overhead. You can't talk about a lot of overhead and then say we want microservices. Because a microservice is one database per microservice. So no, it's not too much overhead to have a a second database. That's not a big deal. Uh so have a second database. Put up some some boundaries and store as much of that sensitive data in there as possible. If you can, put the rest of the sensitive data in there. Put the rest of the personally identifiable information in there. Um, name, address, those type of things can go in there and you refer to that person by their ID number everywhere else in the database. That way it's very easy to disconnect and and keep those walls high.
-
[snorts] Number seven. Build a system for scrubbing sensitive data for a user and then test it. Again, this is one of the EU's uh regulations that says a user has the right to their own data and has the right to be forgotten. So I've had users that that contact me and say, hey, I don't want to be remembered at [clears throat] all in any of your systems. And in fact, when we get the email from uh our client that that handles that that process, they say, and now we're deleting even this email. And when I'm done deleting the data for that user, I then delete the email that that initiated that. Like the entire track is gone. The entire trace of that user needs to be gone. So build a system for scrubbing that and then test it. Make sure it actually gets rid of all the information that user. Don't forget the backups because backups also need modified to get rid of that data. So be very careful about set up a process, an automated process for scrubbing that information.
-
[snorts] Which also means that if a user ever asks for their information and say, hey, what do you what information do you have on me? You could also give them that information as well if you wanted to uh and if it's required. [snorts] Number eight. Do not include sensitive data in reports if at all possible. Just use a record ID. Um, don't you don't have to have the the name, you don't have to have the the uh address information, you don't have phone number, email email address. Like all that stuff doesn't have to be included unless it's absolutely necessary. Why do you have to have that in a report? Is it actually necessary or is it just because we have the data we do it? So be very careful that if at all possible just just include the ID instead of the information that's that's personally identifiable that is sensitive or otherwise secure. Um this also comes down to if you if you were to capture a credit card information again you should not be use a credit card processor which doesn't doesn't allow you to have that data at all which is awesome. But if you were to capture that information you should never have that go to a report as full data. You should only ever send let's say the last four digits and have all the rest be dashes but that should come from the server. Not go to the go to the report and then have the report mask it.
-
No no no. Have it come from the server that way so there's no way it can be lost. Number nine, limit what data a user sees even if they have access to it. What I mean by this is again the grid is the is the the bane of my existence really. As a as a developer, as a consultant, everyone wanting to have a grid. Give me a grid, give me all the data. Well the problem is first of all that is resource intensive in a lot of ways. If you bring down a thousand records that's a that's a tiny grid usually. Bring down a thousand records. Well how many records is the user actually going to see? Very few. How are they actually going to open up and do something with? Even less. So why are we showing them why are we downloading this data and showing them a thousand records for them to use three? Right? Why are we doing all this work and you know taxing the system and transmitting sensitive data and all the rest for them to pick up three? We we have them do most of the work on the client and have a filter go up to the server and give them just what they need, etc. Okay, off my soap box a little bit. But um what this also means is that you're you're transmitting personally identifiable information potentially down to the user. Maybe you want to see, you know, give me all the the list of all of my students in the classroom and it it downloads the the
-
list of all my students. But that would be probably name and we probably also have address and cell phone and email address. Do we need to show that in the grid? No, probably not. Because is that what the user is actually looking through when they're looking through the grid to try and find who to find? No. So only show what you need to in the grid. If you really need to show name, then show name. But that's it. And then if they need the additional information, they can expand that record or or call out for that additional details for that one person, not for everybody in the class or everybody in the university or whatever. So limit what that user sees even if they have access to it. Um number 10, keep the personally identifiable information out of logs. That's just I mean it it's both obvious but also something that happens way too often where you you know, you capture an exception and you just throw the whole thing and all the data into the logs.
-
Not a good idea. Okay? So try whenever possible to scrub that information before it hits your log server. So just keep it out of the logs. Again, remember if that user has the right to be forgotten and they ask to do so, you should have to go into the logs and make sure they're not in the logs either, which means if they're if you're not capturing information anyway, it's not a problem. You can go, hey, there's nothing there. Therefore, no reason to go in and look. You should still verify, but um keep PII out of logs. Okay. So protecting the data your users give you and limiting you capture is going to build a a safer system that better protects your company. It better protects your application and it better protects your users, which is really important, especially now with more and more companies having data breaches, more and more companies finding out they have security vulnerabilities.
-
It's it's really important that you have good security, that's what we talked about last week, but then also that you're not capturing too much information or you're not storing information too long that's of a sensitive nature. As much as possible, if you don't need it, don't keep it. Thanks for listening and as always, I am Tim Corey. >> [music]
No summary available yet.
View original episode ↗