Skip to content

bug: additional properties on property type in JSON #371

@agschrei

Description

@agschrei

Currently the definition for a property expects keys name and value but neither of them is required and the presence of other keys is not prohibited through a constraint like "additionalProperties": false

This is an inconsistency compared to other types defined on the schema such as component or dependency which disallow additional properties.

Concretely, that means this sample SBOM validates against the schema, but my argument is that it should not:

{
  "$schema": "http://cyclonedx.org/schema/bom-1.4.schema.json",
  "bomFormat": "CycloneDX",
  "specVersion": "1.4",
  "version": 1,
  "metadata": {
    "component": {
      "bom-ref": "foo",
      "type": "application",
      "name": "foo",
      "properties": [
        {
          "name": "myCustomProperty",
          "value": "myCustomValue",
          "abc": ["def"]
        }
      ]
    }
  },
  "components": [
    {
      "bom-ref": "foo/bar",
      "type": "library",
      "name": "bar"
    }
  ]
}

https://www.jsonschemavalidator.net/s/dRHUBrfG

This seems like a small thing, but I just spent an hour trying to figure out why cyclonedx-core-java would validate an sbom just fine but then fail to parse it. So I think the spec would benefit from a stronger constraint on the property type.

I'm happy to contribute the spec changes for 1.6 if this gets approved.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions