Skip to content

Commit

Permalink
Fix #111 - add checks on container and group name
Browse files Browse the repository at this point in the history
  • Loading branch information
jung-thomas committed Aug 25, 2023
1 parent 9233f42 commit 64fbf23
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bin/createContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,21 @@ export async function activate(prompts) {
const { v4: uuidv4 } = base.require('uuid')
try {
base.setPrompts(prompts)
prompts.container = prompts.container.toUpperCase()
prompts.container = prompts.container.replace(/-/g, "_")
prompts.group = prompts.group.toUpperCase()
prompts.group = prompts.group.replace(/-/g, "_")

const testChars = ["!", `"`, "$", "%", "'", "(", ")", "*", "+", ",", ".", "/", ":", ";", "<", "=", ">", "?", "@", "[", "]", "\\", "^", "`", "{", "}", "|", "~"]
if (testChars.some(r=> prompts.container.includes(r))){
base.error(`Illegal Characters in input name ${prompts.container}`)
return
}
if (testChars.some(r=> prompts.group.includes(r))){
base.error(`Illegal Characters in input name ${prompts.group}`)
return
}

const db = await base.createDBConnection()

let envFile = conn.resolveEnv()
Expand Down

0 comments on commit 64fbf23

Please sign in to comment.