The vulnerability exists in the CopyFromExternalStageToSnowflakeOperator class within the Apache Airflow Snowflake provider. The root cause is the lack of input validation on the table and stage parameters passed to the operator's constructor (__init__).
The provided patch bcf19916738e4a7065a3911814ba1fa32d6fd669 clearly shows that the fix was to introduce a new validation function, _validate_parameter, which checks for the presence of semicolons in the input. The constructor was modified to wrap the assignment of self.table and self.stage with calls to this new validation function.
Before the patch, the __init__ method performed a direct assignment:
self.table = table
self.stage = stage
This allowed a user to pass a value like my_table; DROP TABLE other_table; for the table parameter. When the execute method later constructs the SQL query using this variable, it would result in multiple commands being executed on the Snowflake database, leading to a critical SQL injection vulnerability.
The vulnerable function is therefore airflow.providers.snowflake.transfers.copy_into_snowflake.CopyFromExternalStageToSnowflakeOperator.__init__, as it was responsible for accepting and storing the unsanitized, malicious input that would be used during exploitation.