@cyclonedx/cyclonedx-library 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/NOTICE +5 -0
- package/README.md +152 -0
- package/dist.node/_index.node.js +53 -0
- package/dist.node/_index.node.js.map +1 -0
- package/dist.node/enums/attachmentEncoding.js +26 -0
- package/dist.node/enums/attachmentEncoding.js.map +1 -0
- package/dist.node/enums/componentScope.js +28 -0
- package/dist.node/enums/componentScope.js.map +1 -0
- package/dist.node/enums/componentType.js +33 -0
- package/dist.node/enums/componentType.js.map +1 -0
- package/dist.node/enums/externalReferenceType.js +41 -0
- package/dist.node/enums/externalReferenceType.js.map +1 -0
- package/dist.node/enums/hashAlogorithm.js +37 -0
- package/dist.node/enums/hashAlogorithm.js.map +1 -0
- package/dist.node/enums/index.js +40 -0
- package/dist.node/enums/index.js.map +1 -0
- package/dist.node/factories/index.js +36 -0
- package/dist.node/factories/index.js.map +1 -0
- package/dist.node/factories/licenseFactory.js +56 -0
- package/dist.node/factories/licenseFactory.js.map +1 -0
- package/dist.node/helpers/types.js +26 -0
- package/dist.node/helpers/types.js.map +1 -0
- package/dist.node/models/attachment.js +30 -0
- package/dist.node/models/attachment.js.map +1 -0
- package/dist.node/models/bom.js +67 -0
- package/dist.node/models/bom.js.map +1 -0
- package/dist.node/models/bomRef.js +37 -0
- package/dist.node/models/bomRef.js.map +1 -0
- package/dist.node/models/component.js +96 -0
- package/dist.node/models/component.js.map +1 -0
- package/dist.node/models/externalReference.js +40 -0
- package/dist.node/models/externalReference.js.map +1 -0
- package/dist.node/models/hash.js +29 -0
- package/dist.node/models/hash.js.map +1 -0
- package/dist.node/models/index.js +47 -0
- package/dist.node/models/index.js.map +1 -0
- package/dist.node/models/license.js +103 -0
- package/dist.node/models/license.js.map +1 -0
- package/dist.node/models/metadata.js +35 -0
- package/dist.node/models/metadata.js.map +1 -0
- package/dist.node/models/organizationalContact.js +41 -0
- package/dist.node/models/organizationalContact.js.map +1 -0
- package/dist.node/models/organizationalEntity.js +31 -0
- package/dist.node/models/organizationalEntity.js.map +1 -0
- package/dist.node/models/swid.js +58 -0
- package/dist.node/models/swid.js.map +1 -0
- package/dist.node/models/tool.js +45 -0
- package/dist.node/models/tool.js.map +1 -0
- package/dist.node/resources.node.js +55 -0
- package/dist.node/resources.node.js.map +1 -0
- package/dist.node/serialize/_index.node.js +37 -0
- package/dist.node/serialize/_index.node.js.map +1 -0
- package/dist.node/serialize/baseSerializer.js +56 -0
- package/dist.node/serialize/baseSerializer.js.map +1 -0
- package/dist.node/serialize/bomRefDiscriminator.js +66 -0
- package/dist.node/serialize/bomRefDiscriminator.js.map +1 -0
- package/dist.node/serialize/index.js +55 -0
- package/dist.node/serialize/index.js.map +1 -0
- package/dist.node/serialize/json/index.js +47 -0
- package/dist.node/serialize/json/index.js.map +1 -0
- package/dist.node/serialize/json/normalize.js +431 -0
- package/dist.node/serialize/json/normalize.js.map +1 -0
- package/dist.node/serialize/json/types.js +35 -0
- package/dist.node/serialize/json/types.js.map +1 -0
- package/dist.node/serialize/jsonSerializer.js +55 -0
- package/dist.node/serialize/jsonSerializer.js.map +1 -0
- package/dist.node/serialize/types.js +21 -0
- package/dist.node/serialize/types.js.map +1 -0
- package/dist.node/serialize/xml/index.js +47 -0
- package/dist.node/serialize/xml/index.js.map +1 -0
- package/dist.node/serialize/xml/normalize.js +560 -0
- package/dist.node/serialize/xml/normalize.js.map +1 -0
- package/dist.node/serialize/xml/types.js +31 -0
- package/dist.node/serialize/xml/types.js.map +1 -0
- package/dist.node/serialize/xmlBaseSerializer.js +52 -0
- package/dist.node/serialize/xmlBaseSerializer.js.map +1 -0
- package/dist.node/serialize/xmlSerializer.node.js +30 -0
- package/dist.node/serialize/xmlSerializer.node.js.map +1 -0
- package/dist.node/spdx.js +35 -0
- package/dist.node/spdx.js.map +1 -0
- package/dist.node/spec.js +229 -0
- package/dist.node/spec.js.map +1 -0
- package/dist.node/types/cpe.js +28 -0
- package/dist.node/types/cpe.js.map +1 -0
- package/dist.node/types/index.js +39 -0
- package/dist.node/types/index.js.map +1 -0
- package/dist.node/types/integer.js +36 -0
- package/dist.node/types/integer.js.map +1 -0
- package/dist.node/types/mimeType.js +28 -0
- package/dist.node/types/mimeType.js.map +1 -0
- package/dist.node/types/urn.js +28 -0
- package/dist.node/types/urn.js.map +1 -0
- package/dist.web/lib.dev.js +3487 -0
- package/dist.web/lib.dev.js.map +1 -0
- package/dist.web/lib.js +2 -0
- package/dist.web/lib.js.LICENSE.txt +18 -0
- package/libs/universal-node-xml/index.d.ts +33 -0
- package/libs/universal-node-xml/index.js +42 -0
- package/libs/universal-node-xml/stringifiers/helpers.js +17 -0
- package/libs/universal-node-xml/stringifiers/xmlbuilder2.js +51 -0
- package/package.json +86 -0
- package/res/README.md +27 -0
- package/res/bom-1.0.SNAPSHOT.xsd +247 -0
- package/res/bom-1.1.SNAPSHOT.xsd +731 -0
- package/res/bom-1.2-strict.SNAPSHOT.schema.json +1026 -0
- package/res/bom-1.2.SNAPSHOT.schema.json +997 -0
- package/res/bom-1.2.SNAPSHOT.xsd +1418 -0
- package/res/bom-1.3-strict.SNAPSHOT.schema.json +1085 -0
- package/res/bom-1.3.SNAPSHOT.schema.json +1054 -0
- package/res/bom-1.3.SNAPSHOT.xsd +1631 -0
- package/res/bom-1.4.SNAPSHOT.schema.json +1697 -0
- package/res/bom-1.4.SNAPSHOT.xsd +2407 -0
- package/res/jsf-0.82.SNAPSHOT.schema.json +244 -0
- package/res/spdx.SNAPSHOT.schema.json +533 -0
- package/res/spdx.SNAPSHOT.xsd +2639 -0
- package/src/_index.node.ts +31 -0
- package/src/_index.web.ts +27 -0
- package/src/enums/attachmentEncoding.ts +22 -0
- package/src/enums/componentScope.ts +24 -0
- package/src/enums/componentType.ts +29 -0
- package/src/enums/externalReferenceType.ts +37 -0
- package/src/enums/hashAlogorithm.ts +33 -0
- package/src/enums/index.ts +24 -0
- package/src/factories/index.ts +20 -0
- package/src/factories/licenseFactory.ts +62 -0
- package/src/helpers/README.md +3 -0
- package/src/helpers/types.ts +28 -0
- package/src/models/attachment.ts +37 -0
- package/src/models/bom.ts +85 -0
- package/src/models/bomRef.ts +41 -0
- package/src/models/component.ts +136 -0
- package/src/models/externalReference.ts +48 -0
- package/src/models/hash.ts +38 -0
- package/src/models/index.ts +31 -0
- package/src/models/license.ts +133 -0
- package/src/models/metadata.ts +50 -0
- package/src/models/organizationalContact.ts +49 -0
- package/src/models/organizationalEntity.ts +38 -0
- package/src/models/swid.ts +71 -0
- package/src/models/tool.ts +58 -0
- package/src/resources.node.ts +59 -0
- package/src/serialize/_index.node.ts +23 -0
- package/src/serialize/_index.web.ts +23 -0
- package/src/serialize/baseSerializer.ts +52 -0
- package/src/serialize/bomRefDiscriminator.ts +69 -0
- package/src/serialize/index.ts +35 -0
- package/src/serialize/json/index.ts +23 -0
- package/src/serialize/json/normalize.ts +450 -0
- package/src/serialize/json/types.ts +187 -0
- package/src/serialize/jsonSerializer.ts +59 -0
- package/src/serialize/types.ts +38 -0
- package/src/serialize/xml/index.ts +23 -0
- package/src/serialize/xml/normalize.ts +590 -0
- package/src/serialize/xml/types.ts +112 -0
- package/src/serialize/xmlBaseSerializer.ts +52 -0
- package/src/serialize/xmlSerializer.node.ts +35 -0
- package/src/serialize/xmlSerializer.web.ts +89 -0
- package/src/spdx.ts +48 -0
- package/src/spec.ts +289 -0
- package/src/types/cpe.ts +33 -0
- package/src/types/index.ts +23 -0
- package/src/types/integer.ts +50 -0
- package/src/types/mimeType.ts +31 -0
- package/src/types/urn.ts +33 -0
- package/tsconfig.json +108 -0
- package/tsconfig.node.json +8 -0
- package/tsconfig.web.json +5 -0
- package/webpack.config.js +74 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
This file is part of CycloneDX JavaScript Library.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
|
|
16
|
+
SPDX-License-Identifier: Apache-2.0
|
|
17
|
+
Copyright (c) OWASP Foundation. All Rights Reserved.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
import { SimpleXml } from '../../src/serialize/xml/types'
|
|
21
|
+
import { SerializerOptions } from '../../src/serialize/types'
|
|
22
|
+
|
|
23
|
+
declare type ThrowError = () => never
|
|
24
|
+
|
|
25
|
+
declare type Stringify = (element: SimpleXml.Element, options?: SerializerOptions) => string
|
|
26
|
+
export declare const stringify: Stringify | undefined
|
|
27
|
+
export declare const stringifyFallback: Stringify | ThrowError
|
|
28
|
+
|
|
29
|
+
/*
|
|
30
|
+
declare type Parse = (xml: string) => SimpleXml.Element
|
|
31
|
+
export declare const parse: Parse | undefined
|
|
32
|
+
export declare const parseFallback: Parse | ThrowError
|
|
33
|
+
*/
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
/*!
|
|
3
|
+
This file is part of CycloneDX JavaScript Library.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
SPDX-License-Identifier: Apache-2.0
|
|
18
|
+
Copyright (c) OWASP Foundation. All Rights Reserved.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const possibleStringifiers = [
|
|
22
|
+
// prioritized list of possible implementations
|
|
23
|
+
'xmlbuilder2'
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
module.exports.stringify = undefined
|
|
27
|
+
let possibleStringifier
|
|
28
|
+
for (const file of possibleStringifiers) {
|
|
29
|
+
try {
|
|
30
|
+
possibleStringifier = require(`./stringifiers/${file}`)
|
|
31
|
+
if (typeof possibleStringifier === 'function') {
|
|
32
|
+
module.exports.stringify = possibleStringifier
|
|
33
|
+
break
|
|
34
|
+
}
|
|
35
|
+
} catch {
|
|
36
|
+
/* pass */
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
module.exports.stringifyFallback = module.exports.stringify ?? function () {
|
|
41
|
+
throw new Error('No stringifier available. Please install one of the optional xml libraries.')
|
|
42
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
module.exports.getNS = function (element) {
|
|
3
|
+
const ns = (element.namespace ?? element.attributes?.xmlns)?.toString() ?? ''
|
|
4
|
+
return ns.length > 0
|
|
5
|
+
? ns
|
|
6
|
+
: null
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
module.exports.makeIndent = function (space) {
|
|
10
|
+
if (typeof space === 'number') {
|
|
11
|
+
return ' '.repeat(Math.max(0, space))
|
|
12
|
+
}
|
|
13
|
+
if (typeof space === 'string') {
|
|
14
|
+
return space
|
|
15
|
+
}
|
|
16
|
+
return ''
|
|
17
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
'use strict'
|
|
2
|
+
/*!
|
|
3
|
+
This file is part of CycloneDX JavaScript Library.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
|
|
17
|
+
SPDX-License-Identifier: Apache-2.0
|
|
18
|
+
Copyright (c) OWASP Foundation. All Rights Reserved.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const { create } = require('xmlbuilder2')
|
|
22
|
+
const { getNS, makeIndent } = require('./helpers')
|
|
23
|
+
|
|
24
|
+
module.exports = typeof create === 'function'
|
|
25
|
+
? stringify
|
|
26
|
+
: undefined
|
|
27
|
+
|
|
28
|
+
function stringify (element, { space } = {}) {
|
|
29
|
+
const indent = makeIndent(space)
|
|
30
|
+
const doc = create({ encoding: 'UTF-8' })
|
|
31
|
+
addEle(doc, element)
|
|
32
|
+
return doc.end({
|
|
33
|
+
format: 'xml',
|
|
34
|
+
newline: '\n',
|
|
35
|
+
prettyPrint: indent.length > 0,
|
|
36
|
+
indent
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function addEle (parent, element, parentNS = null) {
|
|
41
|
+
if (element.type !== 'element') { return }
|
|
42
|
+
const ns = getNS(element) ?? parentNS
|
|
43
|
+
const ele = parent.ele(ns, element.name, element.attributes)
|
|
44
|
+
if (typeof element.children === 'string' || typeof element.children === 'number') {
|
|
45
|
+
ele.txt(element.children.toString())
|
|
46
|
+
} else if (Array.isArray(element.children)) {
|
|
47
|
+
for (const child of element.children) {
|
|
48
|
+
addEle(ele, child, ns)
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cyclonedx/cyclonedx-library",
|
|
3
|
+
"version": "1.0.0-beta.1",
|
|
4
|
+
"description": "Core functionality of CycloneDX for JavaScript (Node.js or WebBrowser).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"CycloneDX",
|
|
7
|
+
"SBOM",
|
|
8
|
+
"BOM",
|
|
9
|
+
"inventory",
|
|
10
|
+
"bill-of-materials",
|
|
11
|
+
"software-bill-of-materials",
|
|
12
|
+
"component",
|
|
13
|
+
"dependency",
|
|
14
|
+
"package-url",
|
|
15
|
+
"PURL",
|
|
16
|
+
"spdx"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/CycloneDX/cyclonedx-javascript-library"
|
|
21
|
+
},
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/CycloneDX/cyclonedx-javascript-library/issues"
|
|
24
|
+
},
|
|
25
|
+
"license": "Apache-2.0",
|
|
26
|
+
"author": {
|
|
27
|
+
"name": "Jan Kowalleck",
|
|
28
|
+
"email": "jan.kowalleck@gmail.com"
|
|
29
|
+
},
|
|
30
|
+
"contributors": [
|
|
31
|
+
{
|
|
32
|
+
"name": "Jan Kowalleck",
|
|
33
|
+
"email": "jan.kowalleck@gmail.com"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"type": "commonjs",
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">=14.0.0"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"packageurl-js": "^0.0.6"
|
|
42
|
+
},
|
|
43
|
+
"optionalDependencies": {
|
|
44
|
+
"xmlbuilder2": "^3.0.2"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/mocha": "^9.1.1",
|
|
48
|
+
"@types/node": "^17.0.39",
|
|
49
|
+
"@types/webpack": "^5.28.0",
|
|
50
|
+
"deepmerge": "4.2.2",
|
|
51
|
+
"mocha": "10.0.0",
|
|
52
|
+
"npm-run-all": "^4.1.5",
|
|
53
|
+
"ts-loader": "9.3.0",
|
|
54
|
+
"ts-standard": "^11.0.0",
|
|
55
|
+
"typescript": "4.6.4",
|
|
56
|
+
"webpack": "5.73.0",
|
|
57
|
+
"webpack-cli": "4.9.2",
|
|
58
|
+
"xmlbuilder2": "^3.0.2"
|
|
59
|
+
},
|
|
60
|
+
"browser": "./dist.web/lib.js",
|
|
61
|
+
"types": "./src/_index.node.ts",
|
|
62
|
+
"main": "./dist.node/_index.node.js",
|
|
63
|
+
"exports": "./dist.node/_index.node.js",
|
|
64
|
+
"directories": {
|
|
65
|
+
"doc": "./docs",
|
|
66
|
+
"src": "./src",
|
|
67
|
+
"lib": "./dist.node",
|
|
68
|
+
"test": "./tests",
|
|
69
|
+
"example": "./examples"
|
|
70
|
+
},
|
|
71
|
+
"scripts": {
|
|
72
|
+
"prepublish": "npm run build",
|
|
73
|
+
"prepublishOnly": "npm run build",
|
|
74
|
+
"lint": "tsc --noEmit",
|
|
75
|
+
"build": "run-p --aggregate-output -l build:*",
|
|
76
|
+
"prebuild:node": "node -r fs -e 'fs.rmSync(\"dist.node\",{recursive:true,force:true})'",
|
|
77
|
+
"build:node": "tsc -b ./tsconfig.node.json",
|
|
78
|
+
"prebuild:web": "node -r fs -e 'fs.rmSync(\"dist.web\",{recursive:true,force:true})'",
|
|
79
|
+
"build:web": "webpack",
|
|
80
|
+
"cs-fix": "eslint --fix .",
|
|
81
|
+
"test": "run-p --aggregate-output -lc test:*",
|
|
82
|
+
"test:node": "mocha -p",
|
|
83
|
+
"test:web": "node -e 'console.log(\"TODO: write web test\")'",
|
|
84
|
+
"test:standard": "eslint ."
|
|
85
|
+
}
|
|
86
|
+
}
|
package/res/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Resources
|
|
2
|
+
|
|
3
|
+
These resources are shipped with the library.
|
|
4
|
+
|
|
5
|
+
## Schema files
|
|
6
|
+
|
|
7
|
+
some schema for offline use.
|
|
8
|
+
original sources: https://github.com/CycloneDX/specification/tree/master/schema
|
|
9
|
+
|
|
10
|
+
Currently using version
|
|
11
|
+
[82bf9e30ba3fd6413e72a0e66adce2cdf3354f32](https://github.com/CycloneDX/specification/tree/82bf9e30ba3fd6413e72a0e66adce2cdf3354f32)
|
|
12
|
+
|
|
13
|
+
| file | note |
|
|
14
|
+
| --- | --- |
|
|
15
|
+
| [`bom-1.0.SNAPSHOT.xsd`](bom-1.0.SNAPSHOT.xsd) | `http://cyclonedx.org/schema/spdx` was replaced with `spdx.SNAPSHOT.xsd` |
|
|
16
|
+
| [`bom-1.1.SNAPSHOT.xsd`](bom-1.1.SNAPSHOT.xsd) | `http://cyclonedx.org/schema/spdx` was replaced with `spdx.SNAPSHOT.xsd` |
|
|
17
|
+
| [`bom-1.2.SNAPSHOT.xsd`](bom-1.2.SNAPSHOT.xsd) | `http://cyclonedx.org/schema/spdx` was replaced with `spdx.SNAPSHOT.xsd` |
|
|
18
|
+
| [`bom-1.3.SNAPSHOT.xsd`](bom-1.3.SNAPSHOT.xsd) | `http://cyclonedx.org/schema/spdx` was replaced with `spdx.SNAPSHOT.xsd` |
|
|
19
|
+
| [`bom-1.4.SNAPSHOT.xsd`](bom-1.4.SNAPSHOT.xsd) | `http://cyclonedx.org/schema/spdx` was replaced with `spdx.SNAPSHOT.xsd` |
|
|
20
|
+
| [`bom-1.2.SNAPSHOT.schema.json`](bom-1.2.SNAPSHOT.schema.json) | `spdx.schema.json` was replaced with `spdx.SNAPSHOT.schema.json` |
|
|
21
|
+
| [`bom-1.3.SNAPSHOT.schema.json`](bom-1.3.SNAPSHOT.schema.json) | `spdx.schema.json` was replaced with `spdx.SNAPSHOT.schema.json` |
|
|
22
|
+
| [`bom-1.4.SNAPSHOT.schema.json`](bom-1.4.SNAPSHOT.schema.json) | `spdx.schema.json` was replaced with `spdx.SNAPSHOT.schema.json` |
|
|
23
|
+
| [`bom-1.2-strict.SNAPSHOT.schema.json`](bom-1.2-strict.SNAPSHOT.schema.json) | `spdx.schema.json` was replaced with `spdx.SNAPSHOT.schema.json` |
|
|
24
|
+
| [`bom-1.3-strict.SNAPSHOT.schema.json`](bom-1.3-strict.SNAPSHOT.schema.json) | `spdx.schema.json` was replaced with `spdx.SNAPSHOT.schema.json` |
|
|
25
|
+
| [`spdx.SNAPSHOT.xsd`](spdx.SNAPSHOT.xsd) | |
|
|
26
|
+
| [`spdx.SNAPSHOT.schema.json`](spdx.SNAPSHOT.schema.json) | |
|
|
27
|
+
| [`jsf-0.82.SNAPSHOT.schema.json`](jsf-0.82.SNAPSHOT.schema.json) | |
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
|
3
|
+
xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
|
|
4
|
+
xmlns:bom="http://cyclonedx.org/schema/bom/1.0"
|
|
5
|
+
xmlns:spdx="http://cyclonedx.org/schema/spdx"
|
|
6
|
+
elementFormDefault="qualified"
|
|
7
|
+
targetNamespace="http://cyclonedx.org/schema/bom/1.0"
|
|
8
|
+
vc:minVersion="1.0"
|
|
9
|
+
vc:maxVersion="1.1"
|
|
10
|
+
version="1.0.1">
|
|
11
|
+
|
|
12
|
+
<xs:import namespace="http://cyclonedx.org/schema/spdx" schemaLocation="spdx.SNAPSHOT.xsd"/>
|
|
13
|
+
|
|
14
|
+
<xs:complexType name="component">
|
|
15
|
+
<xs:sequence>
|
|
16
|
+
<xs:element name="publisher" type="xs:normalizedString" minOccurs="0" maxOccurs="1">
|
|
17
|
+
<xs:annotation>
|
|
18
|
+
<xs:documentation>The person(s) or organization(s) that published the component</xs:documentation>
|
|
19
|
+
</xs:annotation>
|
|
20
|
+
</xs:element>
|
|
21
|
+
<xs:element name="group" type="xs:normalizedString" minOccurs="0" maxOccurs="1">
|
|
22
|
+
<xs:annotation>
|
|
23
|
+
<xs:documentation>The grouping name or identifier. This will often be a shortened, single
|
|
24
|
+
name of the company or project that produced the component, or the source package or
|
|
25
|
+
domain name. Whitespace and special characters should be avoided. Examples include:
|
|
26
|
+
apache, org.apache.commons, and apache.org.</xs:documentation>
|
|
27
|
+
</xs:annotation>
|
|
28
|
+
</xs:element>
|
|
29
|
+
<xs:element name="name" type="xs:normalizedString" minOccurs="1" maxOccurs="1">
|
|
30
|
+
<xs:annotation>
|
|
31
|
+
<xs:documentation>The name of the component. This will often be a shortened, single name
|
|
32
|
+
of the component. Examples: commons-lang3 and jquery</xs:documentation>
|
|
33
|
+
</xs:annotation>
|
|
34
|
+
</xs:element>
|
|
35
|
+
<xs:element name="version" type="xs:normalizedString" minOccurs="1" maxOccurs="1">
|
|
36
|
+
<xs:annotation>
|
|
37
|
+
<xs:documentation>The component version. The version should ideally comply with semantic versioning
|
|
38
|
+
but is not enforced.</xs:documentation>
|
|
39
|
+
</xs:annotation>
|
|
40
|
+
</xs:element>
|
|
41
|
+
<xs:element name="description" type="xs:normalizedString" minOccurs="0" maxOccurs="1">
|
|
42
|
+
<xs:annotation>
|
|
43
|
+
<xs:documentation>Specifies a description for the component</xs:documentation>
|
|
44
|
+
</xs:annotation>
|
|
45
|
+
</xs:element>
|
|
46
|
+
<xs:element name="scope" type="bom:scope" minOccurs="0" maxOccurs="1">
|
|
47
|
+
<xs:annotation>
|
|
48
|
+
<xs:documentation>Specifies the scope of the component. If scope is not specified, 'runtime'
|
|
49
|
+
scope will be assumed.</xs:documentation>
|
|
50
|
+
</xs:annotation>
|
|
51
|
+
</xs:element>
|
|
52
|
+
<xs:element name="hashes" minOccurs="0" maxOccurs="1">
|
|
53
|
+
<xs:complexType>
|
|
54
|
+
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
|
55
|
+
<xs:element name="hash" type="bom:hashType"/>
|
|
56
|
+
</xs:sequence>
|
|
57
|
+
</xs:complexType>
|
|
58
|
+
</xs:element>
|
|
59
|
+
<xs:element name="licenses" minOccurs="0" maxOccurs="1">
|
|
60
|
+
<xs:complexType>
|
|
61
|
+
<xs:sequence minOccurs="1" maxOccurs="unbounded">
|
|
62
|
+
<xs:element name="license">
|
|
63
|
+
<xs:complexType>
|
|
64
|
+
<xs:sequence>
|
|
65
|
+
<xs:choice>
|
|
66
|
+
<xs:element name="id" type="spdx:licenseId" minOccurs="0" maxOccurs="unbounded">
|
|
67
|
+
<xs:annotation>
|
|
68
|
+
<xs:documentation>A valid SPDX license ID</xs:documentation>
|
|
69
|
+
</xs:annotation>
|
|
70
|
+
</xs:element>
|
|
71
|
+
<xs:element name="name" type="xs:normalizedString" minOccurs="0" maxOccurs="unbounded">
|
|
72
|
+
<xs:annotation>
|
|
73
|
+
<xs:documentation>If SPDX does not define the license used, this field may be used to provide the license name</xs:documentation>
|
|
74
|
+
</xs:annotation>
|
|
75
|
+
</xs:element>
|
|
76
|
+
</xs:choice>
|
|
77
|
+
</xs:sequence>
|
|
78
|
+
</xs:complexType>
|
|
79
|
+
</xs:element>
|
|
80
|
+
</xs:sequence>
|
|
81
|
+
</xs:complexType>
|
|
82
|
+
</xs:element>
|
|
83
|
+
<xs:element name="copyright" type="xs:normalizedString" minOccurs="0" maxOccurs="1">
|
|
84
|
+
<xs:annotation>
|
|
85
|
+
<xs:documentation>An optional copyright notice informing users of the underlying claims to copyright ownership in a published work.</xs:documentation>
|
|
86
|
+
</xs:annotation>
|
|
87
|
+
</xs:element>
|
|
88
|
+
<xs:element name="cpe" type="bom:cpe" minOccurs="0" maxOccurs="1">
|
|
89
|
+
<xs:annotation>
|
|
90
|
+
<xs:documentation>Specifies a well-formed CPE name. See https://nvd.nist.gov/products/cpe</xs:documentation>
|
|
91
|
+
</xs:annotation>
|
|
92
|
+
</xs:element>
|
|
93
|
+
<xs:element name="purl" type="xs:anyURI" minOccurs="0" maxOccurs="1">
|
|
94
|
+
<xs:annotation>
|
|
95
|
+
<xs:documentation>
|
|
96
|
+
Specifies the package-url (PURL). The purl, if specified, must be valid and conform
|
|
97
|
+
to the specification defined at: https://github.com/package-url/purl-spec
|
|
98
|
+
</xs:documentation>
|
|
99
|
+
</xs:annotation>
|
|
100
|
+
</xs:element>
|
|
101
|
+
<xs:element name="modified" type="xs:boolean" minOccurs="1" maxOccurs="1">
|
|
102
|
+
<xs:annotation>
|
|
103
|
+
<xs:documentation>
|
|
104
|
+
A boolean value indicating is the component has been modified from the original.
|
|
105
|
+
A value of true indicates the component is a derivative of the original.
|
|
106
|
+
A value of false indicates the component has not been modified from the original.
|
|
107
|
+
</xs:documentation>
|
|
108
|
+
</xs:annotation>
|
|
109
|
+
</xs:element>
|
|
110
|
+
<xs:element name="components" minOccurs="0" maxOccurs="1">
|
|
111
|
+
<xs:annotation>
|
|
112
|
+
<xs:documentation>
|
|
113
|
+
Specifies optional sub-components. This is not a dependency tree. It simply provides
|
|
114
|
+
an optional way to group large sets of components together.
|
|
115
|
+
</xs:documentation>
|
|
116
|
+
</xs:annotation>
|
|
117
|
+
<xs:complexType>
|
|
118
|
+
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
|
119
|
+
<xs:element name="component" type="bom:component"/>
|
|
120
|
+
</xs:sequence>
|
|
121
|
+
</xs:complexType>
|
|
122
|
+
</xs:element>
|
|
123
|
+
</xs:sequence>
|
|
124
|
+
<xs:attribute name="type" type="bom:classification" use="required">
|
|
125
|
+
<xs:annotation>
|
|
126
|
+
<xs:documentation>
|
|
127
|
+
Specifies the type of component. Software applications, libraries, frameworks, and
|
|
128
|
+
other dependencies should be classified as 'application'.
|
|
129
|
+
</xs:documentation>
|
|
130
|
+
</xs:annotation>
|
|
131
|
+
</xs:attribute>
|
|
132
|
+
<xs:anyAttribute namespace="##other" processContents="lax">
|
|
133
|
+
<xs:annotation>
|
|
134
|
+
<xs:documentation>User-defined attributes may be used on this element as long as they
|
|
135
|
+
do not have the same name as an existing attribute used by the schema.</xs:documentation>
|
|
136
|
+
</xs:annotation>
|
|
137
|
+
</xs:anyAttribute>
|
|
138
|
+
</xs:complexType>
|
|
139
|
+
|
|
140
|
+
<xs:complexType name="hashType">
|
|
141
|
+
<xs:annotation>
|
|
142
|
+
<xs:documentation>Specifies the file hash of the component</xs:documentation>
|
|
143
|
+
</xs:annotation>
|
|
144
|
+
<xs:simpleContent>
|
|
145
|
+
<xs:extension base="bom:hashValue">
|
|
146
|
+
<xs:attribute name="alg" type="bom:hashAlg" use="required">
|
|
147
|
+
<xs:annotation>
|
|
148
|
+
<xs:documentation>Specifies the algorithm used to create hash</xs:documentation>
|
|
149
|
+
</xs:annotation>
|
|
150
|
+
</xs:attribute>
|
|
151
|
+
</xs:extension>
|
|
152
|
+
</xs:simpleContent>
|
|
153
|
+
</xs:complexType>
|
|
154
|
+
|
|
155
|
+
<xs:simpleType name="scope">
|
|
156
|
+
<xs:restriction base="xs:string">
|
|
157
|
+
<xs:enumeration value="required">
|
|
158
|
+
<xs:annotation>
|
|
159
|
+
<xs:documentation>The component is required for runtime</xs:documentation>
|
|
160
|
+
</xs:annotation>
|
|
161
|
+
</xs:enumeration>
|
|
162
|
+
<xs:enumeration value="optional">
|
|
163
|
+
<xs:annotation>
|
|
164
|
+
<xs:documentation>The component is optional at runtime. Optional components are components that
|
|
165
|
+
are not capable of being called due to them not be installed or otherwise accessible by any means.
|
|
166
|
+
Components that are installed but due to configuration or other restrictions are prohibited from
|
|
167
|
+
being called must be scoped as 'required'.</xs:documentation>
|
|
168
|
+
</xs:annotation>
|
|
169
|
+
</xs:enumeration>
|
|
170
|
+
</xs:restriction>
|
|
171
|
+
</xs:simpleType>
|
|
172
|
+
|
|
173
|
+
<xs:simpleType name="classification">
|
|
174
|
+
<xs:restriction base="xs:string">
|
|
175
|
+
<xs:enumeration value="application"/>
|
|
176
|
+
<xs:enumeration value="framework"/>
|
|
177
|
+
<xs:enumeration value="library"/>
|
|
178
|
+
<xs:enumeration value="operating-system"/>
|
|
179
|
+
<xs:enumeration value="device"/>
|
|
180
|
+
</xs:restriction>
|
|
181
|
+
</xs:simpleType>
|
|
182
|
+
|
|
183
|
+
<xs:simpleType name="hashAlg">
|
|
184
|
+
<xs:restriction base="xs:string">
|
|
185
|
+
<xs:enumeration value="MD5"/>
|
|
186
|
+
<xs:enumeration value="SHA-1"/>
|
|
187
|
+
<xs:enumeration value="SHA-256"/>
|
|
188
|
+
<xs:enumeration value="SHA-384"/>
|
|
189
|
+
<xs:enumeration value="SHA-512"/>
|
|
190
|
+
<xs:enumeration value="SHA3-256"/>
|
|
191
|
+
<xs:enumeration value="SHA3-512"/>
|
|
192
|
+
</xs:restriction>
|
|
193
|
+
</xs:simpleType>
|
|
194
|
+
|
|
195
|
+
<xs:simpleType name="hashValue">
|
|
196
|
+
<xs:restriction base="xs:token">
|
|
197
|
+
<xs:pattern value="([a-fA-F0-9]{32})|([a-fA-F0-9]{40})|([a-fA-F0-9]{64})|([a-fA-F0-9]{96})|([a-fA-F0-9]{128})"/>
|
|
198
|
+
</xs:restriction>
|
|
199
|
+
</xs:simpleType>
|
|
200
|
+
|
|
201
|
+
<xs:simpleType name="cpe">
|
|
202
|
+
<xs:annotation>
|
|
203
|
+
<xs:documentation xml:lang="en">
|
|
204
|
+
Define the format for acceptable CPE URIs. Supports CPE 2.2 and CPE 2.3 formats. Refer to https://nvd.nist.gov/products/cpe for official specification.
|
|
205
|
+
</xs:documentation>
|
|
206
|
+
</xs:annotation>
|
|
207
|
+
<xs:restriction base="xs:string">
|
|
208
|
+
<xs:pattern value="([c][pP][eE]:/[AHOaho]?(:[A-Za-z0-9\._\-~%]*){0,6})|(cpe:2\.3:[aho\*\-](:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){5}(:(([a-zA-Z]{2,3}(-([a-zA-Z]{2}|[0-9]{3}))?)|[\*\-]))(:(((\?*|\*?)([a-zA-Z0-9\-\._]|(\\[\\\*\?!"#$$%&'\(\)\+,/:;<=>@\[\]\^`\{\|}~]))+(\?*|\*?))|[\*\-])){4})"/>
|
|
209
|
+
</xs:restriction>
|
|
210
|
+
</xs:simpleType>
|
|
211
|
+
|
|
212
|
+
<xs:element name="bom">
|
|
213
|
+
<xs:complexType>
|
|
214
|
+
<xs:sequence>
|
|
215
|
+
<xs:element name="components">
|
|
216
|
+
<xs:complexType>
|
|
217
|
+
<xs:sequence minOccurs="0" maxOccurs="unbounded">
|
|
218
|
+
<xs:element name="component" type="bom:component"/>
|
|
219
|
+
</xs:sequence>
|
|
220
|
+
<xs:anyAttribute namespace="##other" processContents="lax">
|
|
221
|
+
<xs:annotation>
|
|
222
|
+
<xs:documentation>User-defined attributes may be used on this element as long as they
|
|
223
|
+
do not have the same name as an existing attribute used by the schema.</xs:documentation>
|
|
224
|
+
</xs:annotation>
|
|
225
|
+
</xs:anyAttribute>
|
|
226
|
+
</xs:complexType>
|
|
227
|
+
</xs:element>
|
|
228
|
+
</xs:sequence>
|
|
229
|
+
<xs:attribute name="version" type="xs:integer" default="1">
|
|
230
|
+
<xs:annotation>
|
|
231
|
+
<xs:documentation>The version allows component publishers/authors to make changes to existing
|
|
232
|
+
BOMs to update various aspects of the document such as description or licenses. When a system
|
|
233
|
+
is presented with multiiple BOMs for the same component, the system should use the most recent
|
|
234
|
+
version of the BOM. The default version is '1' and should be incremented for each version of the
|
|
235
|
+
BOM that is published. Each version of a component should have a unique BOM and if no changes are
|
|
236
|
+
made to the BOMs, then each BOM will have a version of '1'.</xs:documentation>
|
|
237
|
+
</xs:annotation>
|
|
238
|
+
</xs:attribute>
|
|
239
|
+
<xs:anyAttribute namespace="##other" processContents="lax">
|
|
240
|
+
<xs:annotation>
|
|
241
|
+
<xs:documentation>User-defined attributes may be used on this element as long as they
|
|
242
|
+
do not have the same name as an existing attribute used by the schema.</xs:documentation>
|
|
243
|
+
</xs:annotation>
|
|
244
|
+
</xs:anyAttribute>
|
|
245
|
+
</xs:complexType>
|
|
246
|
+
</xs:element>
|
|
247
|
+
</xs:schema>
|