CycloneDX output: metadata.properties[].value emits JSON array instead of string
Maintainer thường phản hồi trong vòng 3 ngày
@0Cymantek0 đang làm issue này rồi.
Từ ngày 11/10/2026.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với lệnh --cyclonedx trong issue, sau đó chạy script kiểm tra Python để liệt kê các property có giá trị không phải chuỗi. Tìm trong mã xuất CycloneDX chỗ property scancode:options được tạo từ danh sách các tùy chọn. Xong khi mọi metadata.properties[].value đều là chuỗi và script kiểm tra không in ra gì. Nội dung payload không cho biết nên nối bằng dấu cách, dấu phẩy hay mã hóa JSON, vì vậy hãy xác nhận lựa chọn đó trước khi chỉnh sửa.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When using --cyclonedx output, ScanCode produces metadata.properties[].value as a JSON array instead of a string. The CycloneDX specification (versions 1.4, 1.5, and 1.6) defines properties[].value as type: string.
This causes downstream tools like cyclonedx-cli merge to crash:
Unhandled exception: System.Text.Json.JsonException:
The JSON value could not be converted to System.String.
Path: $.metadata.properties[1].value
---> System.InvalidOperationException:
Cannot get the value of a token type 'StartArray' as a string.
Example output (simplified)
{
"metadata": {
"properties": [
{
"name": "scancode:version",
"value": "33.0.0"
},
{
"name": "scancode:options",
"value": ["--package", "--license", "--copyright", "--strip-root"]
}
]
}
}
The second property has value as an array ["--package", "--license", "--copyright", "--strip-root"] instead of a string like "--package --license --copyright --strip-root".
CycloneDX spec reference
The value field in a property object is defined as type: string in all CycloneDX spec versions:
The spec says: "The value of the property." with type string. If multiple values need to be represented, the spec recommends duplicate property names with different values, not array-typed values.
Related
- cyclonedx-cli merge crash on array values: https://github.com/CycloneDX/cyclonedx-cli/issues/246
To reproduce
pip install scancode-toolkit
scancode --package --license --copyright --cyclonedx output.cdx.json /path/to/project
Then check for non-string property values:
import json
with open('output.cdx.json') as f:
data = json.load(f)
for p in data.get('metadata', {}).get('properties', []):
if not isinstance(p.get('value'), str):
print(f'Non-string value: {p["name"]} = {p["value"]} (type: {type(p["value"]).__name__})')
Expected behavior
All properties[].value fields should be strings per the CycloneDX specification. Array values should be serialized as a string (e.g. comma-separated or JSON-encoded string).
Environment
- scancode-toolkit: latest (installed via pip)
- Output format:
--cyclonedx(JSON) - Python: 3.12+
- Ngôn ngữ chính
- Python
- Star
- 2.7k
- Fork
- 831
- Merge trung bình
- 3 ngày 4 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của aboutcode-org/scancode-toolkit
-
bug: Unreachable JSON extension and format validation in validate_input_pathCó thể đã có người làm @0Cymantek0 đã nhận 18 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
aboutcode-org/scancode-toolkit#5351 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Duplicate 'COPYLEFT' entries in legal file classification names in legal.py and classify.pyCó thể đã có người làm @Pradeepbeleri đã nhận 45 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
aboutcode-org/scancode-toolkit#5319 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Duplicate autogen.sh entry in commoncode default ignoresCó thể đã có người làm @Daksha1611 đã nhận 47 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
aboutcode-org/scancode-toolkit#5316 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Duplicate LGPL key in rubygems LICENSES_MAPPING makes one mapping unreachableCó thể đã có người làm @Daksha1611 đã nhận 47 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
aboutcode-org/scancode-toolkit#5314 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Duplicate keys in alpine DECLARED_TO_SPDX silently discard two license mappingsCó thể đã có người làm @Daksha1611 đã nhận 47 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
aboutcode-org/scancode-toolkit#5312 ·
Maintainer thường phản hồi trong vòng 3 ngày
Tất cả issue của aboutcode-org/scancode-toolkit
Issue tương tự
-
Context/namespace resources fail in-cluster: "Invalid kube-config file. No configuration found."Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
bug documentation
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
awslabs/visual-asset-management-system#880 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
netbox status: needs owner type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
netbox-community/netbox#23533 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
app: scripts status: backlog type: documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
netbox-community/netbox-scripts#68 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 91/100
marin-community/marin#10765 ·
Maintainer thường phản hồi trong vòng 1 ngày