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

Security sanitization to silence some linters #566

Merged
merged 2 commits into from
Sep 19, 2024
Merged
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
9 changes: 5 additions & 4 deletions tools/make_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def generate_makefile(self):

# Set Jijna2 environment and variables
j2_env = jinja2.Environment(
autoescape=jinja2.select_autoescape(None),
loader=jinja2.FileSystemLoader(searchpath=str(template_dir))
)
j2_env.filters["dirname"] = self.dirname
Expand Down Expand Up @@ -97,13 +98,13 @@ def generate_makefile(self):

def run_ssh_cmd(self, cmd):
"""Formats the SSH command to use when building on remote hosts."""
ssh_cmd = f"ssh {self.args.username}@{self.args.host} '{cmd}'"
return subprocess.call(ssh_cmd, shell=True)
ssh_cmd = ['ssh', f'{self.args.username}@{self.args.host}', f'"{cmd}"']
return subprocess.call(ssh_cmd, shell=False)

def run_scp_cmd(self, src, dst, recurse=False):
"""Formats the SCP command to use when copying over the built package."""
scp_cmd = f"scp {'-r' if recurse else ''} {src} {dst}"
return subprocess.call(scp_cmd, shell=True)
scp_cmd = ['scp', '-r' if recurse else '', src, dst]
return subprocess.call(scp_cmd, shell=False)

def build_package(self, pkg_dir):
"""Builds the package when the local system is FreeBSD."""
Expand Down