Skip to content

Commit 23f1eb3

Browse files
Merge pull request #58 from scanoss/add-metadata-to-cyclonedx
SP-1584 / added metadata field to cyclonedx output
2 parents 694e139 + 515cb9f commit 23f1eb3

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Upcoming changes...
1111

12+
## [1.16.0] - 2024-10-08
13+
### Added
14+
- Added the `metadata` field to the output in CycloneDX format, now including the fields `timestamp`, `tool vendor`, `tool` and `tool version`
15+
1216
## [1.15.0] - 2024-09-17
1317
### Added
1418
- Added Results sub-command:
@@ -350,3 +354,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
350354
[1.13.0]: https://github.com/scanoss/scanoss.py/compare/v1.12.3...v1.13.0
351355
[1.14.0]: https://github.com/scanoss/scanoss.py/compare/v1.13.0...v1.14.0
352356
[1.15.0]: https://github.com/scanoss/scanoss.py/compare/v1.14.0...v1.15.0
357+
[1.16.0]: https://github.com/scanoss/scanoss.py/compare/v1.15.0...v1.16.0

src/scanoss/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,4 @@
2222
THE SOFTWARE.
2323
"""
2424

25-
__version__ = "1.15.0"
25+
__version__ = "1.16.0"

src/scanoss/cyclonedx.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
import os.path
2626
import sys
2727
import uuid
28+
import datetime
29+
30+
from . import __version__
2831

2932
from .scanossbase import ScanossBase
3033
from .spdxlite import SpdxLite
@@ -186,6 +189,16 @@ def produce_from_json(self, data: json, output_file: str = None) -> bool:
186189
'specVersion': '1.4',
187190
'serialNumber': f'urn:uuid:{uuid.uuid4()}',
188191
'version': 1,
192+
'metadata': {
193+
'timestamp': datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"),
194+
'tools': [
195+
{
196+
'vendor': 'SCANOSS',
197+
'name': 'scanoss-py',
198+
'version': __version__,
199+
}
200+
]
201+
},
189202
'components': [],
190203
'vulnerabilities': []
191204
}

0 commit comments

Comments
 (0)