Skip to content

[bug] Fix some edge cases in query sanitization for EFCore and SqlClient #3574

@martincostello

Description

@martincostello

Component

OpenTelemetry.Instrumentation.SqlClient

Package Version

Package Name Version
OpenTelemetry.Instrumentation.EntityFrameworkCore 1.14.0-beta.2
OpenTelemetry.Instrumentation.SqlClient 1.14.0-beta.1

Runtime Version

Any

Description

From discussion here dotnet/efcore#29281 (comment):

I can see various issues in a casual look: for example, table and column names may include a single-quote, and that look like it would be identified as a literal to be sanitized in the current code. To compound the problem, different databases differ here: SQL Server allows quoting table/column names via brackets (so [Table'WithSingleQuote]), but MySQL uses backticks, etc. And that's just one problem.

Steps to Reproduce

Use SQL syntax as described above.

Expected Result

Queries are correctly parsed.

Actual Result

Queries may be incorrectly parsed.

Additional Context

No response

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingcomp:instrumentation.entityframeworkcoreThings related to OpenTelemetry.Instrumentation.EntityFrameworkCorecomp:instrumentation.sqlclientThings related to OpenTelemetry.Instrumentation.SqlClient

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions