Enhance SQL parameter handling in CreateDocumentAsync
Updated the CreateDocumentAsync method in the DocumentExecutor class to use ToSqlParam() for formatting SQL query parameters. This change improves security by preventing potential SQL injection vulnerabilities associated with direct variable insertion into the SQL string.
This commit is contained in:
parent
ad855b77cd
commit
6bdf0d5220
@ -18,7 +18,7 @@ public class DocumentExecutor : SQLExecutor, IDocumentExecutor
|
||||
{
|
||||
using var connection = new SqlConnection(Params.ConnectionString);
|
||||
var sql = Provider.GetRequiredService<DocumentCreateReadSQL>();
|
||||
var formattedSql = string.Format(sql.Raw, base64, envelope_uuid);
|
||||
var formattedSql = string.Format(sql.Raw, base64.ToSqlParam(), envelope_uuid.ToSqlParam());
|
||||
await connection.OpenAsync(cancellation);
|
||||
var documents = await connection.QueryAsync<EnvelopeDocument>(formattedSql);
|
||||
return documents.FirstOrDefault()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user