Skip to content

Commit 2b270e4

Browse files
Sandbox Process Creation
1 parent 1cb6204 commit 2b270e4

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

jtd_codebuild/generators/generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import subprocess
33
from typing import Dict, Any, AnyStr, List
44
from ..utils import safe_mkdir
5+
from security import safe_command
56

67

78
class JTDCodeGenerator:
@@ -66,8 +67,7 @@ def generate(
6667
target_language = target["language"]
6768
target_path = self.get_target_path(target)
6869
safe_mkdir(target_path)
69-
process = subprocess.Popen(
70-
self._codegen_command(self.schema_path, target_path, target_language),
70+
process = safe_command.run(subprocess.Popen, self._codegen_command(self.schema_path, target_path, target_language),
7171
shell=True,
7272
stdout=subprocess.PIPE,
7373
stderr=subprocess.PIPE,

jtd_codebuild/generators/typescript_generator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from typing import Dict, Any, AnyStr, List
44
from ..utils import wait_for_processes
55
from .generator import JTDCodeGenerator
6+
from security import safe_command
67

78

89
class JTDCodeGeneratorTypescriptTarget(JTDCodeGenerator):
@@ -19,8 +20,7 @@ def _compile_typescript(self, tsconfig_path: str) -> subprocess.Popen:
1920
Args:
2021
tsconfig_path: The path to the tsconfig.json file.
2122
"""
22-
return subprocess.run(
23-
f"tsc --project {tsconfig_path}",
23+
return safe_command.run(subprocess.run, f"tsc --project {tsconfig_path}",
2424
shell=True,
2525
stdout=subprocess.PIPE,
2626
stderr=subprocess.PIPE,

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ python = ">=3.8.1,<4.0"
3131
pyyaml = "^6.0.1"
3232
click = "^8.1.7"
3333
case-converter = "^1.1.0"
34+
security = "==1.3.1"
3435

3536
[tool.poetry.group.dev.dependencies]
3637
flake8 = "^6.1.0"

0 commit comments

Comments
 (0)