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

[FEATURE] Support for version 1.4 schema #67

Closed
madpah opened this issue Nov 10, 2021 · 14 comments
Closed

[FEATURE] Support for version 1.4 schema #67

madpah opened this issue Nov 10, 2021 · 14 comments
Assignees
Labels
enhancement New feature or request schema 1.4
Milestone

Comments

@madpah
Copy link
Collaborator

madpah commented Nov 10, 2021

Creating issue to track adoption of the forthcoming version 1.4 schema specification for CycloneDX.

Preview work can be seen here, but this IS NOT FINAL.

Current estimates are that version 1.4 will be finalised late 2021, early 2022.

@madpah madpah added enhancement New feature or request schema 1.4 labels Nov 10, 2021
@madpah madpah changed the title PREVIEW: Support for version 1.4 schema Support for version 1.4 schema Nov 10, 2021
@jkowalleck jkowalleck changed the title Support for version 1.4 schema [ON HOLD] Support for version 1.4 schema Nov 20, 2021
@jkowalleck
Copy link
Member

lets postpone this feature, until 1.4 is through the RFC phase.
maybe extend the on-hold until 1.4 got finalized

@madpah madpah changed the title [ON HOLD] Support for version 1.4 schema [FEATURE] Support for version 1.4 schema Dec 22, 2021
@madpah
Copy link
Collaborator Author

madpah commented Dec 22, 2021

1.4 is now in draft with only minor fixes now expected before it is finalised and released early 2022.

See https://github.com/CycloneDX/specification/tree/v1.4-dev

@madpah
Copy link
Collaborator Author

madpah commented Dec 22, 2021

@madpah madpah self-assigned this Dec 22, 2021
@madpah
Copy link
Collaborator Author

madpah commented Dec 22, 2021

Work items:

  • Add draft 1.4 schemas to schemas folder
  • Add XML schema validation in unit tests only (this prevents lxml from becoming a mainstream dependency)
  • Add JSON schema validation in unit tests only (prevent dependency bloat)
  • Schema Change (XML): Add support for bom.metadata.tools.tool.externalReferences
  • Schema Change (JSON): Add support for bom.metadata.tools.tool.externalReferences
  • Schema Change (XML): Make bom.component.version optional
  • Schema Change (JSON): Make bom.component.version optional
  • Fallback to version == '' for Schema Version < 1.4 when not provided
  • Schema Change (XML): Add support for bom.component.releaseNotes
  • Schema Change (JSON): Add support for bom.component.releaseNotes
  • Schema Change (XML): Vulnerabilities are now part of the core schema in 1.4 - bom.vulnerabilities
  • Schema Change (JSON): Vulnerabilities are now part of the core schema in 1.4 - bom.vulnerabilities
  • Schema Change: Support for $schema in JSON format SBOM JSON result: add $schema #104
  • Schema Change: JSON schema in 1.4 has been hardened - JSF added - BUMPED to [FEAT] add support for JSF Signatures #122
  • Assess Parsers for any option to populate new schema elements
  • Add FINAL/RELEASED 1.4 schemas to schemas folder

Future work, not specific to version 1.4:

@jkowalleck - appreciate your quick review on the above (first) list of key items to get done for 1.4 spec.

@jkowalleck
Copy link
Member

jkowalleck commented Dec 23, 2021

@madpah love the list you accumulated.

some important mentions/additions/summaries/annotations:

  • "Vulnerabilities are now part of the core schema in 1.4"
    • cyclonedx-python-lib has an implementation for it already. regarding spec < 1.4
    • so the serializers need to implement the CDX-builtin vuln for JSON & XML for spec > 1.4
      and may fallback to the existing implementation for XML spec < 1.4
      and omit vulns for JSON spec < 1.4 since
      @madpah i think this would a noticable challende that would require more work than the other transitions.
  • "JSON schema in 1.4 has been hardened "

@madpah feel free to edit this message, to add more implementation details we need to keep track of


PS/Edits:

@madpah
Copy link
Collaborator Author

madpah commented Dec 23, 2021

Thanks @jkowalleck - agree with your summary - and thanks for pointing out the agreement to set version == '' - had not spotted that!

@jkowalleck
Copy link
Member

jkowalleck commented Dec 23, 2021

the thing that worries me the most:
schema 1.4 is not relaxed - is "hardened" - see #67 (comment)
this means there must be no properties in the JSON that are not in the spec - so we should add a validator to the library,
so down-streams/users of the lib can assert that the resulting JSON is valid.

i implemented such schema validators for the php-lib already. some implementation details:

  • the library ships all supported schema as snapshot with some modifications:
  • schema validation may be done against the strict schema for spec < 1.4
  • JSON schema validation for spec 1.4 will not go against strict schema, as 1.4 is strict by default

you already started the implementation of schema validation, iirc, @madpah .
right?

@madpah
Copy link
Collaborator Author

madpah commented Dec 23, 2021

Understand @jkowalleck - I've already added XML and JSON schema validation for unit tests. But we can easily add that to the main code.

I was avoiding XML schema validation in the main code as that would require lxml, which is a bit bloaty and platform specific. Thoughts?

@jkowalleck
Copy link
Member

jkowalleck commented Dec 23, 2021

good point, @madpah .

lets have the validators for internal unit-tests for now and get experienced with it.
there must be multiple xml- and json-schema validator libraries out there - so we need to find one that suites us the most.

we might need to file a decision paper (like this one)
and gather non-functional requirements/constraints,
before we can make a validator public.

if we like the solution we are using for our own tests, we might make it public later.

@jkowalleck
Copy link
Member

jkowalleck commented Dec 24, 2021

@madpah when downloading/shipping the spec1.4 json schema, we need to have the JSF schema also.
JSF it is used in spec 1.4 json schema as a relative reference - just like the SPDX schema.

we might not have proper support for JSF implemented, but for schema validation (in unit tests) we need the JSF schema file and the SPDX schema file next to the spec1.4 schema file.

@madpah
Copy link
Collaborator Author

madpah commented Dec 24, 2021

Thanks for the heads up @jkowalleck - haven't got to JSON for 1.4 yet :-)

@madpah
Copy link
Collaborator Author

madpah commented Jan 7, 2022

Pre-release published to PyPi: https://pypi.org/project/cyclonedx-python-lib/1.0.0rc0/

FYI @jkowalleck

@jkowalleck
Copy link
Member

will do a review of #108

@madpah
Copy link
Collaborator Author

madpah commented Jan 13, 2022

Released!

Thanks @jkowalleck.

@madpah madpah closed this as completed Jan 13, 2022
@madpah madpah unpinned this issue Jan 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request schema 1.4
Projects
None yet
Development

No branches or pull requests

2 participants