Skip to content

License Schema Inconsistency between XML/JSON  #133

Closed

Description

@TiberiusDRAIG

The XML schema does not require an ID for the license property, whereas the JSON schema not only requires it but also enforces that it be one of the SPDX values specified.

This causes problems when a package does not provide an SPDX ID; for example, Microsoft's System.IO package, which only provides a URL, results in the cyclonedx-dotnet tool generating this:

<license> <url>http://go.microsoft.com/fwlink/?LinkId=329770</url> </license>

This validates successfully against the XML schema.

The equivalent JSON:

"license": { "url": "http://go.microsoft.com/fwlink/?LinkId=329770" }

...is considered invalid as it has no ID.

Activity

  1. TiberiusDRAIG commented on Feb 11, 2022

    @TiberiusDRAIG
    Author

    Ah, sorry - realised I was misreading the JSON schema and 'Name' can be used instead. What, however, should we be doing if a package doesn't provide a license name? Is this a case of manually updating the BOM by hand?

    EDIT: This is still inconsistent since 'choice' in the XML schema doesn't enforce that at least one element must be present, but rather that only one of the elements can be present.

  2. stevespringett commented on Feb 11, 2022

    @stevespringett
    Member

    What, however, should we be doing if a package doesn't provide a license name?

    I would recommend naming the license after 1) the name of the project, or 2) the name of the organization, whichever is most relevant. The important thing is to capture the complete license text for non-standard licenses.

    For example:

    This is still inconsistent since 'choice' in the XML schema doesn't enforce that at least one element must be present, but rather that only one of the elements can be present.

    I'm not entirely sure why that is. Will need to investigate.

    See also: https://cyclonedx.org/use-cases/#license-compliance

  3. TiberiusDRAIG commented on Feb 16, 2022

    @TiberiusDRAIG
    Author

    Okay, thanks - I'll use the CycloneDX Core models to add-in the missing information in a follow-up script.

  4. added this to the 2.0 milestone on Jan 22, 2023
  5. jkowalleck commented on Jul 12, 2023

    @jkowalleck
    Member

    this report appears to be still relevant.
    https://github.com/CycloneDX/specification/blob/1.5/schema/bom-1.5.xsd#L643-L654

    change/patch

                <xs:choice>
    -               <xs:element name="id" type="spdx:licenseId" minOccurs="0" maxOccurs="1">
    +               <xs:element name="id" type="spdx:licenseId" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>A valid SPDX license ID</xs:documentation>
                        </xs:annotation>
                    </xs:element>
    -               <xs:element name="name" type="xs:normalizedString" minOccurs="0" maxOccurs="1">
    +               <xs:element name="name" type="xs:normalizedString" minOccurs="1" maxOccurs="1">
                        <xs:annotation>
                            <xs:documentation>If SPDX does not define the license used, this field may be used to provide the license name</xs:documentation>
                        </xs:annotation>
                    </xs:element>
                </xs:choice>

    unfortunately, this would be a breaking change, even though it fixes a "bug"

  6. jkowalleck commented on Oct 15, 2023

    @jkowalleck
    Member

    is duplicated by #288

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions