Skip to content

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

fix(server): reject whitespace-only and non-string slug and title in POST /sandboxed (#387)

Felix-Ayushfee851c47c13
diff --git a/server/src/components/sandboxed-routes.ts b/server/src/components/sandboxed-routes.ts
index 8e4ae226..659f87ec 100644
--- a/server/src/components/sandboxed-routes.ts
+++ b/server/src/components/sandboxed-routes.ts
@@ -63,14 +63,19 @@ export function createSandboxedRoutes(
sampleArguments?: Record<string, unknown>;
} | null;
- if (!body?.slug || !body.title) {
+ if (
+ typeof body?.slug !== "string" ||
+ !body.slug.trim() ||
+ typeof body?.title !== "string" ||
+ !body.title.trim()
+ ) {
return context.json({ error: "A name and a title are required." }, 400);
}
try {
const component = await store.save({
- slug: body.slug,
- title: body.title,
+ slug: body.slug.trim(),
+ title: body.title.trim(),
description: body.description ?? "",
html: body.html ?? "",
css: body.css ?? "",