Consider the following servlet implementing a micro-blog entry public class AddMBlogEntry extends HttpServlet ( Public void doPost(HttpServletRequest
Fantastic news! We've Found the answer you've been seeking!
Question:
Consider the following servlet implementing a micro-blog entry
Transcribed Image Text:
public class AddMBlogEntry extends HttpServlet ( Public void doPost(HttpServletRequest req.. HttpServletResponse res) Throws ServletExceptoin, IOExceptoin ( // user must be logged in to tweet string userid-req.getSession ().getAttribute("userid"); if (userid=null) { Throw new NotLoggedInException ("User must be loggined"); } // insert tweet. MBlogService svc MBlogService.getInstance(): svc.AddEntry(userid, req.getParameter("tweet")); req.setAttribute("MSG", "Tweet submitted"); req.getRequestDispatcher("/accounts.jsp"). forward (req, resp); a. (10) Write code that performs a CSRF attack against this application. b. (20) Demonstrate how to protect the CSRF attack. Your answer should include the following elements: A new AddMBlogEntry class A portion of the html source for submitting micro-blog entry page which contains the protection against CSRF public class AddMBlogEntry extends HttpServlet ( Public void doPost(HttpServletRequest req.. HttpServletResponse res) Throws ServletExceptoin, IOExceptoin ( // user must be logged in to tweet string userid-req.getSession ().getAttribute("userid"); if (userid=null) { Throw new NotLoggedInException ("User must be loggined"); } // insert tweet. MBlogService svc MBlogService.getInstance(): svc.AddEntry(userid, req.getParameter("tweet")); req.setAttribute("MSG", "Tweet submitted"); req.getRequestDispatcher("/accounts.jsp"). forward (req, resp); a. (10) Write code that performs a CSRF attack against this application. b. (20) Demonstrate how to protect the CSRF attack. Your answer should include the following elements: A new AddMBlogEntry class A portion of the html source for submitting micro-blog entry page which contains the protection against CSRF
Expert Answer:
Answer rating: 100% (QA)
AddMBlogEntry class import javaioIOException import javaioNotActive Exception import javaxservletSer... View the full answer
Related Book For
Data Structures and Algorithms in Java
ISBN: 978-1118771334
6th edition
Authors: Michael T. Goodrich, Roberto Tamassia, Michael H. Goldwasser
Posted Date:
Students also viewed these accounting questions
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Consider the following two scenarios: Scenario I: Over the 20112015 period, Micro Systems, Inc., spends $10 million a year to develop patents on new computer hardware manufacturing technology. While...
-
Consider the micro scale apparatus shown in the figure on the next page. This apparatus is designed to deliver a small, steady stream of methanol (MeOH) vapor to a separate device that reforms the...
-
Each team member is to become an expert on one depreciation method to facilitate teammates' understanding of that method. Follow these procedures: a. Each team member is to select an area of...
-
1. Why couldnt this case have been covered by Title VII on the basis of gender? 2. If Enriquezs employment with Health Systems were not terminated would she still have a claim for discrimination?...
-
In Problems 23-30, find the range and the standard deviation (correct to two decimal places). If you do not have a calculator, find the range and the variance. \(103,104,105,106,107 \)
-
Suppose that the adjustable-rate auto loan of Example 16.5 is modified by the provision of CAP that guarantees the borrower that the interest rate to be applied will never exceed \(11 \%\). What is...
-
Mobility Partners makes wheelchairs and other assistive devices. For years it has made the rear wheel assembly for its wheelchairs. A local bicycle manufacturing firm, Trailblazers, Inc., offered to...
-
2. (20 pts) Using the definition of the asymptotic notations, show that a) 6n + n = 0 (n) b) 6n2 # 0(2n)
-
Handy Howard's Incorporated, is a student co-op. Handy Howard uses a perpetual Inventory system, The following transactions (summarized) have been selected for analysis: a. Sold merchandise for cash...
-
Write a Python program that does all the following steps: Read a file located in the same directory as the program named: cs521_5_5_input.txt o Print a clear error message and end the program if the...
-
A growing number of line-level criminal justice practitioners have college degrees. Will the advanced education of these practitioners create greater or less resistance to change from within criminal...
-
8. What would the following code store at address $1018? PO One ORG EQU DS.L DC.W $1000 5 6 P+Q
-
(8 points) The following program is supposed to add two numbers to obtain the sum... but it does not work due to errors. How do you propose to fix the errors in the program so that variable "Result"...
-
Discuss why you think police officers and/or their supervisors may be skeptical of researchers asking questions in and around their department. Why would officers be inclined to cooperate or not...
-
What could be the result of this compilation in Java? public class Xobin { public static void main(String[] args) { int x = 5; x >>= 3; } } System.out.println(x);
-
The issue of the concept of Balance of Power is common and controversial subject matter to all Under Developing countries. Why there is always a gap between people's wish and the execution of...
-
When the concentration of a strong acid is not substantially higher than 1.0 10-7 M, the ionization of water must be taken into account in the calculation of the solution's pH. (a) Derive an...
-
Redo the justification of Proposition 7.2 assuming that the the cost of growing the array from size k to size 2k is 3k cyber-dollars. How much should each push operation be charged to make the...
-
Give a simple adapter that implements the stack ADT while using an instance of a deque for storage.
-
An array A contains n integers taken from the interval [0,4n], with repetitions allowed. Describe an efficient algorithm for determining an integer value k that occurs the most often in A. What is...
-
Using what you learned in this chapter of Dessler Human Resource Management, build on the companys new system by recommending two more specific career development activities the hotel should...
-
Many hotel jobs are inherently dead end; for example, maids, laundry workers, and valets, either have no great aspirations to move up, or are just using these jobs temporarily, for instance, to help...
-
Should other employees (cleaner/spotters, counter people) be put on a similar plan? Why or why not? If so, how exactly?
Study smarter with the SolutionInn App