Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sandbox Process Creation #440

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import yaml
import subprocess
import os
from security import safe_command

port = "22"
timeout = "60"
Expand All @@ -21,8 +22,8 @@
bitops_hosts = bitops_hosts[0]
print("Waiting for host:", bitops_hosts)
wait_for_command = "{}/_scripts/ansible/wait-for-it.sh -h {} -p {} -t {}".format(TEMPDIR,bitops_hosts,port,timeout)
result = subprocess.call(wait_for_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = safe_command.run(subprocess.call, wait_for_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except yaml.YAMLError as exception:
print(exception)
except IOError:
print("Terraform inventory file not found. Skipping wait for hosts.")
print("Terraform inventory file not found. Skipping wait for hosts.")
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ munch
GitPython
pyfiglet
boto3
security==1.3.0
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library holds security tools for protecting Python API calls.

License: MITOpen SourceMore facts

4 changes: 2 additions & 2 deletions scripts/plugins/utilities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os

Check warning on line 1 in scripts/plugins/utilities.py

View workflow job for this annotation

GitHub Actions / lint-black

reformat
import sys
import subprocess
from typing import Union
Expand All @@ -6,6 +6,7 @@

from .settings import BITOPS_FAST_FAIL_MODE
from .logging import logger, mask_message
from security import safe_command

Check failure on line 9 in scripts/plugins/utilities.py

View workflow job for this annotation

GitHub Actions / lint-pylint

C0411: third party import "security.safe_command" should be placed before local imports "settings.BITOPS_FAST_FAIL_MODE", "logging.logger" (wrong-import-order)


def add_value_to_env(export_env, value):
Expand Down Expand Up @@ -60,8 +61,7 @@

def run_cmd(command: Union[list, str]) -> subprocess.Popen:
"""Run a linux command and return Popen instance as a result"""
with subprocess.Popen(
command,
with safe_command.run(subprocess.Popen, command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
Expand Down
Loading