News for hackers. Stuff that matters.
Re:What's up Python? Epic CPython commit, Django 5 and 2FA f... by IshKebab on Thursday December 28, 2023 @04:49AM (#38791783)
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 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.

Re:What's up Python? Epic CPython commit, Django 5 and 2FA f... by failsecured on Thursday December 28, 2023 @11:26AM (#38795094)
2 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.

Re:What's up Python? Epic CPython commit, Django 5 and 2FA f... by IshKebab on Thursday December 28, 2023 @02:38PM (#38797608)
I don't think that works if the private packages depend on public ones, which is quite likely.
Re:What's up Python? Epic CPython commit, Django 5 and 2FA f... by failsecured on Thursday December 28, 2023 @09:33PM (#38801217)
You are completely correct. I neglected to mention that we mirror/cache the dependencies we need in our private index.