Skip to main content
Source: AL0111SqlInterpolationInCommandTextAnalyzer.cs

Description

Assigning an interpolated string ($"..." or $"""...""") to a property named CommandText is a SQL injection vector. Values should be passed via parameterized queries (@param, $1) instead of being interpolated directly into the command string.

Bad Code

Good Code

Properties

  • Category: Reliability
  • Severity: Warning
  • Enabled by default: True
  • Code fix available: False

Configuration