You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SQL Server migrations should use QUOTENAME when constructing SQL for EXEC #36264
"ALTER TABLE "+Dependencies.SqlGenerationHelper.DelimitIdentifier(tableName,schema)+" DROP CONSTRAINT ["))
.Append(" + ")
.Append(variable)
.Append(" + ']")
A cursory search shows a few more places where QUOTENAME should be used when concatenating dynamic SQL.
Not sure that it's security issue as I'm having difficulty imagining the threat model (a developer intentionally names a constraint with a SQL injection??)
Thanks. For all cases where we know the identifier, we escape and quote it ourselves (though if you see any issues for those cases am more than happy to know as well). But I agree in any case that where the identifier is a variable (as above), it makes sense to use QUOTENAME() indeed. As you write above, since identifier names (table/column/constraint names) are part of the EF model, we don't consider this a security issue - but it's still a good to fix it.
Activity
roji commentedon Jun 19, 2025
Thanks. For all cases where we know the identifier, we escape and quote it ourselves (though if you see any issues for those cases am more than happy to know as well). But I agree in any case that where the identifier is a variable (as above), it makes sense to use
QUOTENAME()indeed. As you write above, since identifier names (table/column/constraint names) are part of the EF model, we don't consider this a security issue - but it's still a good to fix it.More than happy to accept a PR from you on this!
duncansmart commentedon Jun 20, 2025
Turns out you can't use an expressions in an EXEC other than string concatenation, so the QUOTENAME will have to move to the SELECT, i.e
Will have a PR soon ...
SQL Server migrations should use QUOTENAME when constructing SQL for …
SQL Server migrations should use QUOTENAME when constructing SQL for …
SQL Server migrations should use QUOTENAME when constructing SQL for …
SQL Server migrations should use QUOTENAME when constructing SQL for …
SQL Server migrations should use QUOTENAME when constructing SQL for …