Skip to content

Commit 19d4dc3

Browse files
authored
[osv] Improve vers precision for smaller version list (#230)
* For osv data with a smaller version list, track them separately to improve precision Signed-off-by: Prabhu Subramanian <[email protected]> * CI test issues on mac Signed-off-by: Prabhu Subramanian <[email protected]> --------- Signed-off-by: Prabhu Subramanian <[email protected]>
1 parent 2823f18 commit 19d4dc3

File tree

9 files changed

+506
-381
lines changed

9 files changed

+506
-381
lines changed

.github/workflows/pythonapp.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ jobs:
99
runs-on: ${{ matrix.os }}
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest, windows-latest, macos-latest, macos-14]
12+
os: [ubuntu-latest, windows-latest, macos-15]
1313
python-version: ['3.10', '3.11', '3.12', '3.13']
1414
fail-fast: false
1515
steps:
1616
- uses: actions/checkout@v4
17-
- name: Install uv
18-
uses: astral-sh/setup-uv@v5
19-
with:
20-
python-version: ${{ matrix.python-version }}
2117
- name: Set up Python
2218
uses: actions/setup-python@v5
2319
with:
2420
python-version: ${{ matrix.python-version }}
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
23+
with:
24+
python-version: ${{ matrix.python-version }}
2525
- name: Display Python version
2626
run: python -c "import sys; print(sys.version)"
2727
- name: Use Node.js
@@ -35,7 +35,6 @@ jobs:
3535
java-version: '24'
3636
- name: Install dependencies
3737
run: |
38-
python -m pip install --upgrade pip
3938
uv sync --all-extras --dev
4039
- name: Lint with flake8
4140
run: |
@@ -46,6 +45,7 @@ jobs:
4645
env:
4746
PYTHONPATH: .
4847
TEST_VDB_HOME: vdb_data
48+
VDB_TEMP_DIR: ${{ runner.temp }}/vdb-temp
4949
- name: Generate SBOM with cdxgen
5050
run: |
5151
npm install -g @cyclonedx/cdxgen
@@ -54,11 +54,16 @@ jobs:
5454
uv run vdb --cache --only-osv
5555
uv run vdb --bom bom.json
5656
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}
57+
env:
58+
VDB_TEMP_DIR: ${{ runner.temp }}/vdb-temp
5759
- name: CLI tests
5860
run: |
5961
uv run vdb --search "pkg:maven/org.springframework/[email protected]"
6062
uv run vdb --search "pkg:maven/org.hibernate.orm/[email protected]"
6163
uv run vdb --search "pkg:nuget/[email protected]"
6264
uv run vdb --search "pkg:nuget/[email protected]"
6365
uv run vdb --search "pkg:nuget/[email protected]"
66+
uv run vdb --search "pkg:npm/[email protected]"
67+
uv run vdb --search "pkg:npm/[email protected]"
68+
uv run vdb --search "pkg:npm/[email protected]"
6469
if: ${{ matrix.python-version == '3.13' && matrix.os == 'ubuntu-latest' }}

.github/workflows/pythonpublish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ jobs:
2020
id-token: write
2121
steps:
2222
- uses: actions/checkout@v4
23-
- name: Install uv
24-
uses: astral-sh/setup-uv@v5
2523
- name: Set up Python
2624
uses: actions/setup-python@v5
2725
with:
2826
python-version: '3.12'
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v5
2929
- name: Use Node.js
3030
uses: actions/setup-node@v4
3131
with:
@@ -67,12 +67,12 @@ jobs:
6767
id-token: write
6868
steps:
6969
- uses: actions/checkout@v4
70-
- name: Install uv
71-
uses: astral-sh/setup-uv@v5
7270
- name: Set up Python
7371
uses: actions/setup-python@v5
7472
with:
7573
python-version: '3.12'
74+
- name: Install uv
75+
uses: astral-sh/setup-uv@v5
7676
- name: Install dependencies
7777
run: |
7878
cd packages/mcp-server-vdb

packages/mcp-server-vdb/src/mcp_server_vdb/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ async def handle_call_tool(
385385
write_stream,
386386
InitializationOptions(
387387
server_name="appthreat-vulnerability-db",
388-
server_version="6.4.3",
388+
server_version="6.4.4",
389389
capabilities=server.get_capabilities(
390390
notification_options=NotificationOptions(),
391391
experimental_capabilities={},

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "appthreat-vulnerability-db"
3-
version = "6.4.3"
3+
version = "6.4.4"
44
description = "AppThreat's vulnerability database and package search library with a built-in sqlite based storage. OSV, CVE, GitHub, npm are the primary sources of vulnerabilities."
55
authors = [
66
{name = "Team AppThreat", email = "[email protected]"},

test/data/MAL-2025-6022.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"modified": "2025-07-21T06:24:05Z",
3+
"published": "2025-07-21T06:24:05Z",
4+
"schema_version": "1.5.0",
5+
"id": "MAL-2025-6022",
6+
"summary": "Malicious code in eslint-config-prettier (npm)",
7+
"details": "This package installs a windows based malware file node-gyp.dll via install.js",
8+
"affected": [
9+
{
10+
"package": {
11+
"ecosystem": "npm",
12+
"name": "eslint-config-prettier"
13+
},
14+
"versions": [
15+
"8.10.1",
16+
"9.1.1",
17+
"10.1.6",
18+
"10.1.7"
19+
]
20+
}
21+
],
22+
"references": [
23+
{
24+
"type": "WEB",
25+
"url": "https://www.bleepingcomputer.com/news/security/popular-npm-linter-packages-hijacked-via-phishing-to-drop-malware/"
26+
}
27+
],
28+
"credits": [
29+
{
30+
"name": "GitHax - Software Supply Chain Threat Intelligence",
31+
"type": "FINDER",
32+
"contact": [
33+
"https://githax.com"
34+
]
35+
}
36+
],
37+
"database_specific": {
38+
"malicious-packages-origins": null
39+
}
40+
}

test/test_source.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,15 @@ def test_osv_mal2_json():
289289
return json.loads(fp.read())
290290

291291

292+
@pytest.fixture
293+
def test_osv_mal3_json():
294+
test_cve_data = os.path.join(
295+
os.path.dirname(os.path.realpath(__file__)), "data", "MAL-2025-6022.json"
296+
)
297+
with open(test_cve_data, mode="r", encoding="utf-8") as fp:
298+
return json.loads(fp.read())
299+
300+
292301
@pytest.fixture
293302
def test_osv_mvn_single_json():
294303
test_cve_data = os.path.join(
@@ -1112,10 +1121,12 @@ def test_osv_convert4(test_osv_maven_cvss4_json):
11121121
assert len(cve_data) == 6
11131122

11141123

1115-
def test_osv_mal_convert(test_osv_mal_json, test_osv_mal2_json):
1124+
def test_osv_mal_convert(test_osv_mal_json, test_osv_mal2_json, test_osv_mal3_json):
11161125
osvlatest = OSVSource()
1126+
cve_data = osvlatest.convert(test_osv_mal3_json)
1127+
assert len(cve_data) == 4
11171128
cve_data = osvlatest.convert(test_osv_mal2_json)
1118-
assert len(cve_data) == 1
1129+
assert len(cve_data) == 2
11191130
cve_data = osvlatest.convert(test_osv_mal_json)
11201131
assert len(cve_data) == 1
11211132

0 commit comments

Comments
 (0)