Repository navigation
Conversation
This branch has not been deployed
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.
Summary
Snowflake SQL rejects valid DDL when its declared SQL type is
CREATE,DROP,ALTER, orTRUNCATE.sqlparseclassifies these verbs asKeyword.DDL, which the statement-type detector skips. For example,CREATE SCHEMA EXAMPLE_SCHEMAis incorrectly detected asSCHEMA.Recognize DDL tokens and normalize compound tokens such as
CREATE OR REPLACEto the leading verb. Keep existing validation and explicitly rejectDROP USER,DROP ROLE, andALTER USER, which were already listed as restricted operations in the recursive keyword check but were not reliably matched across separate tokens. Match dangerous operations and restricted DDL against a comment-stripped copy so line comments cannot bypass those checks; the executed SQL and existing injection/multiple-statement checks retain the original input.Add regression tests for DDL variants, declared-type mismatches, restricted operations, multiple statements, and connector invocation. Bump the plugin version to
0.0.9; dependencies anduv.lockare unchanged.Release Notes
CREATE SCHEMA,CREATE OR REPLACE, secure views, andCREATE TABLE AS SELECT.Change Type
Screenshots / Videos
Not applicable. The regression is covered by executable parser and connector-invocation tests.
Version
versioninmanifest.yaml(not the one undermeta)dify_plugin>=0.3.0,<0.11.0is declared inpyproject.tomland locked inuv.lockThe existing dependency declaration is unchanged (
dify_plugin>=0.9.0); the frozen lockfile resolves to SDK0.10.2.Testing
A clean environment was created with Python
3.12.14, matching the manifest's Python3.12runtime. Dependencies were installed withuv sync --frozen --all-groupsfrom the existing lockfile.uv run --frozen --with pytest python -m pytest -q: 84 passed, including the two existing OAuth cache tests. There are two SDK/gevent dependency warnings.Regression demonstrated before the fix:
CREATE SCHEMA EXAMPLE_SCHEMA, declared asCREATE, failed withdetected as SCHEMA.Valid
CREATE SCHEMA, replace/secure views, and CTAS reach the mocked connector exactly once, return success, and close the connection. Rejected queries never open a connection. Line-comment DDL controls are covered, and the existing block-comment injection rejection is unchanged.git diff --checkpasses. The plugin packages successfully with the Dify plugin CLI.No live Snowflake statements or deployment changes were performed by this test suite.
Local deployment — Dify version: 1.7.0
SaaS (cloud.dify.ai)