Skip to content
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

✨[Feature Request]: Filter pip install by Python Package Authority's Security Advisory Database.✨ #13066

Open
1 task done
galenseilis opened this issue Nov 5, 2024 · 2 comments
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature

Comments

@galenseilis
Copy link

galenseilis commented Nov 5, 2024

What's the problem this feature will solve?

It would make a higher-level of package security a default.

Describe the solution you'd like

I would like pip to only download packages that do not have entries in the Python security advisory database by default.

When given a package name without a version I would like pip to filter out packages with security advisories as it searches for viable package versions. If none can be found, then stderr should indicate that.

If a package version is given, then the package should be installed if there is no security advisory, else give a stderr message.

An optional flag to override this behaviour would be appropriate for those that need to work with packages with security advisories, and for cybersecurity specialists they may need to be able to attempt downloading and installing such a package.

Alternative Solutions

There are other tools like PDM, UV, Hatch, and Poetry in which plugins can be written. I expect a plugin which does the security check first before attempting to add a package to a project would also work.

Another partial solution is to use the pip-audit pre-commit hook or github action. These automation tools will not always catch that there is an advisory on a package before it is installed, however.

Manually checking pip-audit is "ok", but the manual nature of it makes it less reliable.

Additional context

Security as a default is important for most organizations (e.g. healthcare), and I expect that most users won't mind it either.

I have made a nearly-identical request for uv to do the same thing. I tend to use pip a lot at work, and uv on personal projects. Security is important in my work (healthcare data science), so whichever supports it if the other doesn't is going to take priority in the future.

Code of Conduct

@galenseilis galenseilis added S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature labels Nov 5, 2024
@galenseilis galenseilis changed the title Filter pip install by Python Package Authority's Security Advisory Database. ✨[Feature Request]: Filter pip install by Python Package Authority's Security Advisory Database.✨ Nov 5, 2024
@notatallshaw
Copy link
Member

There's a recent discussion and early implementation attempt at plugins here: #12766 / #12985

Otherwise, this could be implemented by providing a custom index server that filtered what versions of a package was available. I've not used it, but you could probably implement this using simple index. This would then work with all tools that allow specifying an index server (such as pip and uv).

I suspect as a feature for pip it's unlikely to gain much traction as there are limited volunteer resources and this isn't based on either a Python or a Packaging standard.

@galenseilis
Copy link
Author

@notatallshaw Alright, thank you for sharing those resources with me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: needs triage Issues/PRs that need to be triaged type: feature request Request for a new feature
Projects
None yet
Development

No branches or pull requests

2 participants