prevent-sql-injection
Installation
SKILL.md
Prevent SQL injection: the value, the identifier, and the context it runs under
Parameterising a value is the familiar part. Confirm it in a sentence and spend the answer on what a parameter cannot reach: an identifier, the type of a runtime-chosen sort expression, the permissions a dynamic batch runs under, and an encrypted column. The behavior below is Azure SQL Database's.
1. A parameter is a value, a concatenation is code, and one query shows the difference
Do not assert this. Run it. Both statements get the same string.
CREATE TABLE dbo.Users (id int NOT NULL PRIMARY KEY, name nvarchar(50) NOT NULL);
INSERT INTO dbo.Users (id, name) VALUES (1, N'ann'), (2, N'bob');
DECLARE @input nvarchar(100) = N'ann'' OR 1=1--';