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

Make CPE matching case insensitive #2

Merged
merged 7 commits into from
Dec 10, 2024
Merged

Conversation

kissgyorgy
Copy link

According to Common Platform Enumeration: Naming Specification Version 2.3 Section 2.3
and
Common Platform Enumeration: Name Matching Specification Version 2.3 Section 7.3 and 6.1.3.2,

CPE attributes should be lowercased before comparing them.

In practice, all CPEs in the CVE Database are in lowercase, that shouldn't be a problem, but comparing with user input (like CPE coming from an SBOM) should work according to the specification.

@kissgyorgy kissgyorgy self-assigned this Nov 15, 2024
@kissgyorgy kissgyorgy force-pushed the fix-matching-case branch 2 times, most recently from 64c35ae to e2a37e5 Compare November 18, 2024 12:25
kissgyorgy and others added 6 commits November 18, 2024 13:39
For a seamless developer experience
- Follows nixpkgs-unstable
- Python 3.11 because that's what we are using internally everywhere
We need to test all supported versions.
Use poetry with separate virtualenvs for all in .venvs/

Ruff UP rules had to be disabled to allow for old typing syntax.
We don't use it and I don't know the use-case for it.
This simplifies public API for the library.
type hints and make CPE matching more readable.
No logical change, everything should work the same as before.
According to

Common Platform Enumeration: Naming Specification Version 2.3
Section 2.3
and
Common Platform Enumeration: Name Matching Specification Version 2.3
Section 7.3 and 6.1.3.2

CPE attributes should be lowercased before comparing them.

In practice, all CPEs in the CVE Database are in lowercase,
that shouldn't be a problem, but comparing with user input
(like CPE coming from an SBOM) should work according to the
specification.
Use the same ruff version as for devenv, so results will be the same in
CI as locally.
Updated deprecated ruff options.
@martonilles martonilles merged commit 9ac546e into master Dec 10, 2024
12 checks passed
@kissgyorgy kissgyorgy deleted the fix-matching-case branch January 6, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants