From 64fbf2308e395e7bfa3dfc933a05f5d6e35a0d94 Mon Sep 17 00:00:00 2001 From: Thomas Jung Date: Fri, 25 Aug 2023 15:44:14 -0400 Subject: [PATCH] Fix #111 - add checks on container and group name --- bin/createContainer.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/bin/createContainer.js b/bin/createContainer.js index a5688ba..28773b1 100644 --- a/bin/createContainer.js +++ b/bin/createContainer.js @@ -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()