-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use shell=False
for subprocess calls
#58
Conversation
Odd, I thought I disabled the cross-file similarity checker... https://github.com/uclahs-cds/docker-CICD-base/pull/68 |
Okay, I had to pull the common
|
Changes look good! I think the tests will need to be updated to reflect the |
Ah yeah I didn't run the tests for myself (there should be an action for that...) but I'll do so this morning. |
Okay, the tests now run correctly: $ git rev-parse HEAD
aca1840371ee339fea01af8703768265dd5bf76b
$ pytest
============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-7.4.4, pluggy-1.3.0
rootdir: /hot/code/nwiltsie/tools/tool-NFTest
collected 17 items
test/unit/test_NFTestAssert.py ......... [ 52%]
test/unit/test_NFTestCase.py .. [ 64%]
test/unit/test_NFTestEnv.py .. [ 76%]
test/unit/test_NFTestRunner.py . [ 82%]
test/unit/test_common.py ... [100%]
============================== 17 passed in 0.70s ============================== |
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.
Looks good!
Description
This PR switches both instances of
subprocess.Popen
(launching Nextflow and launching the custom assert script) to useshell=False
.It's generally recommended to use
shell=False
to avoid any potential shell injections.One subtle change associated with this is that we have to set the
NXF_WORK
environment variable via theenv
argument ofsubprocess.Popen
, rather than embedding it in the command string.env
is the complete set of environment variables so we have to merge the current process's environment with our changes ({**os.environ, **envmod}
).I tested this by adding a custom comparison script to pipeline-recalibrate-BAM's NFTest suite:
The NFTest log file (
/hot/software/pipeline/pipeline-recalibrate-BAM/Nextflow/development/unreleased/main/log-nftest-20240111T231156Z.log
) shows that both the Nextflow invocation...... and the comparison invocations...
... are well-formatted and function appropriately (
compare.py
just prints the inputs and exits with0
).Checklist
This PR does NOT contain Protected Health Information (PHI). A repo may need to be deleted if such data is uploaded.
Disclosing PHI is a major problem1 - Even a small leak can be costly2.
This PR does NOT contain germline genetic data3, RNA-Seq, DNA methylation, microbiome or other molecular data4.
.png
, .jpeg
),.pdf
,.RData
,.xlsx
,.doc
,.ppt
, or other output files.To automatically exclude such files using a .gitignore file, see here for example.
I have read the code review guidelines and the code review best practice on GitHub check-list.
I have set up or verified the
main
branch protection rule following the github standards before opening this pull request.The name of the branch is meaningful and well formatted following the standards, using [AD_username (or 5 letters of AD if AD is too long)]-[brief_description_of_branch].
I have added the major changes included in this pull request to the
CHANGELOG.md
under the next release version or unreleased, and updated the date.Footnotes
UCLA Health reaches $7.5m settlement over 2015 breach of 4.5m patient records ↩
The average healthcare data breach costs $2.2 million, despite the majority of breaches releasing fewer than 500 records. ↩
Genetic information is considered PHI.
Forensic assays can identify patients with as few as 21 SNPs ↩
RNA-Seq, DNA methylation, microbiome, or other molecular data can be used to predict genotypes (PHI) and reveal a patient's identity. ↩