Is the following safe from SQL injection? The user would pass in a comma separated list of codes as a string (Ex. '1', '1,3', '1,2,3', etc). I read that SQL parameters protect against SQL injection.
CREATE PROCEDURE CurrentActions   
    @StatusCodes nvarchar(100)   -- 0 = Active, 1 = Completed, 2 = On Hold
AS   
    SELECT ActionId, ActionName, ActionStatusCode, Comments  
    FROM Action
    WHERE ActionStatusCode IN (@StatusCodes)
GO
It seems like someone could inject malicious code into @StatusCodes, but what I've read, that's not the case, because using parameters will prevent that. Parameters can fail when using dynamic SQL statements and unsafe concatenation, but that's not what's happening here.
So my guess is that it's safe, however, I wasn't able to find anything specifically related IN clause and a string parameter inserted into the middle. Yes, I know there are other ways to pass in an array of ints, but this is a very convenient way to do it. But it has to be safe, of course, or I won't do this.
Thanks.
 
     
    