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

Improve setup.py analyzer #2052

Open
thomas-bc opened this issue Aug 23, 2023 · 2 comments
Open

Improve setup.py analyzer #2052

thomas-bc opened this issue Aug 23, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@thomas-bc
Copy link

thomas-bc commented Aug 23, 2023

Context

From what I have seen in #59, #150, anchore/grype#126, it seems that there has been a conscious decision that was made to only capture pinned dependencies (i.e. bound with ==) in setup.py.

I am trying to understand why this decision was made. Could we accept in a scenario where a dependency is lower-bound (e.g. >=, it is acceptable to link to the lowest version of the dependency? This seems better to me than not finding the dependency at all.

What would you like to be added:

Add parsing of all dependencies, including those bound with >=, <= etc...

Why is this needed:

Improve consistency of setup.py analyses. It sounds in my opinion better to have a wrongfully-versioned dependency analysis, rather than no dependency at all.

@thomas-bc thomas-bc added the enhancement New feature or request label Aug 23, 2023
@thomas-bc
Copy link
Author

Or is it intended that this should not be relied on?
I have been doing the following workaround:

  • create a fresh virtual environment
  • pip install <package>
  • pip freeze > requirements.txt
  • run syft/grype on that requirements.txt

Would that be the recommended approach?

@tgerla
Copy link
Contributor

tgerla commented Aug 24, 2023

Hi @thomas-bc, your workaround to freeze the dependencies ahead of time is indeed a good approach. We recently improved the requirements.txt cataloger with the capability to "guess unpinned requirements" (#1966) which I believe would solve this problem if it were ported to the setup.py cataloger.

We will add this to our backlog for the future, but if you're interested in helping port the changes over to the setup.py cataloger, let us know and we can help get you started.

Outstanding question: do we need to add another configuration item for setup.py, or can we reuse the "guess-unpinned-requirements" setting?

@tgerla tgerla moved this to Backlog in OSS Aug 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Backlog
Development

No branches or pull requests

2 participants