Question 420
A tenant administration tool builds a query with a user-supplied text filter and currently concatenates it into SQL. The team implemented this change: Parameterize values and allowlist unavoidable object identifiers. Which result would best confirm the change worked?
Explanation
Correct Answer
Inputs containing quotes remain data and cannot alter SQL structure. Sp_executesql parameters separate user values from the SQL text and reduce injection risk. Parameterization does not automatically protect dynamic table names.
Incorrect Answers
That observation could pass while the problem persists: Parameter binding separates data from SQL syntax; identifiers require a vetted allowlist.
This acceptance test measures the wrong outcome: Object identifiers cannot be parameterized as values; restrict to approved names and quote appropriately.
The suggested success signal is inadequate because Injection prevention and least-privilege access are different boundaries; enforce both. The suggested measurement would appear successful even in a reproducible case where the original failure remains.