Skip to content

*: replace %s formatting for SQL statements with lexbase.EncodeSQLString throughout the codebase #69428

@Azhng

Description

@Azhng

Currently, we have various places [1] where we use fmt.Sprintf() with %s to format SQL statements. This is prone to SQL injections bugs. Instead we should be using lexbase.EncodeSQLString to properly escape the statements.

edit (knz): note that tree.Name has a String() method that already does the right thing, so it's OK to do %s with a tree.Name. With string, not so much.


[1]: for instance (not comprehensive):

Jira issue: CRDB-9593

Epic CRDB-60948

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-securityC-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.S-3Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)

    Type

    No type

    Projects

    Status

    Bugs to Fix

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions