Repository navigation
SNOW-4537767: Map booleans and time-zone types in DataFrameReader.jdbc #4530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sfc-gh-yuwang
wants to merge
2
commits into
yuwang/SNOW-4537773-jdbc-temp-functions
Choose a base branch
from
yuwang/SNOW-4537767-jdbc-type-mapping
base: yuwang/SNOW-4537773-jdbc-temp-functions
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review provided by Security Bot (#ask-pr-scanner)
SQL injection
🟠 MEDIUM ·
imports_sqlandpackages_sqlinterpolate import/package strings into UDTF DDL without escaping single quotes · CWE-89Fix: Escape each
importsandpackagesentry before embedding it in SQL, mirroring the existingstr_to_sql/single-quote-doubling approach used elsewhere in this module.Full description
In
JDBC.__init__,self.imports_sqlandself.packages_sqlbuild SQL fragments by wrapping each entry ofimportsandpackagesin single quotes via f-strings (e.g.f"'{imp}'") without escaping embedded single quotes. These fragments are injected verbatim into theCREATE OR REPLACE ... FUNCTIONDDL inschemaandread. Unlikeurl,propertiesandsession_init_statement(which are escaped withto_java_string_literal) and the inference query (escaped withstr_to_sql), theimports/packageslist items reach the SQL sink unescaped, so a value containing a single quote or')can alter the generated DDL.Impact
A caller who controls
udtf_configs["imports"]orudtf_configs["packages"](for example a stage path or package coordinate assembled from another untrusted source) can inject arbitrary SQL into the UDTF registration statement executed byself.session.sql(...).collect(), running in the Snowpark session's authority. The demonstrated effect is malformed/attacker-influenced DDL execution; it does not by itself cross a tenant boundary because the statement runs with the caller's own session privileges.Recommendation steps
importsandpackagesentry before embedding it in SQL, mirroring the existingstr_to_sql/single-quote-doubling approach used elsewhere in this module.importsentries against an allowed stage-path grammar andpackagesentries against the expectedgroup:artifact[:version]coordinate shape before buildingimports_sql/packages_sql.udtf_configs["imports"]/["packages"]so callers do not forward untrusted values.