Security Architecture

A function triggered by messages from a queue builds a database query from fields in each message. A review finds an injection risk. Which control addresses it best?

Show the answer

Correct answerB. Validating event fields and using parameterized database queries

AWhy not this: A WAF inspects HTTP requests; queue messages bypass it, so it cannot stop this injection.

BWhy this is right: Validation and parameterized queries stop untrusted event data from altering the query.

CWhy not this: Encryption at rest protects stored messages but does not stop malicious message content.

DWhy not this: Subnet isolation limits network reach but does not sanitize input handled by the code.

Event data is untrusted input, so the function must validate it and use parameterized queries. A WAF only inspects HTTP traffic and never sees queue-triggered events, which is why it is the tempting but wrong choice.