-
Notifications
You must be signed in to change notification settings - Fork 3
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
Hardening suggestions for PorySuite / plugins/expansion/1.8.1 #14
base: dev
Are you sure you want to change the base?
Conversation
subprocess.run(["osascript", "-e", f'tell app "Terminal" to do script "{command}"']) | ||
subprocess.run(["osascript", "-e", 'tell app "Terminal" to activate']) | ||
safe_command.run(subprocess.run, ["osascript", "-e", f'tell app "Terminal" to do script "{command}"']) | ||
safe_command.run(subprocess.run, ["osascript", "-e", 'tell app "Terminal" to activate']) | ||
elif sys.platform == "win32": | ||
command = f"docker run --rm -i -t -v porysuite_{self.project_dir_name}:/root/projects/{self.project_dir_name} " \ | ||
f"--workdir /root/projects/{self.project_dir_name} porysuiteimage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set shell
keyword argument to False
elif sys.platform == "win32": | ||
command = f"docker run --rm -i -t -v porysuite_{self.project_dir_name}:/root/projects/{self.project_dir_name} " \ | ||
f"--workdir /root/projects/{self.project_dir_name} porysuiteimage" | ||
subprocess.run(["start", "cmd", "/k", command], shell=True) | ||
safe_command.run(subprocess.run, ["start", "cmd", "/k", command], shell=False) | ||
else: | ||
command = f"docker run --rm -i -t --mount type=bind,source={self.project_dir},target={project_dir_container} " \ | ||
f"--workdir '{project_dir_container}' porysuiteimage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Set shell
keyword argument to False
@@ -522,13 +523,13 @@ def try_open_terminal(self): | |||
if sys.platform == "darwin": | |||
command = f"docker run --rm -i -t --mount type=bind,source=\\\"{self.project_dir}\\\",target=\\\"{project_dir_container}\\\" " \ | |||
f"--workdir '{project_dir_container}' porysuiteimage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces subprocess.{func} with more secure safe_command library functions.
@@ -522,13 +523,13 @@ def try_open_terminal(self): | |||
if sys.platform == "darwin": | |||
command = f"docker run --rm -i -t --mount type=bind,source=\\\"{self.project_dir}\\\",target=\\\"{project_dir_container}\\\" " \ | |||
f"--workdir '{project_dir_container}' porysuiteimage" | |||
subprocess.run(["osascript", "-e", f'tell app "Terminal" to do script "{command}"']) | |||
subprocess.run(["osascript", "-e", 'tell app "Terminal" to activate']) | |||
safe_command.run(subprocess.run, ["osascript", "-e", f'tell app "Terminal" to do script "{command}"']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces subprocess.{func} with more secure safe_command library functions.
subprocess.run(["osascript", "-e", f'tell app "Terminal" to do script "{command}"']) | ||
subprocess.run(["osascript", "-e", 'tell app "Terminal" to activate']) | ||
safe_command.run(subprocess.run, ["osascript", "-e", f'tell app "Terminal" to do script "{command}"']) | ||
safe_command.run(subprocess.run, ["osascript", "-e", 'tell app "Terminal" to activate']) | ||
elif sys.platform == "win32": | ||
command = f"docker run --rm -i -t -v porysuite_{self.project_dir_name}:/root/projects/{self.project_dir_name} " \ | ||
f"--workdir /root/projects/{self.project_dir_name} porysuiteimage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces subprocess.{func} with more secure safe_command library functions.
elif sys.platform == "win32": | ||
command = f"docker run --rm -i -t -v porysuite_{self.project_dir_name}:/root/projects/{self.project_dir_name} " \ | ||
f"--workdir /root/projects/{self.project_dir_name} porysuiteimage" | ||
subprocess.run(["start", "cmd", "/k", command], shell=True) | ||
safe_command.run(subprocess.run, ["start", "cmd", "/k", command], shell=False) | ||
else: | ||
command = f"docker run --rm -i -t --mount type=bind,source={self.project_dir},target={project_dir_container} " \ | ||
f"--workdir '{project_dir_container}' porysuiteimage" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaces subprocess.{func} with more secure safe_command library functions.
@@ -3,3 +3,6 @@ platformdirs~=4.1.0 | |||
Unidecode~=1.3.7 | |||
docker~=7.0.0 | |||
lark~=1.1.9 | |||
security==1.2.1 \ |
There was a problem hiding this comment.
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: MIT ✅ Open Source ✅ More facts
I've reviewed the recently opened PR (13 - Update pokeemerald_expansion plugin to v0.1.1) and have identified some area(s) that could benefit from additional hardening measures.
These changes should help prevent potential security vulnerabilities and improve overall code quality.
Thank you for your consideration!
docs | feedback
Powered by: pixeebot