Repository navigation
Composition Refactor - #1258
Composition Refactor#1258stevespringett wants to merge 3 commits into
Conversation
…and fields. Removal of legacy enums. (#1159) Signed-off-by: Steve Springett <steve@springett.us>
Signed-off-by: Steve Springett <steve@springett.us>
|
Thanks, this covers everything #1159 asked for. Three points:
|
|
A view from the producer side, in case it's useful for review. We maintain qrp-mcp, a source-code scanner that writes a CBOM. Its CycloneDX 1.6 export carries a coverage block as private What maps directly
The input side, which I expected to be missing and isn't Our main coverage figure is about the input. On As a concrete addition, here is a fixture for that pattern. It validates against the 2.0 modules at "inventories": [{
"subject": { "refId": "scanned-tree", "type": "application", "name": "shorlist", "version": "f5ca75c" },
"components": [
{ "refId": "file:app/sign.py", "type": "file", "name": "app/sign.py", "components": [ { "ref": "crypto:rsa" } ] },
{ "refId": "file:app/util.py", "type": "file", "name": "app/util.py" },
{ "refId": "file:README.md", "type": "file", "name": "README.md" },
{ "refId": "file:keys/broken.pem", "type": "file", "name": "keys/broken.pem" }
]
}],
"compositions": [
{ "select": "$.inventories[*].components", "subjects": ["scanned-tree"],
"filter": { "expression": "$[?@.type == 'file']" }, "aggregate": "complete" },
{ "roots": ["file:app/sign.py", "file:app/util.py"], "select": "$.components", "aggregate": "unknown" },
{ "roots": ["file:README.md"], "select": "$.components", "aggregate": "not-assessed" },
{ "roots": ["file:keys/broken.pem"], "select": "$.components", "aggregate": "not-assessed" }
]Reading it: every file in the tree is listed. For the files that were read, the cryptography in them is Two things building it raised
Reproduce the numbers: |
|
RFC period ends 28. Dezember 2026 |
|
Nice to see #1159 implemented here as The That makes it easy to write a composition that leaves out part of its own inventory without noticing: {
"specFormat": "CycloneDX",
"specVersion": "2.0",
"inventories": [
{
"subject": { "refId": "acme-agent", "type": "application", "name": "Acme Agent" },
"components": [
{ "refId": "fs", "type": "service", "name": "fs" },
{ "refId": "gh", "type": "service", "name": "gh", "isExternal": true }
]
}
],
"compositions": [
{
"select": "$.inventories[*].components",
"subjects": ["acme-agent"],
"filter": { "expression": "$[?@.type == 'service' && @.isExternal == false]" },
"aggregate": "complete"
},
{
"select": "$.inventories[*].components",
"subjects": ["acme-agent"],
"filter": { "expression": "$[?@.type == 'service' && @.isExternal == true]" },
"aggregate": "not-assessed"
}
]
}This validates against the 2.0 schemas at 600b605. Strictly the first composition covers services whose The filter text already settles which reading is right, so this is about making the consequence visible where people will trip on it. |
This is another case for typed criteria: a typed criterion can apply schema defaults, while an expression over the raw JSON sees only what the producer wrote. |
|
Thank you for the summary table, and for taking the disjointness point into the design as a normative rule. I read the PR against the asks in your table, and the coverage is real: the aggregate values are all there, the silence rule is stated, Two things I would ask about before this lands. First, "Compositions shall not overlap" is normative in the schema description, which is the right call, but JSON Schema cannot enforce it, and the PR has no negative test case for two overlapping compositions. A checker has to implement overlap detection itself, and two checkers could disagree on what counts as overlap. Is that a checker responsibility you are happy to leave unstated, or would a note in the spec plus one invalid test file help? Second, The four fragments below are the cases I checked the design against. I am happy to turn them into test resources if that would help. Eshaan Jain, independent researcher (IEEE Senior Member) Example BOM fragments with checker verdictsAll four use the same subject, 1. Missing: no composition covers the class{
"compositions": [
{
"select": "$.inventories[*].components",
"subjects": ["acme-portal"],
"filter": { "expression": "$[?@.type == 'library']" },
"aggregate": "complete"
}
]
}Expected checker verdict: not-specified. No composition covers machine-learning-model components, so their completeness is not specified. The checker must report "coverage not specified", not "no models exist" and not "non-conformant", unless a perspective or requirement demands coverage of that class. 2. Not-assessed: the class was not examined{
"compositions": [
{
"select": "$.inventories[*].components",
"subjects": ["acme-portal"],
"filter": { "expression": "$[?@.type == 'machine-learning-model']" },
"aggregate": "not-assessed"
}
]
}Expected checker verdict: not-assessed. The producer states the class was not assessed. A missing model component must not be read as "the product uses no models". A checker enforcing a procurement perspective that requires this class would report non-conformant here, with the reason "not assessed", which is a different failure from a missing class. 3. Redacted: the class was assessed but the items are withheld{
"compositions": [
{
"select": "$.inventories[*].components",
"subjects": ["acme-portal"],
"filter": { "expression": "$[?@.type == 'machine-learning-model']" },
"aggregate": "redacted"
}
]
}Expected checker verdict: redacted. Completeness was assessed and some or all items are withheld. The checker must report "withheld" and point the recipient at the document's security contact. If the document declares no security contact, the checker should flag that the redaction has nowhere to be resolved, which is the open question in the review comment above. 4. Externally covered: the class is described in another BOM{
"compositions": [
{
"select": "$.inventories[*].components",
"subjects": ["acme-portal"],
"filter": { "expression": "$[?@.type == 'machine-learning-model']" },
"aggregate": "delegated",
"describedIn": [
{
"type": "bom",
"url": "urn:tei:uuid:acme.example:5f1b6c0e-6a2b-4c1e-9d2a-7b3f0c9e1a44"
}
]
}
]
}Expected checker verdict: delegated. Completeness is stated in the referenced document. The checker must follow |
Closes #1159