CS FundamentalsHardProduct-company security interview
How many of these defend against SQL injection in a login query: (1) parameterised queries / prepared statements, (2) escaping quotes by hand with string replace, (3) least-privilege database accounts, (4) hiding the database error messages from users, (5) allow-list validation of input such as a numeric id?
- A. 1
- B. 2
- C. 4
- D. 3
Correct answer: D. 3
Parameterisation is the primary defence; least privilege limits the damage; allow-list validation narrows the input. Hand-escaping is fragile and bypassable, and hiding errors only slows an attacker down without fixing the hole.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A document-editor framework defines an abstract Application class with a method newDocument() that calls createDocument(); each concrete…
- An object adapter and a class adapter both make class Legacy fit interface Target. Which statement is correct?
- Both Facade and Mediator sit between groups of objects. What is the essential difference?
- A Customer may or may not have a discount policy. Instead of writing if policy is not None: total = policy.apply(total) everywhere, the…
- Which form of dependency injection makes required dependencies explicit and allows the object to be immutable and fully initialised as…
- A message broker delivers each message at least once, so consumers sometimes see duplicates (for example after a crash before an ack). A…