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 <[email protected]>
Signed-off-by: Steve Springett <[email protected]>
|
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": "$[[email protected] == '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": "$[[email protected] == 'service' && @.isExternal == false]" },
"aggregate": "complete"
},
{
"select": "$.inventories[*].components",
"subjects": ["acme-agent"],
"filter": { "expression": "$[[email protected] == '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": "$[[email protected] == '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": "$[[email protected] == '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": "$[[email protected] == '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": "$[[email protected] == '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 |
|
@lsmith77 in the valid component-types example three filters split one array, so "shall not cover the same array" rejects it. The sentence should say item. With expression filters overlap is testable only on items present, so a passing BOM can fail once a library is added. A typed @StanimirTenev's question stays open: his fixture gives an unclaimed file and an unopenable file the same not-assessed result. |
|
Thank you, that is a sharper statement of the gap than mine. The wording fix is right: "shall not cover the same array" rejects the valid component-types example, so it should say "item". And the added-library case is the one that matters: with expression filters, overlap is only testable on items present, so a BOM that passes today can fail tomorrow when a library is added, without the BOM changing. That is exactly why a checker verdict cannot rest on the BOM alone. I agree the typed Eshaan Jain, independent researcher (IEEE Senior Member) |
|
Thanks, @astrogilda and @eshaanjain26. Eshaan's wording is the distinction I meant: one file was never examined, the other could not be opened, and the repair for each is different (widen the scope, or fix the input). At Two ways I can see, the smaller first:
If either is in scope for 2.0, I can add a valid and an invalid fixture for it to this PR. If it belongs to a later version, the sentence in option 2 would already help consumers read the current value correctly. |
|
Option 1 is the one worth taking. A typed value beside aggregate lets a consumer count failed inputs without parsing prose, and that was the gap in the first place: an annotation with free text puts the distinction back where a checker cannot read it. Option 2 documents the ambiguity instead of removing it. Two details to pin down in the fixture: the enum should stay closed to the two values so a producer cannot invent a third, and the invalid fixture should show a notAssessedBecause on any aggregate other than not-assessed being rejected. I will review the fixtures once they are up. |
Closes #1159