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

Fix logic error in get_components_without_suppliers #176

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

jspeed-meyers
Copy link
Collaborator

Fix #157

Only the supplier field should be checked to determine if the supplier field is missing a value. Previously the code checked both the supplier and the originator fields, on the mistaken assumption that either field counted as the package supplier. Oops.

THIS IS A BREAKING CHANGE.

I revised the test suite substantially since this was a logic error. Many test SBOM documents needed a minor tweak.

Only the supplier field should be checked to determine if the supplier field
is missing a value. Previously the code checked both the supplier and the originator
fields, on the mistaken assumption that either field counted as the package supplier.

Signed-off-by: John Speed Meyers <jsmeyers@chainguard.dev>
@jspeed-meyers jspeed-meyers added bug Something isn't working breaking-change labels Mar 23, 2024
@jspeed-meyers jspeed-meyers self-assigned this Mar 23, 2024
Comment on lines -98 to -100
no_package_originator = package.originator is None or isinstance(
package.originator, SpdxNoAssertion
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the critical logic change.

Comment on lines -92 to -94
# both package supplier and package originator satisfy the "supplier"
# requirement
# https://spdx.github.io/spdx-spec/v2.3/package-information/#76-package-originator-field
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed this erroneous comment.

# requirement
# https://spdx.github.io/spdx-spec/v2.3/package-information/#76-package-originator-field
no_package_supplier = package.supplier is None or isinstance(
no_supplier = package.supplier is None or isinstance(
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I simplified the variable naming here, changing no_package_supplier to no_supplier

"originator" : "Organization: ExampleCodeInspect (contact@example.com)",
"originator" : "NOASSERTION",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes exemplify the test suite changes I made over and over. I removed the originator value, changing it to "NOASSERTION" and did provide a value for supplier.

Copy link
Member

@goneall goneall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - Thanks @jspeed-meyers

@jspeed-meyers jspeed-meyers merged commit e82010c into spdx:main Mar 23, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Package supplier and originator fields, is having both as NOASSERTION is not EO compliant?
2 participants