-
Notifications
You must be signed in to change notification settings - Fork 614
[Python] - Fix for security vulnerability GHSA-r9hx-vwmv-q579 for setuptools-65.5.0 lib on python using debian image #814
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
Closed
gauravsaini04
wants to merge
1
commit into
devcontainers:main
from
gauravsaini04:setuptools_vulnerability_on_python3_10_fix_on_debian_image
+89
−0
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/bash | ||
|
|
||
| set -e | ||
|
|
||
| # Optional: Import test library | ||
| source dev-container-features-test-lib | ||
|
|
||
| #check "setuptools version 65.5.0 not installed" bash -c "ls -lrt /usr/local/py-utils/shared/lib/python3.11/site-packages/setuptools-65.5.0.dist-info" | ||
| #checkPythonPackageVersion "setuptools" "65.5.1" | ||
|
|
||
| # Check that tools can execute - make sure something didn't get messed up in this scenario | ||
| check "autopep8" autopep8 --version | ||
| check "black" black --version | ||
| check "yapf" yapf --version | ||
| check "bandit" bandit --version | ||
| check "flake8" flake8 --version | ||
| check "mypy" mypy --version | ||
| check "pycodestyle" pycodestyle --version | ||
| check "pydocstyle" pydocstyle --version | ||
| check "pylint" pylint --version | ||
| check "pytest" pytest --version | ||
| check "setuptools" pip list | grep setuptools | ||
|
|
||
| # Check paths in settings | ||
| check "current symlink is correct" bash -c "which python | grep /usr/local/python/current/bin/python" | ||
| check "current symlink works" /usr/local/python/current/bin/python --version | ||
| check "which autopep8" bash -c "which autopep8 | grep /usr/local/py-utils/bin/autopep8" | ||
| check "which black" bash -c "which black | grep /usr/local/py-utils/bin/black" | ||
| check "which yapf" bash -c "which yapf | grep /usr/local/py-utils/bin/yapf" | ||
| check "which bandit" bash -c "which bandit | grep /usr/local/py-utils/bin/bandit" | ||
| check "which flake8" bash -c "which flake8 | grep /usr/local/py-utils/bin/flake8" | ||
| check "which mypy" bash -c "which mypy | grep /usr/local/py-utils/bin/mypy" | ||
| check "which pycodestyle" bash -c "which pycodestyle | grep /usr/local/py-utils/bin/pycodestyle" | ||
| check "which pydocstyle" bash -c "which pydocstyle | grep /usr/local/py-utils/bin/pydocstyle" | ||
| check "which pylint" bash -c "which pylint | grep /usr/local/py-utils/bin/pylint" | ||
| check "which pytest" bash -c "which pytest | grep /usr/local/py-utils/bin/pytest" | ||
|
|
||
| echoStderr() | ||
| { | ||
| echo "$@" 1>&2 | ||
| } | ||
|
|
||
| checkVulnerableDir() | ||
| { | ||
| DIRECTORY=$1 | ||
| VERSION=$2 | ||
|
|
||
| if [ "${VERSION}" == "3.10" ] && [ -d $DIRECTORY ] ; then | ||
| echoStderr "❌ check for vulnerable setuptools version failed for python3.10." | ||
| return 1 | ||
| elif [ "${VERSION}" == "3.11" ] && [ -d $DIRECTORY ]; then | ||
| echoStderr "❌ check for vulnerable setuptools version failed for python3.11." | ||
| return 1 | ||
| else | ||
| echo "✅ Passed! Either the container does not have vulnerable version or vulnerable version specific directory got removed." | ||
| return 0 | ||
| fi | ||
| } | ||
|
|
||
| # only for 3.10 | ||
| checkVulnerableDir "/usr/local/py-utils/shared/lib/python3.10/site-packages/setuptools-65.5.0.dist-info" "3.10" | ||
| checkVulnerableDir "/usr/local/python/3.10.13/lib/python3.10/site-packages/setuptools-65.5.0.dist-info" "3.10" | ||
| # only for 3.11 | ||
| checkVulnerableDir "/usr/local/py-utils/shared/lib/python3.11/site-packages/setuptools-65.5.0.dist-info" "3.11" | ||
| checkVulnerableDir "/usr/local/python/3.11.7/lib/python3.11/site-packages/setuptools-65.5.0.dist-info" "3.11" | ||
|
|
||
| # Report result | ||
| reportResults |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Feel free to add this scenario and test file to #809.
It would be great to validate if we are breaking any other scenarios.