Skip to content

[BUG] OrganizationalEntity equality, hash and sorting ignore address #1073

Done

Description

@Fezz-TVM-Labs

Two OrganizationalEntity objects that differ only in address compare as equal, have the same hash, and sort as equal.

from cyclonedx.model.contact import OrganizationalEntity, PostalAddress

a = OrganizationalEntity(name='a', address=PostalAddress(country='DE'))
b = OrganizationalEntity(name='a', address=PostalAddress(country='FR'))
a == b        # True, should be False
len({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:

  1. Create two OrganizationalEntity objects with the same name and different addresses (the code above).
  2. Compare them with ==.
  3. Put both in a set.
  4. 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.

Thanks!
Fezz @ ThreatVector.Management

Activity

  1. added
    bug
    on Nov 25, 2026
  2. jkowalleck commented on Nov 25, 2026

    @jkowalleck
    Member

    this sounds like a bug.

    CycloneDX Python Lib is a community effort - feel free to contribute a fix and the needed tests.

  3. added
    help wanted
    on Nov 25, 2026
  4. added a commit that references this issue on Nov 25, 2026
    f3fb180
  5. jkowalleck commented on Nov 30, 2026

    @jkowalleck
    Member
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bughelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions