Impact analysis of fixed events - Discrepancy between specification and implementation
- Dominant language
- Go
- Stars
- 2.9k
- Forks
- 369
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 149
Description
**Describe the bug**
The OSV.dev implementation of impact analysis diverges from the [specification](https://ossf.github.io/osv-schema/#evaluation) for `fixed` events. They seem to be treated like `limit` events, differently from the [example](https://ossf.github.io/osv-schema/#limit-events) in the specification.
**To Reproduce**
1. clone https://github.com/RomainLefeuvre/osv.dev
2. setup your python virtualenv as described in the osv documentation
3. from the root level of the repo, execute `python -m osv.analyze_tool --format json "./osv/osv_bug/vuln.json"`
4. it prints the vulnerable commits:
```
❯ python -m osv.analyze_tool --format json "./osv/osv_bug/vuln.json"
INFO:root:Analyzing ./osv/osv_bug/vuln.json
INFO:root:Cloning https://github.com/RomainLefeuvre/osv_issue_minimal_example.git to /tmp/tmpakfa5gj5
INFO:root:Finding equivalent regress commit to d241812d2722d573a7b096d44d139946d8dcb484 in refs/remotes/origin/main in https://github.com/RomainLefeuvre/osv_issue_minimal_example.git
INFO:root:Finding equivalent fix commit to 80f15009d903ac95ffc5a5a07a3a213e4980bb62 in refs/remotes/origin/main in https://github.com/RomainLefeuvre/osv_issue_minimal_example.git
INFO:root:Getting commits d241812d2722d573a7b096d44d139946d8dcb484..80f15009d903ac95ffc5a5a07a3a213e4980bb62 from https://github.com/RomainLefeuvre/osv_issue_minimal_example.git
AnalyzeResult(has_changes=False, commits={'868d891cffe96cd67b2abac82c62ade7219af9b5', 'd241812d2722d573a7b096d44d139946d8dcb484', 'e54222cfdedd86a37dc37d999ebc63dccf3fc9da', 'ec5e313170f68d3fc575d107a8b92d43ae140249'})
INFO:root:No changes required.
```
I.e.:
- `868d891cffe96cd67b2abac82c62ade7219af9b5` (C)
- `d241812d2722d573a7b096d44d139946d8dcb484` (X)
- `e54222cfdedd86a37dc37d999ebc63dccf3fc9da` (A)
- `ec5e313170f68d3fc575d107a8b92d43ae140249` (B)
Note that :
- The history of the repo at matches the example in the specification:

- The [toy vulnerability](https://github.com/RomainLefeuvre/osv.dev/blob/6b03f4d9723c5d14249c24b67bf032a9ce271633/osv/osv_bug/vuln.json?plain=1#L1-L30) matches also the one used in the example :
```
{
"id": "test",
"details": "test",
"modified": "2024-01-10T08:29:31.368677Z",
"published": "2024-01-10T08:29:31.368677Z",
"affected": [
{
"package": {
"name": "test",
"ecosystem": "PyPI",
"purl": "test"
},
"ranges": [
{
"type": "GIT",
"repo": "https://github.com/RomainLefeuvre/osv_issue_minimal_example.git",
"events": [
{
"introduced": "d241812d2722d573a7b096d44d139946d8dcb484"
},
{
"fixed": "80f15009d903ac95ffc5a5a07a3a213e4980bb62"
}
]
}
],
"schema_version": "1.6.0"
}
]
}
```
**Expected behaviour**
D, F and E should also be reported as vulnerable as described:

> Without an explicit limit, the list of computed affected commits will be X, A, B, C, D, E, F. This is the desired behaviour in most cases.
Contributor guide
Assessment
This issue has not been assessed yet.