Repository navigation
Validate Snowflake account and region before building the SQL API URL - #72174
Merged
Merged
Conversation
potiuk
force-pushed
the
fix-snowflake-account-validation
branch
from
August 28, 2026 14:38
55336ab to
7b9a736
Compare
Contributor
There was a problem hiding this comment.
I had a look through and aside from my comment below, we should probably apply the account validation in the SnowflakeCortexAgentHook._get_base_url as well since it builds the URL from the bare account value. Could be a followup if you want to keep this scoped to the SQL API, although it should be a fairly small change.
potiuk
force-pushed
the
fix-snowflake-account-validation
branch
from
September 18, 2026 10:26
7b9a736 to
11e220b
Compare
shahar1
self-requested a review
September 20, 2026 09:37
The account and region connection fields are interpolated into the SQL API URL, with the .snowflakecomputing.com suffix appended as text. Restrict both to the characters a Snowflake account or region identifier is made of, so neither can carry URL-significant punctuation into the request address. Four sql_api tests mocked _get_conn_params without a return value and so built their URLs from a MagicMock; they now use the CONN_PARAMS constant the rest of the file already uses.
Review pointed out the SQL API is not the only place a bare account value reaches a URL: the OAuth token endpoint and the Cortex Agent base URL build their host from it the same way, so the same unchecked value could redirect those requests as well. The line drawn is between fields that *name* the account (account, region), which are validated, and fields that *are* the address (token_endpoint, host), which stay the address the user configured. Generated-by: Claude Opus 5
potiuk
force-pushed
the
fix-snowflake-account-validation
branch
from
September 21, 2026 00:31
d7e1807 to
1de1a7f
Compare
shahar1
approved these changes
Sep 21, 2026
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.
The
accountandregionconnection fields are interpolated into the SQL API URL, with the.snowflakecomputing.comsuffix appended as text:Neither field was checked, so a value carrying URL-significant punctuation changed the address the request was sent to rather than just naming the account.
Both are now restricted to the characters a Snowflake account or region identifier is actually made of — letters, digits,
.,_and-— and anything else raisesValueErrorbefore a request is built. An emptyaccount, which previously produced a meaningless host, is rejected too.Test change worth flagging: four
test_snowflake_sql_apitests patched_get_conn_paramswithout setting a return value, so they were building their URLs from aMagicMock. They now use theCONN_PARAMSconstant the rest of that file already uses.Local: 386 passed, 11 skipped across the Snowflake provider; ruff and mypy clean.
🤖 Generated with Claude Code