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

Fixed off by one error #223

Merged
merged 1 commit into from
Apr 16, 2024
Merged

Conversation

aidankeefe2022
Copy link
Contributor

Fixed off by one error where when all ID elements are removed there was a 1/n ratio given by SBOMqs instead of the expected 0/n ratio. Where n is the total number of packages.

In the new code, the scores are still accurate, showing the ID feature's correct ratio.
When 0 elements are removed SBOMqs returned this ratio:

{
"category": "NTIA-minimum-elements",
"feature": "comp_with_uniq_ids",
"score": 9.375,
"max_score": 10,
"description": "15/16 have unique ID's",
"ignored": false
},

this ratio was verified by hand to be correct.

When 4 elements are removed,

"category": "NTIA-minimum-elements",
"feature": "comp_with_uniq_ids",
"score": 6.875,
"max_score": 10,
"description": "11/16 have unique ID's",
"ignored": false

The ratio is reduced by 4.

When all ID values are removed with the new change :

{
"category": "NTIA-minimum-elements",
"feature": "comp_with_uniq_ids",
"score": 0,
"max_score": 10,
"description": "0/16 have unique ID's",
"ignored": false
},

Again this was confirmed by hand.

In prechange code sometimes this ratio would be left as a 1/n. Now the ratio is reflective of the reality of the SBOM.

This was tested on 1000 SBOMs in CDX and SPDX generated by Trivy and Syft and scores are accurate and change with what is removed accurately in the ID field.

Fixed off by one error where when all ID elements are removed there was a 1/n ratio given by SBOMqs instead of the expected 0/n ratio
@riteshnoronha
Copy link
Contributor

awesome will review. am out at the oss summit, will get to this tomorrow. Thanks for your contribution.

@riteshnoronha
Copy link
Contributor

Approved. Thanks @aidankeefe2022

@riteshnoronha riteshnoronha merged commit ca4f441 into interlynk-io:main Apr 16, 2024
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.

None yet

2 participants