Re: Security Questions
- From: "William Vaughn" <billvaNoSPAM@xxxxxxxxx>
- Date: Sat, 5 Jan 2008 11:48:29 -0800
I expect you're concerned with SQL injection attacks and you should be. However, when you bring in @Message as text (I would use VarChar(max)), I expect that you think that it opens the door for a SQL injection attack. I would try it. Notice that no matter what @Message contains, the WHERE clause is still used. That's because the SQL being executed is not concatenated on the fly.
The problem with hard-coded SQL is that it makes the application dependent on the schema. WHEN the schema changes, you're back to opening up N projects that might have referenced the schema in some specific way. And no, Visual Studio does not help here very much but keeping SQL in the SPs means that you can often make the change without changing the applications--as long as the SP signature does not change.
hth
--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________
"Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx> wrote in message news:%23bLtce1TIHA.3532@xxxxxxxxxxxxxxxxxxxxxxx
I have a couple of security questions.
First, I just created the following stored procedure:
ALTER PROCEDURE dbo.mc_Trainer_SetClientMessage
@TrainerId uniqueidentifier,
@Message text
AS
BEGIN
UPDATE dbo.mc_Trainers SET WelcomeText=@Message WHERE UserID=@TrainerId
RETURN
End
Am I correct in my understanding that, if @Message contains any SQL statements, that will not cause any problems within this procedure?
Second, does anyone see any problems using hard-coded SQL statements in C# as long as such statements are constructed without any user-entered text?
Thanks for any suggestions!
Jonathan
.
- Follow-Ups:
- Re: Security Questions
- From: Jonathan Wood
- Re: Security Questions
- References:
- Security Questions
- From: Jonathan Wood
- Security Questions
- Prev by Date: Re: Security Questions
- Next by Date: Re: Security Questions
- Previous by thread: Re: Security Questions
- Next by thread: Re: Security Questions
- Index(es):
Relevant Pages
|