BLCC#91763 AiAi op publiceren melding als bericht => AI SQL Injection

svn path=/Website/branches/v2025.4/; revision=71136
This commit is contained in:
Jos Groot Lipman
2025-12-03 14:22:56 +00:00
parent 04e0121327
commit 32371c5a93

View File

@@ -97,14 +97,18 @@ if (nieuws_key === -1 && mld_key > 0) {
var result = shared.promptAI(JSON.stringify(input), { "instructions": L("lcl_mld_publish_portal_message_instructions"), "response_format": "json_object" }); var result = shared.promptAI(JSON.stringify(input), { "instructions": L("lcl_mld_publish_portal_message_instructions"), "response_format": "json_object" });
if (result.success) { if (result.success) {
try { try {
__Log(result.content);
var content = JSON.parse(result.content); var content = JSON.parse(result.content);
subject = content.onderwerp || null; subject = content.onderwerp || null;
fac_nieuws_groep_key = content.categorie || null; var fac_nieuws_groep_key = null;
fac_nieuws_groep_key = parseInt(content.categorie, 10) || null; // In theorie kan AI nog steeds een ongeldige categorie_key teruggeven. Dat negeren we
image = content.icon || null; image = content.icon || null;
mess_dsc = content.berichttekst || null; mess_dsc = content.berichttekst || null;
totdate = (content.periode_tot || null) === null ? null : new Date(content.periode_tot || null); totdate = (content.periode_tot || null) === null ? null : new Date(content.periode_tot || null);
} catch (e) { } catch (e) {
// Dan niet // Dan niet
__DoLog("Prompt AI returned invalid JSON: " + e.description);
__DoLog(result.content);
} }
} }
} }