Question 700
A generated stored procedure concatenates an API parameter into EXEC dynamic SQL. The team proposes this approach: Replace unsafe concatenation with parameterized sp_executesql and allowlisted identifiers. Which technical principle supports this approach?
Explanation
Correct Answer
AI-generated code can introduce SQL injection and must use reviewed parameterization. Parameterization alone does not protect overprivileged stored procedures.
Incorrect Answers
That explanation assumes the wrong technical cause: AI-origin SQL must undergo explicit parameterization and malicious-input tests independently of compilation.
The proposed mechanism is not sufficient because Use parameter binding for values and fixed allowlists for identifiers and execution context.
This inference does not follow from the SQL or service behavior: Authorization and execution privilege are separate from parameter injection and need negative-role tests. The stated assumption would still allow the documented defect to occur, so it cannot explain why the proposed fix works.