CycloneDX / CycloneDX/cyclonedx-python-lib

feat: add `cyclonedx.model.dependency.Dependency.provides`

Đang mở
#691 4 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement help wanted schema 1.6
Ngôn ngữ chính
Python
Star
116
Fork
67
Merge trung bình
8 ngày 2 giờ
Pull request đã merge (30 ngày)
2

Mô tả

**Library Version:** `7.6.1`

**Description:**

**Steps to Reproduce:**
1. Use the example JSON provided in the [CycloneDX bom-examples repository](https://github.com/CycloneDX/bom-examples/blob/c0436d86cd60693f01d19fe1aacfd01e70e17036/CBOM/Example-With-Dependencies/bom.json).
2. Run the following script:

```python
import json
from cyclonedx.model.bom import Bom

# source: https://github.com/CycloneDX/bom-examples/blob/c0436d86cd60693f01d19fe1aacfd01e70e17036/CBOM/Example-With-Dependencies/bom.json

sample = '''{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"metadata": {
"component": {
"type": "application",
"bom-ref": "acme-application",
"name": "Acme Application",
"version": "1.0"
}
},
"components": [
{
"type": "cryptographic-asset",
"bom-ref": "aes128gcm",
"name": "AES",
"cryptoProperties": {
"assetType": "algorithm",
"algorithmProperties": {
"primitive": "ae",
"parameterSetIdentifier": "128",
"executionEnvironment": "software-plain-ram",
"implementationPlatform": "x86_64",
"certificationLevel": [ "none" ],
"mode": "gcm",
"cryptoFunctions": ["keygen", "encrypt", "decrypt", "tag"],
"classicalSecurityLevel": 128,
"nistQuantumSecurityLevel": 1
},
"oid": "2.16.840.1.101.3.4.1.6"
}
},
{
"type": "library",
"bom-ref": "crypto-library",
"name": "Crypto library",
"version": "1.0.0"
},
{
"type": "library",
"bom-ref": "some-library",
"name": "Some library",
"version": "1.0.0"
}
],
"dependencies": [
{
"ref": "acme-application",
"dependsOn": ["crypto-library"]
},
{
"ref": "crypto-library",
"provides": ["aes128gcm"],
"dependsOn": ["some-library"]
}
]
}'''

data = json.loads(sample)

Bom.from_json(data=data)
```

**Observed Behavior:**
The code fails with the following exception:

```
Traceback (most recent call last):
...
ValueError: Unexpected key provides/provides in data being serialized to cyclonedx.model.dependency.Dependency
```

**Environment:**
- Python version: `3.10`
- Operating System: `macOS`
- Library version: `7.6.1`

Let me know if this works!

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start at cyclonedx.model.dependency.Dependency and the Bom.from_json(data=data) entry point; inspect how dependency fields are deserialized. Add support for the provides field shown in the CycloneDX 1.6 example, then run the reproduction script and confirm Bom.from_json no longer raises the reported ValueError.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
security
Loại issue
Tính năng
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.