Question 1
Topic: Securing IoT Portals
Skill tested: Mitigates injection and cross-site scripting risks in an IoT web portal.
A building-automation company operates a web portal that lets facility managers search device names and review sensor status. A security review finds that the search value is inserted into a database query through string concatenation, while device labels are rendered in the browser without context-appropriate encoding. The portal must continue supporting flexible searches, and replacing its database is out of scope. Which remediation best addresses both findings without relying on input filtering as the primary defense?
Parameterized queries keep user-supplied search values separate from SQL instructions, preventing those values from changing query structure while preserving flexible search. Context-appropriate output encoding prevents device labels from being interpreted as executable markup or script when rendered. A web application firewall can reduce exposure but does not correct unsafe application logic, and blocking characters can be bypassed or break legitimate searches. Transport encryption and encrypted storage do not prevent SQL injection or cross-site scripting; disabling caching is unrelated to either flaw.