Question: ( b ) An application SQL queries in the following manner: query = SELECT * FROM users WHERE id = + userInput Which technique

(b) An application SQL queries in the following manner:
query = "SELECT * FROM users WHERE id="+ userInput
Which technique would best mitigate the risk of SQL injection?
i) Use regular expressions to validate userInput.
ii) Encode userInput to ensure it does not contain SQL meta-characters.
iii) Use parameterized queries or prepared statements.
iv) Escape all single quotes in userInput.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!