packages feed

pms-infra-cmdrun 0.0.4.0 → 0.0.5.0

raw patch · 3 files changed

+5/−67 lines, 3 files

Files

CHANGELOG.md view
@@ -1,5 +1,9 @@ # Revision history for pms-infra-cmdrun +## 0.0.5.0 -- 2025-07-27++* Fixed resources templates.+ ## 0.0.4.0 -- 2025-07-20  * Added proc tool.
pms-infra-cmdrun.cabal view
@@ -20,7 +20,7 @@ -- PVP summary:     +-+------- breaking API changes --                  | | +----- non-breaking API additions --                  | | | +--- code changes with no API change-version:            0.0.4.0+version:            0.0.5.0  -- A short (one-line) description of the package. synopsis:           pms-infra-cmdrun
src/PMS/Infra/CmdRun/DS/Utility.hs view
@@ -36,72 +36,6 @@     errHdl :: E.SomeException -> IO (Either String a)     errHdl = return . Left . show -{---- |----validateCommand :: String -> AppContext String-validateCommand cmd = do-  when (null cmd) $-    throwError "Command is empty."--  when (".." `T.isInfixOf` tcmd) $-    throwError "Command contains directory traversal '..'."--  when ("/" `T.isInfixOf` tcmd) $-    throwError "Command must not contain '/'."--  when ("\\" `T.isInfixOf` tcmd) $-    throwError "Command must not contain '\\'."--  when (any (not . isAllowedChar) cmd) $-    throwError $ "Command contains disallowed characters: " ++ cmd--  return cmd--  where-    tcmd = T.pack cmd-    isAllowedChar c = isAlphaNum c || c `elem` ("-._" :: String)-  ---- |----validateCommandArg :: String -> AppContext String-validateCommandArg arg = do-  let tArg = T.pack arg-  when (hasDangerousChars tArg) $-    throwError $ "Argument contains potentially dangerous characters: " <> arg-  return arg-  where-    hasDangerousChars :: T.Text -> Bool-    hasDangerousChars txt =-      any (`T.isInfixOf` txt) [";", "&&", "|", "$", "`", "<", ">", "\\", "\""]---- |----validateCommandArgs :: [String] -> AppContext [String]-validateCommandArgs = mapM validateCommandArg----- |----validateMessage :: String -> IO String-validateMessage cmd = do-  when (any (`elem` forbiddenChars) cmd) $-    E.throwString "Command contains forbidden characters."--  case words cmd of-    (firstWord : _) -> when (firstWord `elem` forbiddenCommands) $-                        E.throwString "Command is forbidden."-    _ -> return ()--  return cmd-  where-    forbiddenChars :: [Char]-    forbiddenChars = [';', '&', '|', '`']--    forbiddenCommands :: [String]-    forbiddenCommands = ["rm", "mv", "dd", "chmod", "chown", "shutdown", "reboot", "kill", "nc", "telnet", "ssh"]--}  -- | --