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

Leading zeros seen as difference in version numbers #1430

Closed
FlorianPfaff opened this issue Aug 12, 2023 · 2 comments · Fixed by #1510
Closed

Leading zeros seen as difference in version numbers #1430

FlorianPfaff opened this issue Aug 12, 2023 · 2 comments · Fixed by #1510
Assignees
Labels
bug Something isn't working false-positive

Comments

@FlorianPfaff
Copy link

FlorianPfaff commented Aug 12, 2023

Thanks for the nice tool. I am encountering an issue and am not 100 % sure if this is intended behavior or not. If this is intended behavior, it should be handled differently elsewhere.

What happened:
I got the report
❌ Linted [REPOSITORY] files with [grype]: Found 1 error(s) - (11.02s) (expand for details)

What you expected to happen:
No error because it is the version in which it is already fixed.

How to reproduce it (as minimally and precisely as possible):
Have
certifi==2023.7.22 ; python_version >= "3.10" and python_version < "3.13"
in the requirements.txt, install it and run grype.

Anything else we need to know?:
This may be intended behavior - I am not sure. In this case, whatever is used to check the version should properly output it in the format required for grype.

Environment:

  • Output of grype version:
    v0.63.1
  • OS (e.g: cat /etc/os-release or similar):
    MegaLinter image based on alpine linux.
  • Image Creation Date: 2023-08-09T22:49:15Z
  • Image Revision: fda6ac3a38be0e969820709ac16e442464e5a035
  • Image Version: v7.3.0
@FlorianPfaff FlorianPfaff added the bug Something isn't working label Aug 12, 2023
@kzantow kzantow changed the title False positive? Trailing zeros seen as difference in version numbers False positive? Leading zeros seen as difference in version numbers Aug 14, 2023
@kzantow kzantow changed the title False positive? Leading zeros seen as difference in version numbers Leading zeros seen as difference in version numbers Aug 14, 2023
@kzantow
Copy link
Contributor

kzantow commented Aug 14, 2023

Looking at GHSA-xqr8-7jwr-rhp7, you'll see that it does, in fact have the 07 in the fixed-in version: 2023.07.22. I'm not entirely sure what the correct format is, but I think this is something Grype should be able to handle when doing version comparisons, at least for Python packages.

@crimsonknave
Copy link

I've submitted and update to the advisory db which has been merged and the advisory how has 2023.7.22 as the patched version.

But, as noted in the PR, tooling should handle this case correctly as it's stated as a valid format in PEP440: https://peps.python.org/pep-0440/#integer-normalization. I'm sure it won't be the last time the version has a leading 0 in it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working false-positive
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants