Skip to content

Conversion from CycloneDX to SPDX creates invalid SPDX #448

@vargenau

Description

@vargenau

SPDX JSON file: https://raw.githubusercontent.com/OpenChain-Project/Telco-WG/refs/heads/main/tools/openchain_telco_sbom_validator/open-source-compliance-artifacts/openchain-telco-sbom-validator-0.1.6.spdx.json

cyclonedx --version
0.28.2+37262579cb974d91c949f394ba5811a5f8e11202

Convert from SPDX to CycloneDX:

cyclonedx convert --input-file openchain-telco-sbom-validator-0.3.1.spdx.json --input-format spdxjson --output-file openchain-telco-sbom-validator-cyclonedx-0.3.1.cdx.json --output-format json

Result is valid CycloneDX 1.6:

cyclonedx validate --input-file openchain-telco-sbom-validator-cyclonedx-0.3.1.cdx.json
BOM validated successfully.

Converting back to SPDX:

cyclonedx convert --input-file openchain-telco-sbom-validator-cyclonedx-0.3.1.cdx.json --input-format json --output-file openchain-telco-sbom-validator-cyclonedx-0.3.1.cdx-to-spdx.spdx.json --output-format spdxjson

Result is invalid SPDX:

pyspdxtools -i openchain-telco-sbom-validator-cyclonedx-0.3.1.cdx-to-spdx.spdx.json
ERROR:root:The document is invalid. The following issues have been found:
license_info_from_files must be None if files_analyzed is False, but is: [NOASSERTION]
license_info_from_files must be None if files_analyzed is False, but is: [NOASSERTION]
license_info_from_files must be None if files_analyzed is False, but is: [NOASSERTION]
license_info_from_files must be None if files_analyzed is False, but is: [NOASSERTION]
license_info_from_files must be None if files_analyzed is False, but is: [NOASSERTION]
license_info_from_files must be None if files_analyzed is False, but is: [NOASSERTION]
license_info_from_files must be None if files_analyzed is False, but is: [NOASSERTION]
there must be at least one relationship "SPDXRef-DOCUMENT DESCRIBES ..." or "... DESCRIBED_BY SPDXRef-DOCUMENT" when there is not only a single package present

What we lost in the conversion:

        "creators": [
            "Organization: Nokia",
            "Tool: Nokia Compliance Tool - 1.0"
        ],

becomes

        "creators": [
            "Tool: Nokia Compliance Tool - 1.0"
        ],

We lose supplier and originator:

            "originator": "Organization: Nokia",
            "supplier": "Organization: https://pypi.org",

becomes

            "originator": "NOASSERTION",
            "supplier": "NOASSERTION",

There is a useless

            "licenseInfoFromFiles": [
                "NOASSERTION"
            ],

that renders the code invalid.

Also, all relationships are lost, which also renders the code invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions