Repository navigation
[🍒] Fix SQL injection in connector sample path and escape init queries for release/1.12 - #693
Merged
vishwasvaidya-cloudsufi merged 1 commit intoNov 30, 2026
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces robust SQL identifier escaping across multiple database connectors (including Redshift, CloudSQL, Databricks, SQL Server, MySQL, Oracle, and PostgreSQL) to mitigate SQL injection vulnerabilities. It also implements read-only transaction configurations and rollback-on-close mechanisms to secure schema loading and sampling operations. Review feedback suggests simplifying the getTableName implementation in DatabricksConnector by removing redundant null checks for database and schema parameters, as they are guaranteed to be non-null, and updating the corresponding unit tests accordingly.
vikasrathee-cs
force-pushed
the
sql-identifier-escaping-cherrypick-1.12
branch
from
November 26, 2026 07:57
6456f65 to
d07d748
Compare
vishwasvaidya-cloudsufi
force-pushed
the
sql-identifier-escaping-cherrypick-1.12
branch
from
November 30, 2026 11:52
d07d748 to
34ce458
Compare
deepika-lalwani123
approved these changes
Nov 30, 2026
vishwasvaidya-cloudsufi
deleted the
sql-identifier-escaping-cherrypick-1.12
branch
November 30, 2026 17:04
vishwasvaidya-cloudsufi
restored the
sql-identifier-escaping-cherrypick-1.12
branch
November 30, 2026 17:04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[🍒]
🍒 [cherrypick]
PR : (#688)
Description:
What's this about
A VRP report found a SQL injection in the Cloud SQL PostgreSQL connector's sample/spec path. A table path containing a
"could break out of the quoted identifier and execute stacked statements (such as anUPDATE) in default autocommit mode under the connection's stored credential. The same unescaped identifier pattern existed across the other database connectors.(Note: Source query /
splitByvalidation viaSelectQueryValidatorhas been split out to a follow-up PR per review feedback so this fix can merge without blocking on source-query validation design, compatibility flags, and docs.)What changed
quoteIdentifier): Schema, database, table, andstratacolumn identifiers inAbstractDBSpecificConnectorand all connector overrides (CloudSQLPostgreSQL,PostgreSQL,Redshift,Oracle,SqlServer,MySQL,CloudSQLMySQL,Databricks) now double embedded quote characters ("or`) so user-supplied path/sample parameters cannot break out of the quoted identifier.AbstractDBSpecificConnector.loadTableSchemanow setsconnection.setReadOnly(true), disables auto-commit (when!isAutoCommitEnabled()), and rolls back infinallyon both normal completion and error, closing the opened connections ingetInputFormatProviderandgetTableSchema.getInputFormatProvider->DataDrivenETLDBInputFormat) marks the configuration read-only (ConnectionConfigAccessor.READ_ONLY) and wraps non-autocommit sampling connections inRollbackOnCloseConnectionsoDBRecordReader.close()rolls back instead of committing.SqlServerConstants.buildSetLanguageQueryandMysqlConstants.buildSetSqlModeQueryto escape interpolated string literals across all 8 SQL Server and MySQL source/sink/action/post-action configs.Testing
quoteIdentifier,getTableName, andgetStratifiedQueryacross every connector (including the exact payload from the report).AbstractDBSpecificConnectorReadOnlyTest,RollbackOnCloseConnectionTest) verifying read-only transaction setup, rollback on error/close, fullInputFormat/RecordReadersampling, and that neither a stackedUPDATEin a table path nor a directUPDATEpassed toloadTableSchemamodifies a marker table.SqlServerInitQueriesUnitTest,MysqlInitQueriesUnitTest) pinninggetInitQueries()escaping across all 8 MySQL and SQL Server configs.