Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/api/providers/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@
constructor(options: ApiHandlerOptions) {
this.options = options
// Azure API shape slightly differs from the core API shape: https://github.com/openai/openai-node?tab=readme-ov-file#microsoft-azure-openai
const urlHost = new URL(this.options.openAiBaseUrl ?? "").host
if (urlHost === "azure.com" || urlHost.endsWith(".azure.com")) {
if (this.options.openAiBaseUrl?.toLowerCase().includes("azure.com")) {

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
azure.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind fixing this?

Copy link
Contributor Author

@samhvw8 samhvw8 Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is from cline upstream, i think it will be ok, to handle case "https://[recourncename].openai.azure.com/openai" where azure is in middle or baseUrl

this.client = new AzureOpenAI({
baseURL: this.options.openAiBaseUrl,
apiKey: this.options.openAiApiKey,
Expand Down
Loading