Skip to content

Commit 64fbf23

Browse files
committed
Fix #111 - add checks on container and group name
1 parent 9233f42 commit 64fbf23

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

bin/createContainer.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,21 @@ export async function activate(prompts) {
6161
const { v4: uuidv4 } = base.require('uuid')
6262
try {
6363
base.setPrompts(prompts)
64+
prompts.container = prompts.container.toUpperCase()
65+
prompts.container = prompts.container.replace(/-/g, "_")
66+
prompts.group = prompts.group.toUpperCase()
67+
prompts.group = prompts.group.replace(/-/g, "_")
68+
69+
const testChars = ["!", `"`, "$", "%", "'", "(", ")", "*", "+", ",", ".", "/", ":", ";", "<", "=", ">", "?", "@", "[", "]", "\\", "^", "`", "{", "}", "|", "~"]
70+
if (testChars.some(r=> prompts.container.includes(r))){
71+
base.error(`Illegal Characters in input name ${prompts.container}`)
72+
return
73+
}
74+
if (testChars.some(r=> prompts.group.includes(r))){
75+
base.error(`Illegal Characters in input name ${prompts.group}`)
76+
return
77+
}
78+
6479
const db = await base.createDBConnection()
6580

6681
let envFile = conn.resolveEnv()

0 commit comments

Comments
 (0)