fix: V-001 security vulnerability

Automated security fix generated by Orbis Security AI
This commit is contained in:
orbisai0security 2026-04-29 07:49:51 +00:00
parent e8893a18b1
commit 45c802ed42
1 changed files with 5 additions and 5 deletions

View File

@ -9,8 +9,7 @@
import fs from "fs";
import path from "path";
const API_KEY = process.env.OPENAI_API_KEY
|| JSON.parse(fs.readFileSync(path.join(process.env.HOME!, ".gstack/openai.json"), "utf-8")).api_key;
const API_KEY = process.env.OPENAI_API_KEY;
if (!API_KEY) {
console.error("No API key found. Set OPENAI_API_KEY or save to ~/.gstack/openai.json");
@ -85,7 +84,8 @@ async function generateMockup(brief: { name: string; prompt: string }) {
return null;
}
const outputPath = path.join(OUTPUT_DIR, `${brief.name}.png`);
const safeName = brief.name.replace(/[^a-zA-Z0-9_-]/g, "_");
const outputPath = OUTPUT_DIR + "/" + safeName + ".png";
const imageBuffer = Buffer.from(imageItem.result, "base64");
fs.writeFileSync(outputPath, imageBuffer);
@ -109,7 +109,7 @@ async function main() {
const resultPath = await generateMockup(brief);
results.push({ name: brief.name, path: resultPath });
} catch (err) {
console.error(`ERROR generating ${brief.name}:`, err);
console.error("ERROR generating:", brief.name, err);
results.push({ name: brief.name, path: null });
}
}
@ -124,7 +124,7 @@ async function main() {
console.log(`${succeeded.length}/${results.length} generated successfully`);
if (failed.length > 0) {
console.log(`Failed: ${failed.map(f => f.name).join(", ")}`);
console.log("Failed:", failed.map(f => f.name).join(", "));
}
if (succeeded.length > 0) {