Latest / CyberSecurity Summary / Testing and Securing Android Studio Applications
Transcript
- 0:00Speaker 1: Hey everyone, and welcome back to the Deep Dive. Today,
- 0:02Speaker 1: we're diving headfirst into the world of Android app security.
- 0:06Speaker 1: Oo exciting it is, right, We've got these excerpts from
- 0:10Speaker 1: Testing and Securing Androids Studio Applications, so nice, and we're
- 0:13Speaker 1: going to break it down figure out how to make
- 0:16Speaker 1: sure that your Android apps are as secure as fort Knox.
- 0:19Speaker 1: A mighty task, it is, but I think we can
- 0:22Speaker 1: do it. You ready to get into it?
- 0:23Speaker 2: Yeah, let's do it all right.
- 0:25Speaker 1: So the book actually kicks off by talking about some
- 0:27Speaker 1: core security concepts kind of like security one oh one. Yeah,
- 0:31Speaker 1: that apply to all software, not just Android. Yeah, so
- 0:34Speaker 1: things like access control, encryption, authentication.
- 0:37Speaker 2: Yeah, the basics, the basics.
- 0:39Speaker 1: It's interesting they emphasize this before even getting into like
- 0:42Speaker 1: Android specifics.
- 0:44Speaker 2: Yeah, it's really important to understand these kind of foundational
- 0:46Speaker 2: pieces of security before you can even start to think
- 0:49Speaker 2: about building a secure app. Yeah, because you know, we
- 0:52Speaker 2: all have passwords, but what does it really mean for
- 0:55Speaker 2: a password to be secure? What does it actually mean
- 0:58Speaker 2: to authenticate yourself? How can you prove that you are
- 1:02Speaker 2: who you say you are?
- 1:03Speaker 1: Right?
- 1:03Speaker 2: So those are the building blocks totally, and.
- 1:06Speaker 1: The book actually quotes this guy, Boris Buyser, who's a
- 1:09Speaker 1: software testing expert, and he says bugs lurk in corners
- 1:13Speaker 1: and congregate at boundaries.
- 1:15Speaker 2: Ooh, that's good.
- 1:17Speaker 1: I feel like that's setting the stage for a whole
- 1:19Speaker 1: lot of testing. It is.
- 1:20Speaker 2: It means we to test everything, yeah, because those bugs
- 1:23Speaker 2: are going to be hiden.
- 1:24Speaker 1: Yeah. All right, so we've talked about some of the
- 1:26Speaker 1: foundational concepts. Now let's actually talk about androids specifically.
- 1:30Speaker 2: Okay.
- 1:31Speaker 1: So Android seems to have like a multi layered approach
- 1:33Speaker 1: to security.
- 1:34Speaker 2: Yeah, it does.
- 1:35Speaker 1: The book describes it as like an Onion architecture, oh,
- 1:39Speaker 1: the Onion, yeah, which I thought was interesting.
- 1:41Speaker 2: Yeah. It's a good way to think about it, because
- 1:43Speaker 2: each layer adds an extra level of protection.
- 1:46Speaker 1: Okay.
- 1:47Speaker 2: So at the very core, you have the Linux kernel,
- 1:50Speaker 2: which provides some of the most fundamental security features. Okay,
- 1:54Speaker 2: and then on top of that you have things like
- 1:56Speaker 2: app sandboxing, permissions, application signing.
- 1:59Speaker 1: Okay, So let's break those down a little bit. What
- 2:01Speaker 1: is sandboxing?
- 2:02Speaker 2: Okay? So sandboxing basically means that each app lives in
- 2:06Speaker 2: its own little isolated environment okay, and this prevents apps
- 2:11Speaker 2: from interfering with each other or accessing data that they
- 2:14Speaker 2: shouldn't have access to.
- 2:15Speaker 1: Oh, so it's all about isolation.
- 2:16Speaker 2: Exactly, It's all about isolation.
- 2:18Speaker 1: Got it? Okay? What about permissions? Permissions those pop up
- 2:21Speaker 1: every time I install an app, Yes.
- 2:23Speaker 2: Every time on my phone. So permissions are how Android
- 2:26Speaker 2: controls what an app can and can't do.
- 2:30Speaker 1: Okay.
- 2:30Speaker 2: So if an app wants to access your camera, it
- 2:33Speaker 2: has to ask you for permission.
- 2:34Speaker 1: First, okay. So it's like a check and balance.
- 2:37Speaker 2: Exactly, It's a checks and balance the system.
- 2:38Speaker 1: Gotcha, okay? And then what about application signing?
- 2:42Speaker 2: Oh, application signing is how Android knows that an app
- 2:46Speaker 2: is legitimate and that it hasn't been campered with. So
- 2:50Speaker 2: every app that's published to the play Store has to
- 2:53Speaker 2: be digitally signed, okay. And that's how your phone knows okay,
- 2:57Speaker 2: I can trust this app.
- 2:58Speaker 1: So it's basically like a guarantee that it can from,
- 3:00Speaker 1: like a trusted source, a trust.
- 3:02Speaker 2: It source, no one's messed with it.
- 3:03Speaker 1: Right, Okay? Cool. So it seems like Android has a
- 3:06Speaker 1: lot of built in security features. It does, but the
- 3:08Speaker 1: book also talks about how smartphones are constantly connected and
- 3:12Speaker 1: that kind of creates more opportunities for attacks.
- 3:15Speaker 2: Right. Our phones are basically mini computers in our pockets.
- 3:19Speaker 2: They're connected to the internet almost all the time. Yeah,
- 3:22Speaker 2: so that just gives attackers more ways to try to
- 3:24Speaker 2: get in.
- 3:24Speaker 1: Okay. So let's say you are a developer, Okay, you're
- 3:27Speaker 1: building an Android app. What are some of the common
- 3:31Speaker 1: vulnerabilities that you need to watch out for.
- 3:34Speaker 2: Well, the book talks about three really big ones. Okay,
- 3:37Speaker 2: input validation, sequel injection, and intense spoofing. Okay, let's start
- 3:42Speaker 2: with input validation. So imagine you have an app that
- 3:45Speaker 2: has a form okay, and it's asking the user for
- 3:49Speaker 2: their email address. Yeah, you need to make sure that
- 3:52Speaker 2: the user is actually entering a valid email address. Oh okay,
- 3:55Speaker 2: and not like trying to sneak in some malicious code
- 3:58Speaker 2: or something.
- 3:58Speaker 1: Is it like a pain to actually validate every single
- 4:01Speaker 1: input it can be that a user could provide.
- 4:04Speaker 2: But it's really important, okay, because without proper input validation,
- 4:08Speaker 2: you're essentially leaving the front door to your app wide open.
- 4:11Speaker 2: An attacker could exploit that to inject some harmful code
- 4:14Speaker 2: or manipulate data to cast all sorts of problems.
- 4:17Speaker 1: Okay, So input validation, that's something that developers really need
- 4:20Speaker 1: to pay attention to absolutely. Okay. What about SQL injection?
- 4:23Speaker 2: So? SQL injection is a classic attack that exploits vulnerabilities
- 4:29Speaker 2: in how an app interacts with a database. So let's
- 4:33Speaker 2: say you have an app that allows users to search
- 4:35Speaker 2: for products in a database. An attacker could craft a
- 4:38Speaker 2: malicious search query. Oh that, instead of returning search results,
- 4:43Speaker 2: ends up deleting data from your database. Oh no, yeah,
- 4:47Speaker 2: so it's a serious threat. Okay, the developers need to
- 4:49Speaker 2: be aware.
- 4:50Speaker 1: Of Okay, but are there ways to prevent it?
- 4:52Speaker 2: Yes, thankfully there are using things like parameterized queries, which
- 4:58Speaker 2: essentially separate the user input from the actual SEQL query itself.
- 5:02Speaker 1: Okay, so it's like creating a barrier.
- 5:04Speaker 2: Exactly, creating a barrier between the user's input and the
- 5:08Speaker 2: sensitive part.
- 5:09Speaker 1: Okay, gotcha, So input validation's sequel injection. Now what about
- 5:13Speaker 1: intense spoofing.
- 5:14Speaker 2: Woh, intense poofing sounds scary, it does?
- 5:18Speaker 1: What is it?
- 5:19Speaker 2: So? Intense spoofing is all about exploiting the way that
- 5:22Speaker 2: Android apps can communicate with each other. Okay, So Android
- 5:25Speaker 2: apps can send messages called intents to request actions or
- 5:30Speaker 2: share information. An attacker can basically create a fake intent
- 5:36Speaker 2: to trick an app into doing something it shouldn't.
- 5:38Speaker 1: So it's like sending like a fake invitation to a party.
- 5:41Speaker 2: Yes, exactly like that.
- 5:43Speaker 1: Okay. So how can developers protect their apps against this?
- 5:47Speaker 2: A couple of key things. One is to always use
- 5:50Speaker 2: explicit intents whenever possible, okay, which means being very specific
- 5:54Speaker 2: about which component should receive that intent. And the other
- 5:57Speaker 2: one is to validate the data that's being received, make
- 6:00Speaker 2: sure it's what you expect and that it hasn't been
- 6:02Speaker 2: tampered with.
- 6:03Speaker 1: Makes sense, all right? So I think we've covered a
- 6:05Speaker 1: lot of ground here. We've talked about some foundational security concepts,
- 6:08Speaker 1: how Android approaches security, and some of the most common vulnerabilities,
- 6:13Speaker 1: the scary stuff. Yeah, but good to know, good to know.
- 6:16Speaker 1: So I feel like we've built a pretty solid foundation here.
- 6:19Speaker 2: We have. The walls are up, the doors are locked.
- 6:21Speaker 1: All right, perfect, Now we need to think about protecting
- 6:23Speaker 1: the data inside the house.
- 6:25Speaker 2: Yes, that's next.
- 6:26Speaker 1: So let's take a quick break and we'll be back
- 6:28Speaker 1: to dive into the world of data privacy.
- 6:31Speaker 2: Sounds good. So we've talked about building this secure house, right,
- 6:35Speaker 2: thank you. Sure the walls are strong and the doors are.
- 6:37Speaker 1: Locked, right, keeping those intruders out.
- 6:39Speaker 2: Now, let's step inside and talk about protecting the valuables,
- 6:42Speaker 2: those precious possessions. Data.
- 6:44Speaker 1: Data privacy. It's such a hot topic these days, and
- 6:48Speaker 1: for good reason. Users are trusting these apps with more
- 6:51Speaker 1: and more of their personal information. Oh yeah, absolutely, So
- 6:54Speaker 1: we really got to make sure we're treating it with care.
- 6:56Speaker 2: Yeah, it's like being a bank. You need to make
- 6:59Speaker 2: sure that you're keeping your customer's money safe.
- 7:02Speaker 1: Right. So the book talks about all the different storage
- 7:04Speaker 1: options available and Android. There's shared preferences, internal storage, external
- 7:09Speaker 1: storage databases, so many ops. It's like a whole storage unit,
- 7:12Speaker 1: it is, and you.
- 7:12Speaker 2: Have to check the right storage unit for the right
- 7:14Speaker 2: thing exactly.
- 7:16Speaker 1: So let's start with shared preferences. I use this all
- 7:18Speaker 1: the time for like user settings or app settings. Yeah,
- 7:22Speaker 1: simple stuff. Are there any security risks with those?
- 7:25Speaker 2: Well, Shared preferences are really convenient for those small bits
- 7:28Speaker 2: of data. Yeah, but they're not the best choice for
- 7:32Speaker 2: sensitive information because by default, the data that's stored and
- 7:36Speaker 2: shared preferences is unencrypted, ah, which means it's basically visible
- 7:40Speaker 2: to anyone who has access to the device.
- 7:42Speaker 1: So, like, if I'm storing a user's password or apike
- 7:46Speaker 1: shared preferences are out of the question.
- 7:48Speaker 2: Definitely, you need a more secure storage option for that.
- 7:51Speaker 1: Okay, So what about internal storage? Is that a step up?
- 7:53Speaker 2: Internal storage is definitely more secure okay, because the data
- 7:56Speaker 2: is stored in your app's private data directory Okay, and
- 8:00Speaker 2: boxed and generally inaccessible to other apps. Gotcha, unless they
- 8:04Speaker 2: have root access to the device.
- 8:06Speaker 1: But what happens if an attacker gets root access?
- 8:09Speaker 2: Well, if an attacker has root access, then it's basically
- 8:11Speaker 2: game over. Oh no, they can access pretty much anything
- 8:14Speaker 2: on the device.
- 8:15Speaker 1: So even with internal storage, it's not a guarantee.
- 8:17Speaker 2: Right, That's why we need encryption.
- 8:19Speaker 1: Okay, So encryption is important no matter where we're storing it. Yes,
- 8:23Speaker 1: what about external storage like an SD card?
- 8:26Speaker 2: So external storage is typically used for data that's not
- 8:30Speaker 2: specific to your app okay, so things like media files
- 8:34Speaker 2: that you want users to be able to share. Yeah,
- 8:36Speaker 2: but it's also the least secure option.
- 8:38Speaker 1: Yeah, it seems like it because.
- 8:39Speaker 2: Anyone can access it. So never store sensitive data on
- 8:44Speaker 2: external storage makes sense?
- 8:46Speaker 1: Now, what about databases?
- 8:47Speaker 2: Databases are great for storing larger amounts of structured data, okay,
- 8:51Speaker 2: and they offer a really good level of security, especially
- 8:53Speaker 2: when you combine them with encryption.
- 8:55Speaker 1: Always got to encrypt. So you keep mentioning encryption, Can
- 8:59Speaker 1: you explain what it is and why it's so important?
- 9:01Speaker 2: Yeah. So encryption is basically scrambling data into an unreadable
- 9:06Speaker 2: format so that anyone who doesn't have the key to
- 9:09Speaker 2: unscramble it just seems gibberish.
- 9:11Speaker 1: So even if someone gets the data, it's useless without
- 9:14Speaker 1: that key.
- 9:15Speaker 2: Exactly.
- 9:16Speaker 1: Okay, cool. Now you mentioned before there's like two types
- 9:19Speaker 1: of encryption, symmetric and asymmetric. Yeah, can you break those down?
- 9:22Speaker 2: Yeah. So symmetric encryption is like having one key that
- 9:26Speaker 2: locks and unlocks the treasure chests. Okay, so anyone who
- 9:29Speaker 2: has that key can access the data, gotcha. Asymmetric encryption
- 9:32Speaker 2: is like having two keys, a public key and a
- 9:35Speaker 2: private key.
- 9:36Speaker 1: Okay.
- 9:37Speaker 2: You use the public key to encrypt the data and
- 9:39Speaker 2: the private key to DECRYPTI.
- 9:40Speaker 1: Gotcha.
- 9:40Speaker 2: So you can give anyone the public key, but only
- 9:43Speaker 2: the person with the private key can actually see the data.
- 9:46Speaker 1: It's like a super secret decoder ring exactly. But even
- 9:50Speaker 1: with encryption, we still have to make sure those keys
- 9:52Speaker 1: are safe.
- 9:53Speaker 2: Right, absolutely. Key management is just as important as encryption itself.
- 9:57Speaker 1: Okay, so what are some best practices for that.
- 10:00Speaker 2: Ideally you want to avoid storing encryption keys directly on
- 10:04Speaker 2: the device, Okay, If possible, you should send them to
- 10:07Speaker 2: a secure server. So keep them somewhere else, Yeah, separate
- 10:10Speaker 2: from the data.
- 10:10Speaker 1: It makes sense. Well, what if, like sending the keys
- 10:12Speaker 1: to a server isn't possible.
- 10:14Speaker 2: Well, another option is to generate the key based on
- 10:18Speaker 2: a password that the user has to enter each time
- 10:21Speaker 2: they start the app. Okay, So the key is never
- 10:23Speaker 2: actually stored anywhere permanently. Tatscha, but it's recreated each time.
- 10:27Speaker 1: Interesting.
- 10:28Speaker 2: Yeah, it's more secure, but it could be a little
- 10:30Speaker 2: bit more inconvenient for the user.
- 10:32Speaker 1: Right. It's always a balancing act, always a balancing act. Okay.
- 10:35Speaker 1: So we've talked about protecting data at rest, Right now
- 10:38Speaker 1: we got to think about protecting data when.
- 10:40Speaker 2: It's moving around, data in transit.
- 10:42Speaker 1: Yeah, exactly. And I think this is where HGTPS comes in.
- 10:46Speaker 2: Yes, HGTTPS is our.
- 10:48Speaker 1: Friend, right. I always see that little pad luck in
- 10:50Speaker 1: the address bar. Yes, I feel like it makes me safe.
- 10:53Speaker 2: It does. It means that the communication between your browser
- 10:58Speaker 2: and the website is encrypted okay, So anyone who's trying
- 11:01Speaker 2: to easdrop can't see what's being sent.
- 11:04Speaker 1: So it's like sending a postcard versus sending a sealed letter,
- 11:07Speaker 1: right exactly. So if I'm building an app that handles
- 11:09Speaker 1: sensitive data, HTTPS is a must.
- 11:12Speaker 2: It is absolutely essential.
- 11:13Speaker 1: So I'm kind of curious, how does HTTPS actually work?
- 11:17Speaker 1: What's going on behind the scenes.
- 11:18Speaker 2: Well, HTTPS is actually a combination of the standard HTTP
- 11:23Speaker 2: protocol okay and something called SSL or TLS.
- 11:27Speaker 1: Okay, SSL, we talked about that before, right, like when
- 11:29Speaker 1: we were talking about certificates.
- 11:30Speaker 2: Yes, you write, SSL stands for Secure Sockets Layer okay,
- 11:34Speaker 2: and TLS is Transport Layer Security okay, which is basically
- 11:37Speaker 2: a newer, more secure version of SSL.
- 11:40Speaker 1: Gotcha.
- 11:41Speaker 2: But they both do essentially the same thing, which is
- 11:43Speaker 2: to encrypt the communication between your app and a server.
- 11:47Speaker 1: So they're like the bodyguards for our data.
- 11:49Speaker 2: Yes, protecting it from those prying eyes.
- 11:52Speaker 1: I like that. So when an app establishes an HTTPTS connection,
- 11:56Speaker 1: what actually happens.
- 11:57Speaker 2: There's a handshake process okay, where the app and the
- 12:01Speaker 2: server agree on which encryption algorithms to use and they
- 12:05Speaker 2: exchange keys.
- 12:06Speaker 1: Okay, So it's like a secret meeting.
- 12:08Speaker 2: Yeah, the secret means.
- 12:09Speaker 1: To make sure they're on the same page, and once
- 12:10Speaker 1: that connection is established, then all the data.
- 12:13Speaker 2: Is encrypto exactly. It's like a secret tunnel.
- 12:15Speaker 1: Okay. Cool. So we talked about certificates before, and I
- 12:18Speaker 1: remember you mentioned a tool called key Tool. Yes, what
- 12:21Speaker 1: is that and how does that play into this?
- 12:23Speaker 2: So digital certificates are like electronic passports that verify the
- 12:28Speaker 2: identity of a website or a server, and key tool
- 12:32Speaker 2: is a tool that you can use to create your
- 12:33Speaker 2: own self signed certificates.
- 12:35Speaker 1: So like, if I'm a developer just getting started, I
- 12:37Speaker 1: can create my own certificates to play with.
- 12:40Speaker 2: Yes, exactly, and the book actually shows you how to
- 12:42Speaker 2: do that. Awesome bo through the command line and through
- 12:45Speaker 2: Android studio.
- 12:46Speaker 1: Okay, handy, But even with HTTPS and certificates, things can
- 12:50Speaker 1: still go wrong, right unfortunately?
- 12:53Speaker 2: Yes, okay. Sometimes you might encounter a certificate that's self signed,
- 12:57Speaker 2: or it was issued by a certificate authority that's not
- 13:00Speaker 2: recognized by Android.
- 13:01Speaker 1: So it's like having a passport from a country that
- 13:04Speaker 1: Android doesn't trust.
- 13:05Speaker 2: Exactly. Yeah, in those cases, you need to explicitly tell
- 13:09Speaker 2: your app to trust that certificate. Oh okay, otherwise you'll
- 13:13Speaker 2: get an error.
- 13:13Speaker 1: So we have to be careful about which certificate.
- 13:16Speaker 2: Sweet, it's very careful. Always double check and make sure
- 13:20Speaker 2: you're handling them correctly.
- 13:21Speaker 1: Awesome advice. Okay, so we've covered a lot today, data
- 13:25Speaker 1: at rest, data in transit, lots of security.
- 13:28Speaker 2: Measures, players upon layers.
- 13:29Speaker 1: But we can't forget about one of the most important
- 13:32Speaker 1: aspects of any secure system, which is authentication. Making sure
- 13:35Speaker 1: we know who's at the door before we let them in.
- 13:38Speaker 2: Yes, we've built the house, we've protected the valuables. Now
- 13:40Speaker 2: we need to hire a good bouncer.
- 13:42Speaker 1: Right, we'll be right back to talk all about authentication.
- 13:47Speaker 1: Welcome back to the deep dive. We've talked about building
- 13:50Speaker 1: a secure foundation, protecting data at rest and in transit,
- 13:54Speaker 1: lots of layers. Now it's time to make sure we've
- 13:56Speaker 1: got a.
- 13:56Speaker 2: Strong front door authentication.
- 13:58Speaker 1: Yes, so let's talk about some of the most common
- 14:01Speaker 1: authentication methods out there.
- 14:03Speaker 2: Right.
- 14:03Speaker 1: The book starts with the classic, the tried and true username.
- 14:06Speaker 2: And password, the old standby.
- 14:08Speaker 1: But I feel like everyone knows this is not the
- 14:10Speaker 1: most secure method.
- 14:11Speaker 2: Yeah, it's definitely got its weaknesses. Passwords can be stolen,
- 14:14Speaker 2: they could be guessed they could be cracked.
- 14:16Speaker 1: People are not great at picking good passwords. So what
- 14:19Speaker 1: are some alternatives that we can use.
- 14:21Speaker 2: Well, one that's becoming increasingly popular is multi factor authentication
- 14:27Speaker 2: or MFA.
- 14:28Speaker 1: Oh yeah, MFA, I've heard of that.
- 14:29Speaker 2: It adds an extra layer of security, okay, by requiring
- 14:32Speaker 2: users to provide more than just their password.
- 14:35Speaker 1: Okay, So it's like having two locks on the door exactly.
- 14:38Speaker 2: Okay, So even if someone gets passed the first lock,
- 14:41Speaker 2: they still need another key to get in.
- 14:43Speaker 1: Gotcha. So MFA usually combines something the user knows, like
- 14:48Speaker 1: a password, with something they have like a physical token
- 14:51Speaker 1: or a code sent to their phone, right, or even
- 14:54Speaker 1: something they are like a fingerprint or a face scan.
- 14:57Speaker 2: Biometrics biometrics, Yeah, those again popular.
- 15:00Speaker 1: Yeah, they're super convenient.
- 15:02Speaker 2: They are convenient.
- 15:02Speaker 1: But are there any downsides to using them?
- 15:05Speaker 2: Yeah? There are some things to consider. For one thing,
- 15:08Speaker 2: biometric data can be harder to change if it's compromised,
- 15:11Speaker 2: that's true, And there are also privacy concerns about how
- 15:14Speaker 2: that data is being collected.
- 15:15Speaker 1: And stored, right, So always important to think about the
- 15:18Speaker 1: trade offs. So the book actually walks through how to
- 15:21Speaker 1: build a basic login system in Android. Okay, what are
- 15:25Speaker 1: some key things developers should be thinking about when they're
- 15:28Speaker 1: building something like that.
- 15:29Speaker 2: Well, first and foremost, security has to be your top priority.
- 15:32Speaker 1: Okay.
- 15:33Speaker 2: Always use HTTPS to protect those credentials as they're being
- 15:37Speaker 2: sent over the network, right, Never ever store passwords in
- 15:41Speaker 2: plain text. Oh yeah, Always hash them using a strong
- 15:44Speaker 2: hashing algorithm hashing.
- 15:46Speaker 1: I remember we talked about that before. That's like a
- 15:47Speaker 1: one way function, right exactly.
- 15:49Speaker 2: You can't unscramble a hashed password, okay, So even if
- 15:52Speaker 2: your database is compromise, the attacker can't actually see the passwords.
- 15:56Speaker 1: Cool. Okay, And of course we already talked about MFA.
- 15:58Speaker 1: That's always a good idea.
- 15:59Speaker 2: Yeah, layers of security.
- 16:01Speaker 1: Now, the book mentions something called account manager. What is that?
- 16:05Speaker 2: So? Account manager is a class in Android okay that
- 16:09Speaker 2: gives you access to the user accounts that are stored
- 16:12Speaker 2: on the device. Okay, so things like Google accounts or
- 16:15Speaker 2: accounts for other online services.
- 16:17Speaker 1: It's like a central hub, gotcha, And you can use
- 16:19Speaker 1: it to request authentication tokens you can, which is really cool.
- 16:23Speaker 2: It is because it means the user doesn't have to
- 16:25Speaker 2: enter their credentials over and over again. It just makes
- 16:27Speaker 2: it smoother, much smoother.
- 16:29Speaker 1: Okay. Cool, All right, so we've talked about authentication. Yeah,
- 16:32Speaker 1: now let's move on to what I think is one
- 16:34Speaker 1: of the most important parts of building secure software.
- 16:39Speaker 2: Oh, I know what's coming.
- 16:40Speaker 1: Testing.
- 16:41Speaker 2: We have to test.
- 16:42Speaker 1: We have to it's so important, it is. So the
- 16:45Speaker 1: book talks about different types of testing unit testing. Yeah,
- 16:50Speaker 1: let's start with UI testing. Why is that so important
- 16:52Speaker 1: for security?
- 16:53Speaker 2: Well? UI testing focuses on how a user interacts with
- 16:56Speaker 2: the app's interface. Remember we were talking about those input
- 17:00Speaker 2: validation vulnerabilities. UI testing can help.
- 17:03Speaker 1: Us catch those, okay, So we can simulate a real
- 17:06Speaker 1: user trying to break the app exactly and see if
- 17:09Speaker 1: our input validation is actually working.
- 17:11Speaker 2: Yes, And Android provides this great framework called UI Automator okay
- 17:17Speaker 2: for creating automated UI tests.
- 17:19Speaker 1: Cool, so we don't have to do it manually.
- 17:20Speaker 2: Well, you can do it manually, but it's much easier
- 17:22Speaker 2: to automate it. And there's also this cool tool called
- 17:25Speaker 2: UI Automator Viewer okay, which lets you inspect the hierarchy
- 17:29Speaker 2: of your.
- 17:30Speaker 1: App's UI so we can see what's going on.
- 17:32Speaker 2: Yeah, you can see all the different elements and how
- 17:34Speaker 2: they're laid out.
- 17:34Speaker 1: Okay, very cool. Now what about unit testing? How is
- 17:38Speaker 1: that different?
- 17:39Speaker 2: So unit testing is about testing individual components of your
- 17:43Speaker 2: code in isolation. Okay, So you're not testing the whole
- 17:46Speaker 2: app at once. Okay, you're testing each little piece.
- 17:49Speaker 1: Gotcha? And Android uses j unit for.
- 17:52Speaker 2: This, yes, Jane. It is the standard framework for unit
- 17:56Speaker 2: testing in Java.
- 17:57Speaker 1: Okay. But does Android have any like special tools or
- 18:00Speaker 1: classes to help with that.
- 18:02Speaker 2: It does. It has a bunch of classes and methods
- 18:04Speaker 2: specifically for testing Android components. Cool, like activities and services.
- 18:09Speaker 1: Oh, very cool. And you mentioned instrumentation before. What's that
- 18:12Speaker 1: all about?
- 18:13Speaker 2: So instrumentation is this really powerful mechanism that lets your
- 18:16Speaker 2: test code interact with the app's life cycle. Okay, So
- 18:21Speaker 2: you can start and stop activities, send simulated user inputs.
- 18:25Speaker 1: So you have a lot of control. You have a
- 18:26Speaker 1: lot of control, okay, awesome, And then j unit provides
- 18:29Speaker 1: those assertions yes, to make sure that the app is doing.
- 18:32Speaker 2: What we expect exactly.
- 18:34Speaker 1: Now, the book also talks about mock objects. What are those?
- 18:37Speaker 2: So mock objects are simulated versions of real objects Okay
- 18:42Speaker 2: that your code might depend on. Okay, So, for example,
- 18:45Speaker 2: if your code interacts with a database. You can create
- 18:49Speaker 2: a mock database RCHA so that your tests don't actually
- 18:52Speaker 2: have to connect to a real database. Makes sense, which
- 18:54Speaker 2: makes your tests run much faster and more reliably.
- 18:57Speaker 1: Right, because we don't want our tests to be dependent
- 19:00Speaker 1: on like the network or something exactly.
- 19:03Speaker 2: And there are some great libraries for creating mock objects.
- 19:06Speaker 1: Cool like Machito.
- 19:07Speaker 2: Machio's a popular one.
- 19:09Speaker 1: Yeah, I've heard of that one. So we've got all
- 19:11Speaker 1: these great tools and techniques for testing we do, but
- 19:13Speaker 1: how do we actually run the tests?
- 19:15Speaker 2: Well, Android Studio has a built in test runner Okay,
- 19:20Speaker 2: that makes it super easy to run your tests and
- 19:22Speaker 2: see the results.
- 19:23Speaker 1: And it works with jone it.
- 19:24Speaker 2: Yes, it integrates seamlessly with June It awesome.
- 19:28Speaker 1: All right, So it seems like androids Studio has everything
- 19:30Speaker 1: we need.
- 19:31Speaker 2: It does, And there are also a bunch of external
- 19:34Speaker 2: tools that you can use if you want.
- 19:35Speaker 1: Oh yeah, the book mentions like spoon and robo Electric.
- 19:39Speaker 2: Yeah, those are great for running your tests across multiple
- 19:41Speaker 2: devices or on your computer without needing an emulator.
- 19:44Speaker 1: Very cool. And then there's Monkey.
- 19:47Speaker 2: Oh. Monkey Monkey is so much fun.
- 19:48Speaker 1: It throws chaos at the app.
- 19:50Speaker 2: It does It basically just simulates random user interactions seas
- 19:54Speaker 2: if it breaks and seas if it breaks.
- 19:56Speaker 1: That's awesome. Wow, this has been quite a deep dive
- 20:00Speaker 1: has into the world of Android app security. We've talked
- 20:03Speaker 1: about so much, so much, building a secure foundation, protecting data,
- 20:07Speaker 1: secure communication, authentication, and of course testing everything. I feel
- 20:12Speaker 1: like I've learned so much.
- 20:13Speaker 2: Me too, And the biggest takeaway for me is that
- 20:16Speaker 2: security is a journey, not a destination.
- 20:19Speaker 1: That's a good way to put it.
- 20:20Speaker 2: It's something you have to be thinking about constantly.
- 20:23Speaker 1: Yeah, and always staying up to date with the latest threats. Awesome. Well,
- 20:26Speaker 1: if anyone wants to learn more about the stuff we've
- 20:28Speaker 1: talked about today, yeah, the book we've been using, Testing
- 20:31Speaker 1: and Securing Android Studio Applications is a great resource.
- 20:35Speaker 2: It is, and there's also a ton of information online
- 20:38Speaker 2: and a really active Android developer community.
- 20:40Speaker 1: So many resources. Awesome. Well, thanks for joining me on
- 20:43Speaker 1: this deep dive.
- 20:44Speaker 2: This was fun.
- 20:45Speaker 1: I had a great time. Until next time, Happy coding everyone,