DapperLib / DapperLib/DapperAOT
Analyzer: interpolated string usage
@DeagleGross is already working on this.
Since Dec 14, 2024.
- Dominant language
- C#
- Stars
- 472
- Forks
- 43
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 18
Description
we should detect usage like:
conn.Execute($"update foo set balance={value} where id={id}");
and issue a warning, but: this should only apply when the receiving parameter is a string. I have a plan for future magic voodoo here! There is a future version of Dapper where something very similar, i.e.
conn.Execute($"update foo set balance=@{value} where id=@{id}");
actually works and does the correct thing. I have a working prototype. Must handle all types of interpolated string literal ($", $""", possible $"" etc)
Warning something like:
Interpolated strings should not be used as an alternative to parameterization, and can represent a significant security risk (SQL injection)
If we add the proposed Dapper feature, we can reword this and point them to the new usage.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.