Readit News logoReadit News
Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
zahlman · 4 months ago
Sure, they presumably have a local dev environment where they install dependencies to test their own code.

But there are a lot of possible workflows around that. Some people might separately install things one at a time according to what they appear to need as they're developing, and then use `pip freeze` to create the `requirements.txt` file. Others might edit `requirements.txt` directly, and repeatedly re-create their environment based off that. Still others might involve any number of tools here, such as pip-tools (https://pypi.org/project/pip-tools/), pipenv (https://pypi.org/project/pipenv/), etc.

Feynmanix · 4 months ago
As long as they run `pip install` locally at any point in their process before pushing to the repo, they should get the opportunity to see the pipask report.
Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
pseufaux · 4 months ago
Isn't this what pyproject.toml solves? Genuine question as I am blissfully unaware of the intricacies dependency resolution.
Feynmanix · 4 months ago
Have a look at the diagram in the accompanying blog post https://medium.com/data-science-collective/pipask-know-what-... , it explains how the process works.

In short, you can get metadata from pyproject.toml, but (a) it can still involve executing code due to PEP 517 hooks, and (b) a malicious package would use the legacy setup.py to get their code executed.

Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
zahlman · 4 months ago
Quite a few people use requirements.txt files with pip actually. I've seen many projects that even expect end users to do so. You might not notice - exactly because they aren't packaging for PyPI.
Feynmanix · 4 months ago
But before committing requirements.txt to git, they still run install locally, right?
Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
ashishbijlani · 4 months ago
Plug: I've been building a similar tool: https://github.com/ossillate-inc/packj

Packj uses static+dynamic code/behavioral analysis to scan for indicators of compromise (e.g., spawning of shell, use of SSH keys, network communication, use of decode+eval, etc). It also checks for several metadata attributes to detect impersonating packages (typo squatting).

Feynmanix · 4 months ago
Thanks, I'll have a look, possibly add a link to it
Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
scsh · 4 months ago
Yes in this particular case, where I'm trying to install fastapi, I'd rather it direct me to https://osv.dev/vulnerability/PYSEC-2024-38 which is more fastapi specific and mentions that the fixed version of fast api is 0.109.1. Or even better, give the link and print the fixed version from the advisory yaml https://github.com/pypa/advisory-database/blob/main/vulns/fa...
Feynmanix · 4 months ago
I'll have a look at that
Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
simonw · 4 months ago
Can it spit out a visible URL for those of us who use the default macOS terminal app?
Feynmanix · 4 months ago
Yes, I can! Will be in the next release
Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
zahlman · 4 months ago
Pip is "a proper dependency resolver". It just perhaps doesn't have the best heuristics for performance, but they're working on that.

What pip isn't is a workflow tool for developers, or "project manager" (terminology uv uses in its marketing; "package manager" seems to be not well enough defined to argue about). Pip doesn't install Python, create or manage virtual environments (or real ones for the separately installed Python versions), upload your packages to PyPI, view a lockfile as a way to keep track of an environment (although they have just added experimental support for creating PEP 751 lockfiles and are planning support for installing from them), do one-off runs of Python applications (by installing them in an ephemeral environment, possibly installing PEP 723 inline-specified dependencies), define or manage "workspaces", have its own `[tool.pip]` section in pyproject.toml, or possibly other things I forgot.

But it absolutely does determine the dependencies of the packages you're currently asking to install, transitively, attempt to figure out a compatible set of versions, and figure out which actual build artifacts to use (i.e., "resolve dependencies"). Its logic for doing so has even been extracted and made available as the `resolvelib` package (https://pypi.org/project/resolvelib/).

My own project, PAPER, is scoped to fix pip's problems and also do basic environment management (so as to install applications or do temporary runs). The point is to satisfy the needs of Python users, while not explicitly catering to developers. (I'll probably separately offer some useful developer scripts that leverage the functionality.)

I also, incidentally, intend to allow for this sort of prompt during the install procedure. (Although the planned default is to refuse sdists entirely.)

Feynmanix · 4 months ago
Do you have a link where I can learn more about PAPER?
Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
scsh · 4 months ago
I like the idea of having vuln reporting in the installation step. Looking at the examples provided though, I think the vulnerability reporting could use a bit more information.

Using the fastapi example, it points to CVE-2024-24762 which, if you're looking at the NIST or CVE pages for it, doesn't give the clearest info for how to resolve.

Maybe consider linking to advisories in the Python Packaging Advisory Database when possible, like pip-audit does. https://osv.dev/vulnerability/PYSEC-2024-38 is a lot clearer that fastapi is affected and which version fixed the vulnerability.

Feynmanix · 4 months ago
It's not visible on the screenshot for some reason, but if you run the latest version, you'll notice a little underline under the CVE mention. It's actually a hyperlink (Cmd+click in iTerm2) that leads to https://osv.dev/vulnerability/CVE-2024-24762 where you can find out more.

Or are you saying you'd rather it leads to https://osv.dev/vulnerability/PYSEC-2024-38 rather than https://osv.dev/vulnerability/CVE-2024-24762 ?

Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
zahlman · 4 months ago
So, this is a fork of pip that adds the described checks to the UI? Looks like it also doesn't vendor dependencies like pip does, which is probably fine - you'll have to use something like (like pip) to bootstrap it, but this doesn't have the special-case requirements that motivate that design choice for pip (like being bootstrapped via standard library `ensurepip`).
Feynmanix · 4 months ago
Yes, the reason I had to fork pip was that the dependency resolution logic is too complex and I couldn't recreate it from scratch with fidelity.

You're right I don't vendor dependencies, and I hope to get away with it exactly because I don't have the bootstrapping problem. In practice, you want to install pipask with pipx so that the dependencies don't mess with your local environment.

Feynmanix commented on Show HN: Pipask – safer pip without compromising convenience   github.com/feynmanix/pipa... · Posted by u/Feynmanix
ATechGuy · 4 months ago
Looks like a useful tool. Congrats on shipping! Many packages are installed automatically in environments like CI/CD pipelines or Dockerfiles, where interactive review and consent aren't possible. How do you plan to handle such scenarios?
Feynmanix · 4 months ago
Ideally, you should use lockfiles for your CI/CD or docker. To create or update the lockfile, a developer needs to install dependencies manually first (as in `pip install X` -> `pip freeze`), at which point the checks would be executed and the user would consent.

That said, it's pretty uncommon to use lockfiles with pip, so I'm considering creating something like a plugin for poetry or uv, if there is demand?

u/Feynmanix

KarmaCake day24May 2, 2025View Original