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

Hardening suggestions for ci-integrations / run_pixee #3

Open
wants to merge 1 commit into
base: run_pixee
Choose a base branch
from
Open
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
6 changes: 4 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from secrets import token_hex

import whatthepatch
from security import safe_command

load_dotenv()

from providers.bitbucket_provider import BitbucketProvider
Expand Down Expand Up @@ -99,7 +101,7 @@ def main():
command.append(os.getcwd())
print(command)
Copy link
Author

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.


process = subprocess.run(command, text=True, capture_output=True, check=True)
process = safe_command.run(subprocess.run, command, text=True, capture_output=True, check=True)
# Output the result
if process.returncode == 0:
print("Output:", process.stdout)
Expand Down Expand Up @@ -157,4 +159,4 @@ def main():
print("service not found")

if __name__ == "__main__":
main()
main()
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ dependencies = [
"whatthepatch",
"PyGithub",
"GitPython",
"load_dotenv"
"load_dotenv",
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

"security==1.2.1"
]

[project.optional-dependencies]
Expand Down