-
Notifications
You must be signed in to change notification settings - Fork 51
Avoid using --extra-index-url for security
#2062
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Pull Request Overview
This PR addresses a dependency confusion security vulnerability by changing how the hip-python package is installed. Instead of using --extra-index-url which searches both PyPI and TestPyPI (potentially allowing a malicious package takeover), it now uses --index-url to exclusively install from AMD's TestPyPI repository.
Key Changes:
- Removed
--extra-index-urlconfiguration andhip-pythonfrompip_requirements.txt - Added explicit
pip3 installcommand with--index-urlin the Dockerfile to installhip-pythonexclusively from TestPyPI
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pip_requirements.txt | Removed TestPyPI index URL and hip-python dependency to prevent dependency confusion attacks |
| mlir/utils/jenkins/Dockerfile | Added dedicated install command for hip-python using --index-url to restrict package source to TestPyPI only |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Pull Request Overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Motivation
pip3 installsearches for a package both on PyPI and on--extra-index-urlif it is provided. If a package with same name exists on both then it picks the package with higher version from both.Currently on PyPI
hip-pythonpackage doesn't exist. Therefore someone can publishhip-pythonpackage with higher version on PyPI and in that case rocMLIR will fetch that one. This is a security vulnerability. This PR fixes that.Technical Details
Specifying
--index-urlwill force pip to install package from specific URL only.hip-pythonpackage onTestPyPIis owned by AMD. Therefore need to use that specific URL only.--index-urlcan not be specific per package basis inrequirements.txtfile therefore i've moved it directly into Dockerfile.https://www.websecuritylens.org/how-dependency-confusion-attack-works-and-how-to-prevent-it/
https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610