|
| 1 | +# Policy warning reviewer case |
| 2 | + |
| 3 | +This one-page case fixes a single reviewer question: how does a dependency diff |
| 4 | +produce a local policy warning? |
| 5 | + |
| 6 | +It uses the checked-in CycloneDX example pair and the minimal policy. No |
| 7 | +network enrichment, CVE lookup, malware scan, or package safety verdict is |
| 8 | +involved. |
| 9 | + |
| 10 | +## Fixed input |
| 11 | + |
| 12 | +Run from `tools/sbom-diff-and-risk`: |
| 13 | + |
| 14 | +```powershell |
| 15 | +sbom-diff-risk compare ` |
| 16 | + --before examples/cdx_before.json ` |
| 17 | + --after examples/cdx_after.json ` |
| 18 | + --policy examples/policy-minimal.yml ` |
| 19 | + --out-json outputs/policy-warn-report.json ` |
| 20 | + --out-md outputs/policy-warn-report.md |
| 21 | +``` |
| 22 | + |
| 23 | +Reference inputs and policy: |
| 24 | + |
| 25 | +- [`examples/cdx_before.json`](../examples/cdx_before.json) |
| 26 | +- [`examples/cdx_after.json`](../examples/cdx_after.json) |
| 27 | +- [`examples/policy-minimal.yml`](../examples/policy-minimal.yml) |
| 28 | + |
| 29 | +The minimal policy is intentionally small: |
| 30 | + |
| 31 | +```yaml |
| 32 | +version: 1 |
| 33 | +block_on: |
| 34 | + - unknown_license |
| 35 | +warn_on: |
| 36 | + - new_package |
| 37 | +``` |
| 38 | +
|
| 39 | +## Fixed output |
| 40 | +
|
| 41 | +The checked-in reference outputs are: |
| 42 | +
|
| 43 | +- [`examples/sample-policy-warn-report.json`](../examples/sample-policy-warn-report.json) |
| 44 | +- [`examples/sample-policy-warn-report.md`](../examples/sample-policy-warn-report.md) |
| 45 | + |
| 46 | +The fixed JSON facts for this case are: |
| 47 | + |
| 48 | +| Field | Value | |
| 49 | +| --- | --- | |
| 50 | +| `summary.added` | `1` | |
| 51 | +| `summary.changed` | `1` | |
| 52 | +| `summary.evidence_confidence` | `policy_matched` | |
| 53 | +| `summary.policy.status` | `warn` | |
| 54 | +| `summary.policy.blocking` | `0` | |
| 55 | +| `summary.policy.warning` | `1` | |
| 56 | +| `warning_findings[0].policy_rule` | `new_package` | |
| 57 | +| `warning_findings[0].component_name` | `urllib3` | |
| 58 | +| `warning_findings[0].decision_reason` | `risk_finding_matched_policy_rule` | |
| 59 | +| `warning_findings[0].severity_source` | `warn_on` | |
| 60 | +| `warning_findings[0].observed_value` | `new_package` | |
| 61 | + |
| 62 | +## Explanation |
| 63 | + |
| 64 | +The after input contains `urllib3` `2.2.1`, which is not present in the before |
| 65 | +input. The local risk model classifies that component as `new_package`. |
| 66 | + |
| 67 | +`examples/policy-minimal.yml` maps `new_package` to `warn_on`, so policy |
| 68 | +evaluation adds one warning finding for `urllib3`. The tool exits successfully |
| 69 | +because the warning does not become a blocking policy violation. |
| 70 | + |
| 71 | +The `requests` version change is still visible in the report, but it is not the |
| 72 | +source of this policy warning. It receives `version_change_unclassified` and |
| 73 | +`not_evaluated` findings in offline mode, and the minimal policy does not warn |
| 74 | +or block on either rule. |
| 75 | + |
| 76 | +## Fixed boundary |
| 77 | + |
| 78 | +This case proves that local policy matching can explain why a dependency diff |
| 79 | +triggered a warning. |
| 80 | + |
| 81 | +It does not prove: |
| 82 | + |
| 83 | +- `urllib3` is unsafe |
| 84 | +- `requests` is safe |
| 85 | +- any CVE result |
| 86 | +- any malware verdict |
| 87 | +- not a package safety verdict |
| 88 | +- current PyPI package truth |
| 89 | +- current repository reputation |
| 90 | + |
| 91 | +For field-level policy metadata, see |
| 92 | +[policy-decision-explainability.md](policy-decision-explainability.md). For |
| 93 | +the risk inputs and non-claims, see |
| 94 | +[risk-model-boundary.md](../../../docs/risk-model-boundary.md). |
0 commit comments