Skip to content

Commit da7aa1b

Browse files
authored
Merge pull request #97 from stacknil/codex/v1rc-evidence-confidence-labels
feat(sbom): update evidence confidence labels
2 parents 7a4c55b + f215d4e commit da7aa1b

15 files changed

Lines changed: 57 additions & 47 deletions

scripts/validate-reviewer-routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@
208208
"local_manifest_only",
209209
"sbom_present",
210210
"policy_matched",
211-
"enrichment_mocked",
212-
"enrichment_live",
211+
"enrichment_recorded",
212+
"provenance_recorded",
213213
"not a package safety verdict",
214214
"not a CVE result",
215215
),

tools/sbom-diff-and-risk/docs/report-schema.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ not a CVE result. The same value appears at top level, in `summary`, and in
130130
| `local_manifest_only` | The report was produced from local manifest-style inputs without SBOM input, policy matches, or enrichment evidence. |
131131
| `sbom_present` | At least one input is an SBOM format such as CycloneDX JSON or SPDX JSON. |
132132
| `policy_matched` | Local policy evaluation produced at least one blocking, warning, or suppressed policy match. |
133-
| `enrichment_mocked` | Enrichment-shaped evidence is present without recorded live network access, or the report explicitly marks constructed snapshot evidence as mocked. |
134-
| `enrichment_live` | Opt-in enrichment recorded live network access for PyPI provenance or OpenSSF Scorecard evidence. |
133+
| `enrichment_recorded` | Optional non-provenance enrichment evidence, such as OpenSSF Scorecard evidence, was recorded for the report. |
134+
| `provenance_recorded` | PyPI provenance evidence or provenance-enrichment metadata was recorded for the report. |
135135

136136
`summary.policy` appears only when a policy is applied. Absence of
137137
`summary.policy` means policy was not used, not that policy evaluation failed.

tools/sbom-diff-and-risk/docs/summary-json-ci-cookbook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ if ($newPackageCount -gt $maxNewPackages) {
8181
- `summary.enrichment` appears only when PyPI or Scorecard enrichment is used.
8282
- `summary.evidence_confidence` is always present and can be
8383
`local_manifest_only`, `sbom_present`, `policy_matched`,
84-
`enrichment_mocked`, or `enrichment_live`.
84+
`enrichment_recorded`, or `provenance_recorded`.
8585
- `unchanged` is absent because unchanged components are not modeled.
8686
- Absence of `summary.policy` or `summary.enrichment` means the feature was
8787
not used, not that it failed.

tools/sbom-diff-and-risk/examples/sample-provenance-report.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"suspicious_source": 0,
1313
"not_evaluated": 0
1414
},
15-
"evidence_confidence": "enrichment_mocked",
15+
"evidence_confidence": "provenance_recorded",
1616
"policy": {
1717
"status": "fail",
1818
"blocking": 2,
@@ -33,7 +33,7 @@
3333
}
3434
}
3535
},
36-
"evidence_confidence": "enrichment_mocked",
36+
"evidence_confidence": "provenance_recorded",
3737
"components": {
3838
"added": [
3939
{
@@ -746,7 +746,7 @@
746746
},
747747
"exit_code": 1
748748
},
749-
"evidence_confidence": "enrichment_mocked",
749+
"evidence_confidence": "provenance_recorded",
750750
"enrichment": {
751751
"mode": "opt_in_pypi",
752752
"pypi_enabled": true,

tools/sbom-diff-and-risk/examples/sample-provenance-report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- Added: 2
77
- Removed: 0
88
- Version changes: 1
9-
- Evidence confidence: enrichment_mocked
9+
- Evidence confidence: provenance_recorded
1010

1111
## Risk buckets
1212
- new_package: 2

tools/sbom-diff-and-risk/examples/sample-scorecard-report.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"suspicious_source": 0,
1313
"not_evaluated": 0
1414
},
15-
"evidence_confidence": "enrichment_mocked",
15+
"evidence_confidence": "enrichment_recorded",
1616
"policy": {
1717
"status": "warn",
1818
"blocking": 0,
@@ -32,7 +32,7 @@
3232
}
3333
}
3434
},
35-
"evidence_confidence": "enrichment_mocked",
35+
"evidence_confidence": "enrichment_recorded",
3636
"components": {
3737
"added": [
3838
{
@@ -575,7 +575,7 @@
575575
},
576576
"exit_code": 0
577577
},
578-
"evidence_confidence": "enrichment_mocked",
578+
"evidence_confidence": "enrichment_recorded",
579579
"enrichment": {
580580
"mode": "opt_in_scorecard",
581581
"pypi_enabled": false,

tools/sbom-diff-and-risk/examples/sample-scorecard-report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
- Added: 2
77
- Removed: 0
88
- Version changes: 1
9-
- Evidence confidence: enrichment_mocked
9+
- Evidence confidence: enrichment_recorded
1010

1111
## Risk buckets
1212
- new_package: 2

tools/sbom-diff-and-risk/src/sbom_diff_risk/evidence_confidence.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ def evidence_confidence_for_report(report: CompareReport) -> EvidenceConfidence:
99
if report.metadata.evidence_confidence is not None:
1010
return report.metadata.evidence_confidence
1111

12-
if _has_enrichment_evidence(report):
13-
if _has_live_enrichment(report):
14-
return EvidenceConfidence.ENRICHMENT_LIVE
15-
return EvidenceConfidence.ENRICHMENT_MOCKED
12+
if _has_provenance_record(report):
13+
return EvidenceConfidence.PROVENANCE_RECORDED
14+
15+
if _has_enrichment_record(report):
16+
return EvidenceConfidence.ENRICHMENT_RECORDED
1617

1718
if _has_policy_match(report):
1819
return EvidenceConfidence.POLICY_MATCHED
@@ -27,21 +28,20 @@ def evidence_confidence_value(report: CompareReport) -> str:
2728
return evidence_confidence_for_report(report).value
2829

2930

30-
def _has_enrichment_evidence(report: CompareReport) -> bool:
31+
def _has_provenance_record(report: CompareReport) -> bool:
3132
metadata = report.metadata.enrichment
32-
if metadata.pypi_enabled or metadata.scorecard_enabled:
33+
if metadata.pypi_enabled:
3334
return True
3435

35-
return any(component.provenance is not None or component.scorecard is not None for component in _all_components(report))
36+
return any(component.provenance is not None for component in _all_components(report))
3637

3738

38-
def _has_live_enrichment(report: CompareReport) -> bool:
39+
def _has_enrichment_record(report: CompareReport) -> bool:
3940
metadata = report.metadata.enrichment
40-
return (
41-
metadata.network_access_performed
42-
or metadata.pypi_network_access_performed
43-
or metadata.scorecard_network_access_performed
44-
)
41+
if metadata.scorecard_enabled:
42+
return True
43+
44+
return any(component.scorecard is not None for component in _all_components(report))
4545

4646

4747
def _has_policy_match(report: CompareReport) -> bool:

tools/sbom-diff-and-risk/src/sbom_diff_risk/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ class EvidenceConfidence(StrEnum):
2222
LOCAL_MANIFEST_ONLY = "local_manifest_only"
2323
SBOM_PRESENT = "sbom_present"
2424
POLICY_MATCHED = "policy_matched"
25-
ENRICHMENT_MOCKED = "enrichment_mocked"
26-
ENRICHMENT_LIVE = "enrichment_live"
25+
ENRICHMENT_RECORDED = "enrichment_recorded"
26+
PROVENANCE_RECORDED = "provenance_recorded"
2727

2828

2929
class ProvenanceStatus(StrEnum):

tools/sbom-diff-and-risk/tests/test_cli_no_enrichment_regression.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def __init__(self, *args, **kwargs) -> None: # noqa: ANN002, ANN003
131131
assert payload["metadata"]["enrichment"]["mode"] == "opt_in_pypi"
132132
assert payload["metadata"]["enrichment"]["pypi_enabled"] is True
133133
assert payload["metadata"]["enrichment"]["pypi_timeout_seconds"] == 2.5
134-
assert payload["evidence_confidence"] == "enrichment_mocked"
134+
assert payload["evidence_confidence"] == "provenance_recorded"
135135
assert payload["notes"][1] == "PyPI provenance enrichment was requested explicitly."
136136
assert payload["trust_signal_notes"] == []
137137

@@ -200,5 +200,5 @@ def build_report_metadata(self) -> ReportEnrichmentMetadata:
200200
assert payload["metadata"]["enrichment"]["mode"] == "opt_in_scorecard"
201201
assert payload["metadata"]["enrichment"]["scorecard_enabled"] is True
202202
assert payload["metadata"]["enrichment"]["scorecard_timeout_seconds"] == 4.25
203-
assert payload["evidence_confidence"] == "enrichment_mocked"
203+
assert payload["evidence_confidence"] == "enrichment_recorded"
204204
assert payload["notes"][1] == "OpenSSF Scorecard enrichment was requested explicitly."

0 commit comments

Comments
 (0)