mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-18 18:36:21 +00:00
fix(ai): resolve UAF and require provider argument instead of defaults
This enforces explicit provider specification. Automatic fallback to preferences or "openai" is removed. Users must now pass the provider name explicitly. default provider functionality was improperly removed and implemented (some parts still remain intact), leading to UAF.
This commit is contained in:
@@ -10932,21 +10932,14 @@ cmd_ai_start(ProfWin* window, const char* const command, gchar** args)
|
|||||||
if (g_strv_length(args) >= 2) {
|
if (g_strv_length(args) >= 2) {
|
||||||
provider_name = args[1];
|
provider_name = args[1];
|
||||||
}
|
}
|
||||||
if (g_strv_length(args) >= 3) {
|
|
||||||
model = args[2];
|
if (!provider_name) {
|
||||||
|
cons_show_error("Please specify provider name.");
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolve defaults
|
if (g_strv_length(args) >= 3) {
|
||||||
auto_gchar gchar* owned_provider_name = NULL;
|
model = args[2];
|
||||||
if (!provider_name) {
|
|
||||||
// Use default provider from preferences
|
|
||||||
auto_gchar gchar* default_provider = prefs_get_string(PREF_AI_PROVIDER);
|
|
||||||
if (default_provider && strlen(default_provider) > 0) {
|
|
||||||
provider_name = default_provider;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!provider_name) {
|
|
||||||
provider_name = "openai"; // Fallback
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AIProvider* provider = ai_get_provider(provider_name);
|
AIProvider* provider = ai_get_provider(provider_name);
|
||||||
|
|||||||
Reference in New Issue
Block a user