3 ms·
I think you have the wrong idea of what dependency confusion is. Here's the scenario: 1. Company develops package `company_secret_project_stuff` and publishes
by IshKebab 3y ago
I think you have the wrong idea of what dependency confusion is. Here's the scenario:
1. Company develops package `company_secret_project_stuff` and publishes version 1 on their internal private PyPI instance.
2. They tell their employees to install it via `python3 -m pip install --extra-index-url https://pypi.intranet.company.com https://pypi.intranet.company.com company_secret_project_stuff`
3. pip dutifully goes and installs the hacker's version of `company_secret_project_stuff` (version 999999) from the global PyPI index.
I know for a fact that my company is vulnerable to this. The only solution currently is for the company to also register `company_secret_project_stuff` on the global PyPI. But you can guess how happy they were about exposing internal package names. They opted to remain vulnerable instead (yes; stupid decision but I can kind of see their point).
Namespaces trivially fix this. You just register the `@company` namespace on the global PyPI index and then make sure all your private packages are in that namespace. Attackers can't publish packages with the same name as yours, and you don't need to make them all public.
- failsecured 3y ago2 pip installs can trivially solve this issue and I use this at work. One pip install only for private packages using the --index-url (NOT --extra-index-url) and then the other pip install for public packages no index modifiers needed.
- IshKebab 3y agoI don't think that works if the private packages depend on public ones, which is quite likely.
- failsecured 3y agoYou are completely correct. I neglected to mention that we mirror/cache the dependencies we need in our private index.