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

CPE improvements #922

Merged
merged 3 commits into from
Nov 8, 2023
Merged

CPE improvements #922

merged 3 commits into from
Nov 8, 2023

Conversation

bjoernricks
Copy link
Contributor

@bjoernricks bjoernricks commented Nov 7, 2023

What

Allow access to unquoted values of a CPE. Before the returned values are quoted according to the the well-formed CPE name (WFN) in the spec at https://nvlpubs.nist.gov/nistpubs/Legacy/IR/nistir7695.pdf

The CPE implementation follows the spec very very closely. In future we might loosen the spec implementation a bit more by dropping the WNF and its quoting. But for now we keep the WNF values in an internal dataclass of the CPE.

Why

Allow to use the values directly for usage in applications without requiring to convert them to get the "real" values for example CPE version 1.2.3 instead of 1\.2\.3.

Checklist

  • Tests

Rename some CPE functions and extend their doc strings for explaining
their purpose even better. Add some additional tests for some functions
to ensure they are working as expected despite already being tested
implicitly.
Currently the CPE parsing model stores quoted well-formed CPE name (WNF)
attribute values. This is not ideal for using them in the application
logic. For example a version attribute will always return something like
`"1\.2\.3"` as it's value. Therefore add a new function that allows to
convert these values into their unquoted form.
…"1\.2")

When parsing a CPE and accessing its attributes the returned values are
now unquoted instead of being quoted according to the WNF. Using the
unquoted value allows to use them directly now.
@bjoernricks bjoernricks requested a review from a team as a code owner November 7, 2023 15:13
@greenbonebot greenbonebot enabled auto-merge (rebase) November 7, 2023 15:13
Copy link

github-actions bot commented Nov 7, 2023

Conventional Commits Report

Type Number
Changed 2
Added 1

🚀 Conventional commits found.

Copy link

codecov bot commented Nov 7, 2023

Codecov Report

Merging #922 (a11b270) into main (a9dc39e) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #922      +/-   ##
==========================================
+ Coverage   90.23%   90.32%   +0.09%     
==========================================
  Files          95       95              
  Lines        6635     6666      +31     
  Branches      953      957       +4     
==========================================
+ Hits         5987     6021      +34     
+ Misses        442      441       -1     
+ Partials      206      204       -2     
Files Coverage Δ
pontos/cpe/_cpe.py 95.66% <100.00%> (+1.76%) ⬆️

📣 Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in Chrome or Firefox today!

@bjoernricks bjoernricks added the make release To trigger GitHub release action. label Nov 7, 2023
@greenbonebot greenbonebot merged commit 2bb3784 into main Nov 8, 2023
21 checks passed
@greenbonebot greenbonebot deleted the cpe-improvements branch November 8, 2023 06:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
make release To trigger GitHub release action.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants