From the course: Secure Coding in Java

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Refactor Java code susceptible to injection attacks

Challenge: Refactor Java code susceptible to injection attacks - Java Tutorial

From the course: Secure Coding in Java

Start my 1-month free trial

Challenge: Refactor Java code susceptible to injection attacks

(upbeat music) - [Instructor] So now we're ready for our first code challenge for this course. You're going to be working on some code that is ripe with the SQL injection, and you're going to remediate that code injection. Let's go over a bit more detail for our challenge exercise. First of all, I've written some code for you and put it in the exercise files for this video. Input the code from this chapter into your IDE. Now if you look at the code it's pretty simple and we're going to do it here in a moment, but there are a couple of classes and a test class. Open the test class and run it in your IDE. You will see that two tests exist but only one passes. This is actually a good strategy that we will talk about more when I show my solution to this exercise. So let's take a look at the code here real quick. Okay, I've loaded up the test class and there's a couple things here that I want you to note. So first of all on…

Contents