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

[securedrop-proxy] No error handling for subprocess.run calls #1685

Closed
legoktm opened this issue Jan 10, 2023 · 0 comments · Fixed by #1718
Closed

[securedrop-proxy] No error handling for subprocess.run calls #1685

legoktm opened this issue Jan 10, 2023 · 0 comments · Fixed by #1718

Comments

@legoktm
Copy link
Member

legoktm commented Jan 10, 2023

None of the subprocess.run calls have any error handling. Either check=True should be passed or the return code should be explicitly checked.

>>> subprocess.run(['false'])
CompletedProcess(args=['false'], returncode=1)
>>> subprocess.run(['false'], check=True)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['false']' returned non-zero exit status 1.

It's also unclear to me why we shell out to cp instead of using shutil.copy2().

@zenmonkeykstop zenmonkeykstop changed the title No error handling for subprocess.run calls [securedrop-proxy] No error handling for subprocess.run calls Dec 13, 2023
@zenmonkeykstop zenmonkeykstop transferred this issue from freedomofpress/securedrop-proxy Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant