Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat(snowflake-driver): Support execute sql via custom procedure#9579

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
RusovDmitriy wants to merge1 commit intomaster
base:master
Choose a base branch
Loading
fromfeat-snowflake-wrap-call

Conversation

RusovDmitriy
Copy link
Member

No description provided.

this.config.snowflakeExecutionProcedure &&
query.toUpperCase().startsWith('SELECT')
) {
const escapedQuery = query.replace(/'/g, "\\'");

Check failure

Code scanning / CodeQL

Incomplete string escaping or encoding High

This does not escape backslash characters in the input.

Copilot Autofix

AI 2 months ago

To fix the issue, we need to ensure that backslashes in thequery string are escaped before escaping single quotes. This can be achieved by first replacing all backslashes (\) with double backslashes (\\), and then replacing all single quotes (') with escaped single quotes (\'). This ensures that both backslashes and single quotes are properly escaped.

The best way to implement this fix is to chain tworeplace operations on thequery string:

  1. Replace all backslashes (\) with double backslashes (\\).
  2. Replace all single quotes (') with escaped single quotes (\').

This change should be applied to line 892 in theexecute method.


Suggested changeset1
packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git applydiff --git a/packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts b/packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts--- a/packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts+++ b/packages/cubejs-snowflake-driver/src/SnowflakeDriver.ts@@ -891,3 +891,3 @@     ) {-      const escapedQuery = query.replace(/'/g, "\\'");+      const escapedQuery = query.replace(/\\/g, "\\\\").replace(/'/g, "\\'");       const serializedBinds = `ARRAY_CONSTRUCT(${(values ?? [])EOF
@@ -891,3 +891,3 @@
){
constescapedQuery=query.replace(/'/g,"\\'");
constescapedQuery=query.replace(/\\/g,"\\\\").replace(/'/g,"\\'");
constserializedBinds= `ARRAY_CONSTRUCT(${(values??[])
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

1 participant
@RusovDmitriy

[8]ページ先頭

©2009-2025 Movatter.jp