-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[Fix] Enforce format constraints on provider URL parameters #26287
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,8 +232,11 @@ def get_vertex_base_url( | |
| """ | ||
| if vertex_location == "global": | ||
| return "https://aiplatform.googleapis.com" | ||
| else: | ||
| return f"https://{vertex_location}-aiplatform.googleapis.com" | ||
| if vertex_location is not None and not re.match( | ||
| r"^[a-z][a-z0-9-]*$", vertex_location | ||
| ): | ||
| raise ValueError("Invalid vertex_location format") | ||
| return f"https://{vertex_location}-aiplatform.googleapis.com" | ||
|
Comment on lines
+235
to
+239
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When |
||
|
|
||
|
|
||
| def _get_embedding_url( | ||
|
|
||
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.
Snowflake supports a legacy account identifier format
<account_locator>.<region_id>.<cloud>(e.g.,xy12345.us-east-1.aws) that is interpolated directly into the URL ashttps://{account_id}.snowflakecomputing.com/api/v2. The regex^[a-zA-Z0-9_-]+$forbids dots, so any existing caller using the locator+region format will start gettingValueErrorafter this change — a silent backwards-incompatible breakage (see rule on avoiding breaking changes without feature flags). The regex needs to permit dots, or the validation should be scoped to the new-format account names only.Rule Used: What: avoid backwards-incompatible changes without... (source)