-
Notifications
You must be signed in to change notification settings - Fork 4.1k
*: replace %s formatting for SQL statements with lexbase.EncodeSQLString throughout the codebase #69428
Copy link
Copy link
Open
Labels
A-securityC-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech 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)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Description
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):
"executor_type = '%s'", tree.ScheduledBackupExecutor.InternalName())) cockroach/pkg/sql/delegate/show_syntax.go
Line 40 in f18f7b8
&query, "SELECT @1 AS %s, @2 AS %s FROM (VALUES ", query = fmt.Sprintf("%s ORDER BY %s", query, strings.Join(orderByColumns, ","))
Jira issue: CRDB-9593
Epic CRDB-60948
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
A-securityC-cleanupTech debt, refactors, loose ends, etc. Solution not expected to significantly change behavior.Tech 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)Medium-low impact: incurs increased costs for some users (incl lower avail, recoverable bad data)T-sql-foundationsSQL Foundations Team (formerly SQL Schema + SQL Sessions)SQL Foundations Team (formerly SQL Schema + SQL Sessions)
Type
Projects
Status
Bugs to Fix