stevearc / pypicloud

S3-backed pypi server implementation
MIT License
507 stars 141 forks source link

Same package uploaded in private/public, which is chosen? #288

Closed agates4 closed 3 years ago

agates4 commented 3 years ago

From this pip issue, https://github.com/pypa/pip/issues/8606

And this article outlining the security flaws, https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610

I have a few questions to clarify the pypicloud behavior:

Thank you for a great project!

stevearc commented 3 years ago

There are two configuration options that are designed to help with this: pypi.always_show_upstream and pypi.disallow_fallback.

The default behavior for always_show_upstream (false) is if pypicloud has any packages with a specific name, it will not show upstream versions of that package. This means that by default if you are using pypicloud you should not be vulnerable to this type of attack. Of course, if you're passing an additional index into your pip install command that opens it up again, but that has nothing to do with pypicloud.

If you must set pypi.always_show_upstream = true, the second option of pypi.disallow_fallback allows you to manually specify a list of package names that should never be fetched from upstream. As long as you specify your internal packages there, you should be good.