security - Dynamic SQL: secure a password parameter from SQL injections -
as scary sounds, input password parameter has secured in following dynamic sql: create login newlogin password='mystrongpassword'
. @parameter cannot used: password=@pwd
(incorrect syntax near '@pwd' error). other parameters table name or user name, more or less simple: allow letters, digits , underscores, validate using simple regex , quotename it. passwords have allow usage of strong chars. should password cleared characters comma, space, etc or there better way?
not direct answer, can parametrize sp_addlogin:
exec sp_addlogin @user, @password;
or can use smo.
Comments
Post a Comment