You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] OrganizationalEntity equality, hash and sorting ignore address #1073
Two OrganizationalEntity objects that differ only in address compare as equal, have the same hash, and sort as equal.
fromcyclonedx.model.contactimportOrganizationalEntity, PostalAddressa=OrganizationalEntity(name='a', address=PostalAddress(country='DE'))
b=OrganizationalEntity(name='a', address=PostalAddress(country='FR'))
a==b# True, should be Falselen({a, b}) # 1, should be 2
The comparison tuple in cyclonedx/model/contact.py has name, urls, contacts and bom_ref, but not address. Looks like the same kind of gap that #1021 fixed for ComparablePackageURL.
Details (version, setup and steps, as the CycloneDX contributing guide asks):
Version: cyclonedx-python-lib 11.12.0 (also on main at 45da84a)
Environment: Python 3.14 on Linux, the same Python your CI uses
Steps to reproduce:
Create two OrganizationalEntity objects with the same name and different addresses (the code above).
Compare them with ==.
Put both in a set.
Sort a list holding both.
Expected: they are not equal, the set holds two, and they sort apart.
Actual: they are equal, the set holds one, and they sort as equal.
I have a one-line fix and a test ready. Happy to open the PR if that's ok with you.
Full disclosure: I used an AI coding assistant to help put this together. We went through the whole diff and tested it.
Activity
jkowalleck commentedon Nov 25, 2026
this sounds like a bug.
CycloneDX Python Lib is a community effort - feel free to contribute a fix and the needed tests.
fix: `OrganizationalEntity` equality, hash and sorting consider `addr…
jkowalleck commentedon Nov 30, 2026
fixed per https://github.com/CycloneDX/cyclonedx-python-lib/releases/tag/v11.14.0