Repository navigation
Conversation
Documentation build overview
10 files changed ·
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 5 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
3883f08 to
fd0ec25
Compare
CAOShurong
left a comment
There was a problem hiding this comment.
I independently tested this exact head and the standardized identifiers behave consistently across the supported views.
Verification performed:
- 344 focused enum/model tests passed;
- the full suite passed (7,305 tests);
- flake8 and mypy passed;
- sdist and wheel builds passed;
- a clean wheel install produced schema-valid CycloneDX 1.7 JSON and XML, round-tripped the new fields, and omitted them while retaining the legacy curve on a 1.6 downgrade.
I did not find a correctness regression in the reviewed scope. Review prepared with OpenAI Codex assistance; I verified the commands, outputs, and conclusion.
jkowalleck
left a comment
There was a problem hiding this comment.
we could add the data fields, but i would not want to have them values implemented as enums here.
the enum values are not part of CycloneDX spec itself, but are part of an extra schema https://github.com/CycloneDX/specification/blob/master/schema/cryptography-defs.schema.json
This schema moves in a differnet pace than the CycloneDX, and i dont want to have an external enum chasing reality.
fd0ec25 to
05e0cc4
Compare
@jkowalleck got rid of enums |
|
@jkowalleck anything needed here ? |
|
Independent verification data point, in case it helps the review. We run CBOM round-trip fidelity checks against real assets, and this is the gap we hit on an ML-KEM-768 entry. On the released
So it is silent data loss rather than a validation error, which is the awkward part for CBOM consumers. I installed this PR's head ( One suggestion for the test plan: asserting that "the output validates" cannot catch this class of problem. It may be worth asserting field presence after JSON→model→JSON and XML→model→JSON for the 1.7-only properties, separately from schema validity. Repro, if useful (stub component, no real crypto material): from cyclonedx.model.bom import Bom
from cyclonedx.output import OutputFormat, make_outputter
from cyclonedx.schema import SchemaVersion
bom_in = {
"bomFormat": "CycloneDX", "specVersion": "1.7", "version": 1,
"components": [{
"type": "cryptographic-asset", "bom-ref": "crypto/ml-kem-768",
"name": "ML-KEM-768",
"cryptoProperties": {"assetType": "algorithm", "algorithmProperties": {
"primitive": "kem", "algorithmFamily": "ML-KEM",
"parameterSetIdentifier": "ML-KEM-768",
"ellipticCurve": "anssi/FRP256v1",
"nistQuantumSecurityLevel": 3}},
}],
}
bom = Bom.from_json(bom_in)
out = make_outputter(bom, OutputFormat.JSON, SchemaVersion.V1_7).output_as_string()
print("algorithmFamily" in out, "ellipticCurve" in out) # 11.12.0: False FalseBackground: we noticed this through the round-trip harness in our CBOM tooling — https://github.com/Lennonhaha/fibemate-tools/tree/main/verifact — and I am happy to file the round-trip test gap as a separate issue for tracking if that is preferred over folding it into this PR. |
|
@Lennonhaha excellent catch, let me work on that |
|
@Lennonhaha see 31476f2 |
f757c33 to
1af5683
Compare
|
Verified on 31476f2 in a clean venv:
The two round-trip tests cover exactly the failure I reported. Thanks for |
|
review done by Claude Fable 5.2, prompt: "do a review, comment your findings" Scope: reviewed head Verdict: the code change looks correct and matches the maintainer's request for plain strings instead of enums. No blocking defects found. The points below are mostly about the PR description and documentation. What I checked and found correct
Findings
Test nits
|
CycloneDX 1.7 distinguishes schema-defined families and curves while older consumers still depend on free-form curve metadata. Derive the accepted cases from the bundled schema and gate standardized serialization to the new view. Preserve the legacy value through comparison and rendering, then exercise strict schema output and downgrade behavior. Signed-off-by: Quentin Kaiser <quentin.kaiser@onekey.com>
e28a36f to
6a9725a
Compare
|
@jkowalleck Thanks for the review. I’ve expanded both docstrings with identifier sources, validation limitations, return types, and version availability. I also documented curve’s deprecation and the 1.6 downgrade behavior: callers must set legacy curve explicitly; no automatic fallback is added. The schema-aligned comparison order stays, with new tests covering both identifiers’ equality, hashing, sorting, and sort precedence. I moved the 1.7 tests into the existing class and added explicit UTF-8 encoding to the XML snapshot read. All 7,051 tests, flake8, and mypy pass. I’ve also prepared a revised PR description reflecting the two optional string fields and clarifying the original AI prompt’s broader scope. I kept the explicit round-trip regression tests and synthetic fixture. The fixture remains schema-valid, though its algorithm combination is intentionally synthetic. |
Description
Add optional string properties algorithm_family and elliptic_curve to AlgorithmProperties, serialized as algorithmFamily and ellipticCurve in CycloneDX 1.7 JSON and XML.
Both fields participate in equality, hashing, and sorting, with comparison precedence following schema field order. Correct XML sequencing so execution environment and implementation platform have distinct positions.
Document valid identifier sources, version availability, and the deprecation of legacy curve. Add regression coverage for comparison, hashing, sorting, JSON/XML round trips, and downgrade behavior.
The original disclosed AI prompt describes a broader request. The final implementation is limited to these two string properties; enums and certificate-state/extension helpers are outside this PR.
Identifiers are not validated by the library; arbitrary strings can fail strict JSON schema validation. Both fields are omitted from older output, so callers must explicitly set legacy curve to retain curve information in CycloneDX 1.6.
AI Tool Disclosure
codexgpt-5.6-sol xhighLLM prompt
CryptoAlgorithmFamilyandCryptoEllipticCurveenums. ExtendAlgorithmPropertieswithalgorithm_familyandelliptic_curve, emitted only for 1.7; retain deprecatedcurve.Serialization behavior
SchemaVersion1Dot7, with exact CycloneDX JSON names, XML element names, ordering, nested arrays, and date/hash mappings.Test plan
key-wrap, and protocol types.Assumptions
SortedSetstorage.Affirmation