-
Notifications
You must be signed in to change notification settings - Fork 10
Gemini polishing #51
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
Gemini polishing #51
Conversation
| console.dir(modelInfo) | ||
| console.dir(modelId) | ||
| const deepseekReasoner = modelId.includes("deepseek-reasoner") | ||
| const ark = modelUrl.includes(".volces.com") |
Check failure
Code scanning / CodeQL
Incomplete URL substring sanitization High
.volces.com
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 9 months ago
To fix the problem, we need to parse the URL and check the host value instead of using a substring check. This ensures that the check is accurate and cannot be bypassed by embedding the allowed host in an unexpected location within the URL.
- Parse the URL using the
URLconstructor to extract the host. - Check if the host matches the allowed host or its subdomains.
- Replace the substring check with the new host validation logic.
-
Copy modified lines R74-R81
| @@ -73,3 +73,10 @@ | ||
| const deepseekReasoner = modelId.includes("deepseek-reasoner") | ||
| const ark = modelUrl.includes(".volces.com") | ||
| let ark = false | ||
| try { | ||
| const urlHost = new URL(modelUrl).host | ||
| ark = urlHost === "volces.com" || urlHost.endsWith(".volces.com") | ||
| } catch (error) { | ||
| // Handle invalid URL | ||
| ark = false | ||
| } | ||
|
|
add robustness and everything is synced with server now