Skip to content

Commit

Permalink
Fix critical security issues. (#301)
Browse files Browse the repository at this point in the history
* Fix critical security issues.

* Fix critical security issues.

* Fix critical security issues.
  • Loading branch information
everaldorodrigo committed Oct 18, 2023
1 parent ebe24dc commit adc7b72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion biothings/utils/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
def get_python_version():
"""Get a list of python packages installed and their versions."""
try:
output = check_output(f'{sys.executable or "python3"} -m pip list', shell=True, stderr=DEVNULL)
output = check_output([sys.executable or "python3", "-m", "pip", "list"], stderr=DEVNULL)
return output.decode("utf-8").replace("\r", "").split("\n")[2:-1]
except Exception:
return []
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ def read(fname):
# version gets set to MAJOR.MINOR.# commits on master branch if installed from pip repo
# otherwise to MAJOR.MINOR.MICRO as defined in biothings.version
try:
NUM_COMMITS = check_output("git rev-list --count master", shell=True).strip().decode("utf-8")
command = ["git", "rev-list", "--count", "master"]
NUM_COMMITS = check_output(command).strip().decode("utf-8")
except CalledProcessError:
NUM_COMMITS = ""

# Calculate commit hash, should fail if installed from source or from pypi
try:
COMMIT_HASH = check_output("git rev-parse HEAD", shell=True).strip().decode("utf-8")
command = ["git", "rev-parse", "HEAD"]
COMMIT_HASH = check_output(command).strip().decode("utf-8")
except CalledProcessError:
COMMIT_HASH = ""

Expand Down

0 comments on commit adc7b72

Please sign in to comment.