Skip to content

Commit d965a78

Browse files
committed
feat(cyclonedx): Include the effective license as an SPDX expression
In CycloneDX 1.7 it will be possible to change ORT's implementation to place only a single (expression) object into `component.license[]` and move all the additional license information under the `expressionDetails` property [^1] of that expression, such as for example the origin of the license. This way, the report would contain the effective license in the components dedicated field as an SPDX expression. As the `expressionDetails` is not yet present in CycloneDX 1.6, that refactoring is not yet possible. So, simply use a generic property to annotate the component with the effective license SPDX expression. Note: Currently, `component.license[]` contains exactly the license identifiers contained in the effective license. If the effective license contains (unmade) license choices, that current representation lacks some information compared to the effective license SPDX expression. [1]: https://cyclonedx.org/docs/1.7/json/#metadata_tools_oneOf_i0_components_items_licenses_items_oneOf_i1_expressionDetails Signed-off-by: Frank Viernau <frank.viernau@gmail.com>
1 parent 4a2517e commit d965a78

10 files changed

Lines changed: 210 additions & 7 deletions

plugins/reporters/cyclonedx/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ This table defines the [taxonomy](https://cyclonedx.github.io/cyclonedx-property
77
| Property Name | Parent Entity | Description |
88
| ------------- | ------------- | ----------- |
99
| `ort:dependencyType` | `component` | The type of dependency in relation to the parent component. Valid values: "direct", "transitive". |
10+
| `ort:effectiveLicense` | `component` | The effective license of the component as an SPDX expression. |
1011
| `ort:origin` | `license` | The origin of the license. Valid values: "declared license", "detected license", "concluded license". |

plugins/reporters/cyclonedx/src/funTest/resources/cyclonedx-reporter-expected-result-different-projects.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@
3636
}
3737
}
3838
],
39-
"copyright" : "Copyright 1"
39+
"copyright" : "Copyright 1",
40+
"properties" : [
41+
{
42+
"name" : "ort:effectiveLicense",
43+
"value" : "MIT"
44+
}
45+
]
4046
},
4147
"licenses" : [
4248
{
@@ -141,6 +147,10 @@
141147
}
142148
],
143149
"properties" : [
150+
{
151+
"name" : "ort:effectiveLicense",
152+
"value" : "MIT AND MIT WITH Libtool-exception"
153+
},
144154
{
145155
"name" : "ort:dependencyType",
146156
"value" : "direct"
@@ -205,6 +215,10 @@
205215
}
206216
],
207217
"properties" : [
218+
{
219+
"name" : "ort:effectiveLicense",
220+
"value" : "MIT AND BSD-3-Clause"
221+
},
208222
{
209223
"name" : "ort:dependencyType",
210224
"value" : "direct"
@@ -251,6 +265,10 @@
251265
}
252266
],
253267
"properties" : [
268+
{
269+
"name" : "ort:effectiveLicense",
270+
"value" : "MIT"
271+
},
254272
{
255273
"name" : "ort:dependencyType",
256274
"value" : "direct"
@@ -334,6 +352,10 @@
334352
}
335353
],
336354
"properties" : [
355+
{
356+
"name" : "ort:effectiveLicense",
357+
"value" : "MIT AND BSD-3-Clause AND LicenseRef-scancode-truecrypt-3.1 AND LGPL-3.0-or-later WITH openvpn-openssl-exception"
358+
},
337359
{
338360
"name" : "ort:dependencyType",
339361
"value" : "direct"
@@ -374,6 +396,10 @@
374396
}
375397
],
376398
"properties" : [
399+
{
400+
"name" : "ort:effectiveLicense",
401+
"value" : "MIT"
402+
},
377403
{
378404
"name" : "ort:dependencyType",
379405
"value" : "direct"

plugins/reporters/cyclonedx/src/funTest/resources/cyclonedx-reporter-expected-result-name-override.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
}
3838
}
3939
],
40-
"copyright" : "Copyright 1"
40+
"copyright" : "Copyright 1",
41+
"properties" : [
42+
{
43+
"name" : "ort:effectiveLicense",
44+
"value" : "MIT"
45+
}
46+
]
4147
},
4248
"licenses" : [
4349
{
@@ -142,6 +148,10 @@
142148
}
143149
],
144150
"properties" : [
151+
{
152+
"name" : "ort:effectiveLicense",
153+
"value" : "MIT AND MIT WITH Libtool-exception"
154+
},
145155
{
146156
"name" : "ort:dependencyType",
147157
"value" : "direct"
@@ -206,6 +216,10 @@
206216
}
207217
],
208218
"properties" : [
219+
{
220+
"name" : "ort:effectiveLicense",
221+
"value" : "MIT AND BSD-3-Clause"
222+
},
209223
{
210224
"name" : "ort:dependencyType",
211225
"value" : "direct"
@@ -252,6 +266,10 @@
252266
}
253267
],
254268
"properties" : [
269+
{
270+
"name" : "ort:effectiveLicense",
271+
"value" : "MIT"
272+
},
255273
{
256274
"name" : "ort:dependencyType",
257275
"value" : "direct"
@@ -335,6 +353,10 @@
335353
}
336354
],
337355
"properties" : [
356+
{
357+
"name" : "ort:effectiveLicense",
358+
"value" : "MIT AND BSD-3-Clause AND LicenseRef-scancode-truecrypt-3.1 AND LGPL-3.0-or-later WITH openvpn-openssl-exception"
359+
},
338360
{
339361
"name" : "ort:dependencyType",
340362
"value" : "direct"
@@ -375,6 +397,10 @@
375397
}
376398
],
377399
"properties" : [
400+
{
401+
"name" : "ort:effectiveLicense",
402+
"value" : "MIT"
403+
},
378404
{
379405
"name" : "ort:dependencyType",
380406
"value" : "direct"

plugins/reporters/cyclonedx/src/funTest/resources/cyclonedx-reporter-expected-result-top-level-project.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
}
3838
}
3939
],
40-
"copyright" : "Copyright 1"
40+
"copyright" : "Copyright 1",
41+
"properties" : [
42+
{
43+
"name" : "ort:effectiveLicense",
44+
"value" : "MIT"
45+
}
46+
]
4147
},
4248
"licenses" : [
4349
{
@@ -142,6 +148,10 @@
142148
}
143149
],
144150
"properties" : [
151+
{
152+
"name" : "ort:effectiveLicense",
153+
"value" : "MIT AND MIT WITH Libtool-exception"
154+
},
145155
{
146156
"name" : "ort:dependencyType",
147157
"value" : "direct"
@@ -206,6 +216,10 @@
206216
}
207217
],
208218
"properties" : [
219+
{
220+
"name" : "ort:effectiveLicense",
221+
"value" : "MIT AND BSD-3-Clause"
222+
},
209223
{
210224
"name" : "ort:dependencyType",
211225
"value" : "direct"
@@ -252,6 +266,10 @@
252266
}
253267
],
254268
"properties" : [
269+
{
270+
"name" : "ort:effectiveLicense",
271+
"value" : "MIT"
272+
},
255273
{
256274
"name" : "ort:dependencyType",
257275
"value" : "direct"
@@ -335,6 +353,10 @@
335353
}
336354
],
337355
"properties" : [
356+
{
357+
"name" : "ort:effectiveLicense",
358+
"value" : "MIT AND BSD-3-Clause AND LicenseRef-scancode-truecrypt-3.1 AND LGPL-3.0-or-later WITH openvpn-openssl-exception"
359+
},
338360
{
339361
"name" : "ort:dependencyType",
340362
"value" : "direct"
@@ -375,6 +397,10 @@
375397
}
376398
],
377399
"properties" : [
400+
{
401+
"name" : "ort:effectiveLicense",
402+
"value" : "MIT"
403+
},
378404
{
379405
"name" : "ort:dependencyType",
380406
"value" : "direct"

plugins/reporters/cyclonedx/src/funTest/resources/cyclonedx-reporter-expected-result-type-override.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@
3737
}
3838
}
3939
],
40-
"copyright" : "Copyright 1"
40+
"copyright" : "Copyright 1",
41+
"properties" : [
42+
{
43+
"name" : "ort:effectiveLicense",
44+
"value" : "MIT"
45+
}
46+
]
4147
},
4248
"licenses" : [
4349
{
@@ -142,6 +148,10 @@
142148
}
143149
],
144150
"properties" : [
151+
{
152+
"name" : "ort:effectiveLicense",
153+
"value" : "MIT AND MIT WITH Libtool-exception"
154+
},
145155
{
146156
"name" : "ort:dependencyType",
147157
"value" : "direct"
@@ -206,6 +216,10 @@
206216
}
207217
],
208218
"properties" : [
219+
{
220+
"name" : "ort:effectiveLicense",
221+
"value" : "MIT AND BSD-3-Clause"
222+
},
209223
{
210224
"name" : "ort:dependencyType",
211225
"value" : "direct"
@@ -252,6 +266,10 @@
252266
}
253267
],
254268
"properties" : [
269+
{
270+
"name" : "ort:effectiveLicense",
271+
"value" : "MIT"
272+
},
255273
{
256274
"name" : "ort:dependencyType",
257275
"value" : "direct"
@@ -335,6 +353,10 @@
335353
}
336354
],
337355
"properties" : [
356+
{
357+
"name" : "ort:effectiveLicense",
358+
"value" : "MIT AND BSD-3-Clause AND LicenseRef-scancode-truecrypt-3.1 AND LGPL-3.0-or-later WITH openvpn-openssl-exception"
359+
},
338360
{
339361
"name" : "ort:dependencyType",
340362
"value" : "direct"
@@ -375,6 +397,10 @@
375397
}
376398
],
377399
"properties" : [
400+
{
401+
"name" : "ort:effectiveLicense",
402+
"value" : "MIT"
403+
},
378404
{
379405
"name" : "ort:dependencyType",
380406
"value" : "direct"

plugins/reporters/cyclonedx/src/funTest/resources/cyclonedx-reporter-expected-result-with-findings.json

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@
3838
}
3939
}
4040
],
41-
"copyright" : "Copyright 1"
41+
"copyright" : "Copyright 1",
42+
"properties" : [
43+
{
44+
"name" : "ort:effectiveLicense",
45+
"value" : "MIT"
46+
}
47+
]
4248
},
4349
"licenses" : [
4450
{
@@ -143,6 +149,10 @@
143149
}
144150
],
145151
"properties" : [
152+
{
153+
"name" : "ort:effectiveLicense",
154+
"value" : "MIT AND MIT WITH Libtool-exception"
155+
},
146156
{
147157
"name" : "ort:dependencyType",
148158
"value" : "direct"
@@ -207,6 +217,10 @@
207217
}
208218
],
209219
"properties" : [
220+
{
221+
"name" : "ort:effectiveLicense",
222+
"value" : "MIT AND BSD-3-Clause"
223+
},
210224
{
211225
"name" : "ort:dependencyType",
212226
"value" : "direct"
@@ -253,6 +267,10 @@
253267
}
254268
],
255269
"properties" : [
270+
{
271+
"name" : "ort:effectiveLicense",
272+
"value" : "MIT"
273+
},
256274
{
257275
"name" : "ort:dependencyType",
258276
"value" : "direct"
@@ -336,6 +354,10 @@
336354
}
337355
],
338356
"properties" : [
357+
{
358+
"name" : "ort:effectiveLicense",
359+
"value" : "MIT AND BSD-3-Clause AND LicenseRef-scancode-truecrypt-3.1 AND LGPL-3.0-or-later WITH openvpn-openssl-exception"
360+
},
339361
{
340362
"name" : "ort:dependencyType",
341363
"value" : "direct"
@@ -376,6 +398,10 @@
376398
}
377399
],
378400
"properties" : [
401+
{
402+
"name" : "ort:effectiveLicense",
403+
"value" : "MIT"
404+
},
379405
{
380406
"name" : "ort:dependencyType",
381407
"value" : "direct"

plugins/reporters/cyclonedx/src/funTest/resources/cyclonedx-reporter-expected-result-without-findings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@
2020
"group" : "@ort",
2121
"name" : "project-without-findings",
2222
"version" : "1.0",
23-
"description" : ""
23+
"description" : "",
24+
"properties" : [
25+
{
26+
"name" : "ort:effectiveLicense",
27+
"value" : "NONE"
28+
}
29+
]
2430
},
2531
"licenses" : [
2632
{

0 commit comments

Comments
 (0)