-
Notifications
You must be signed in to change notification settings - Fork 11.2k
feat(channel): 修改编辑渠道状态下修改api地址、类型、api密钥时,无法按照最新的进行获取的问题; #5176
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
base: main
Are you sure you want to change the base?
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 | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -214,11 +214,15 @@ export async function updateChannelBalance( | |||||||||||||||||
| * Fetch available models from upstream provider | ||||||||||||||||||
| */ | ||||||||||||||||||
| export async function fetchUpstreamModels( | ||||||||||||||||||
| id: number | ||||||||||||||||||
| id: number, | ||||||||||||||||||
| overrides?: { type?: number; base_url?: string } | ||||||||||||||||||
| ): Promise<FetchModelsResponse> { | ||||||||||||||||||
| const params: Record<string, string> = {} | ||||||||||||||||||
| if (overrides?.type != null) params.type = String(overrides.type) | ||||||||||||||||||
| if (overrides?.base_url) params.base_url = overrides.base_url | ||||||||||||||||||
| const res = await api.get( | ||||||||||||||||||
|
Comment on lines
+221
to
223
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.
Proposed fix- if (overrides?.base_url) params.base_url = overrides.base_url
+ if (overrides && 'base_url' in overrides) {
+ params.base_url = overrides.base_url ?? ''
+ }📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
| `/api/channel/fetch_models/${id}`, | ||||||||||||||||||
| channelActionConfig() | ||||||||||||||||||
| channelActionConfig({ params: Object.keys(params).length > 0 ? params : undefined }) | ||||||||||||||||||
| ) | ||||||||||||||||||
| return res.data | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
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.
Critical:
base_urloverride can exfiltrate stored channel keys.When
base_urlis overridden here, the request still uses the saved channel key. A caller can pointbase_urlto a controlled host and receive the Authorization header, bypassing the secure key-view flow.Suggested mitigation direction
📝 Committable suggestion
🤖 Prompt for AI Agents