Skip to content

Commit 70ce870

Browse files
chapterjasonclaude
andcommitted
fix(api): validate slug format on project creation
Reject slugs with special characters, spaces, or path separators. Only lowercase letters, digits, and hyphens allowed (^[a-z0-9-]+$). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 69e6985 commit 70ce870

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/api/src/cli/create-project.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ if (!slug) {
99
console.error("Usage: create-project <slug>");
1010
process.exit(1);
1111
}
12+
if (!/^[a-z0-9-]+$/.test(slug)) {
13+
console.error(`Error: slug "${slug}" is invalid. Only lowercase letters, digits, and hyphens are allowed.`);
14+
process.exit(1);
15+
}
1216

1317
mkdirSync(API_DATA_DB_DIR, { recursive: true });
1418
const keys = loadApiKeys();

0 commit comments

Comments
 (0)