﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Ayende Rahien commented on Chasing the SQL Injection that never was</title><description>Alex,
  
Yes, it isn't a major issue, although I think that I _can_ get it to generate a SQL injection if I was using MySQL.
  
It is not much of an injection, though, if it has to be compiled to get there.
  
Do you have any idea what was the reasons for this decision?
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment9</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment9</guid><pubDate>Thu, 12 Nov 2009 18:06:09 GMT</pubDate></item><item><title>Alex James commented on Chasing the SQL Injection that never was</title><description>I learned of this distinction for the first time while showing some Generated SQL to some SQL Server MVPs at the MVP summit in 2007! 
  
  
A mild panic attack followed. But all is well that ends well.
  
  
I personally think both inlining or using a parameter for constants is fine.
  
  
Alex
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment8</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment8</guid><pubDate>Thu, 12 Nov 2009 18:03:19 GMT</pubDate></item><item><title>P commented on Chasing the SQL Injection that never was</title><description>So everything rob said was wrong?...
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment7</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment7</guid><pubDate>Thu, 12 Nov 2009 15:50:48 GMT</pubDate></item><item><title>Dmitry commented on Chasing the SQL Injection that never was</title><description>I have done a lot of logging for Linq-to-SQL and it does not do this. In fact, Linq-to-Entities is the only ORM Linq provider I have seen that does that.
  
  
I think it is a bad decision because you will get different execution plans for different length constants.
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment6</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment6</guid><pubDate>Thu, 12 Nov 2009 02:44:03 GMT</pubDate></item><item><title>Frank commented on Chasing the SQL Injection that never was</title><description>If the constant parameter contains a single quote, I guess it will nicely escape it in the SQL query itself.
  
  
If something is constant, then it is better to actually use it as a constant in the SQL query itself, instead of a parameter. When a constant is used, the statistics of the column will be included in deciding on which path to take. In case of a parameter, only the index selectivity will be used in deciding on the query plan.
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment5</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment5</guid><pubDate>Wed, 11 Nov 2009 23:23:26 GMT</pubDate></item><item><title>Ayende Rahien commented on Chasing the SQL Injection that never was</title><description>Rob,
  
NHibernate does _not_ do it that way, though.
  
It makes everything a parameter
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment4</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment4</guid><pubDate>Wed, 11 Nov 2009 19:31:43 GMT</pubDate></item><item><title>Rob Conery commented on Chasing the SQL Injection that never was</title><description>Yep - Linq to Sql does the same thing. If it sees a ConstantExpression it just puts the value straight in with the thinking that it was set programmatically. So with our NHibernate stuff we did the other day where we set the CategoryID==33, it would put 33 in the query.
  
  
A bit weird when you consider the mandate to scrub everything, but at the same time I think it's generally OK.
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment3</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment3</guid><pubDate>Wed, 11 Nov 2009 19:11:31 GMT</pubDate></item><item><title>Remco Ros commented on Chasing the SQL Injection that never was</title><description>So.. would there be a special reason for this design? 
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment2</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment2</guid><pubDate>Wed, 11 Nov 2009 18:37:56 GMT</pubDate></item><item><title>Dmitry commented on Chasing the SQL Injection that never was</title><description>Yes, that is normal behavior for EF.
</description><link>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment1</link><guid>http://ayende.com/4287/chasing-the-sql-injection-that-never-was#comment1</guid><pubDate>Wed, 11 Nov 2009 13:56:30 GMT</pubDate></item></channel></rss>